Commit 2702d96b authored by Cool Fire's avatar Cool Fire

Created initial deobfus path

parent d0f2c480
Pipeline #243 passed with stage
in 36 seconds
......@@ -6,26 +6,38 @@ require_relative 'LexerFunctions.rb'
# Main class for the PHP lexer
class Lexer < LexerFunctions
require 'thread'
require_relative 'LexerConstants.rb'
attr_accessor :input
attr_accessor :input, :output
attr_reader :start, :pos
def initialize(debug)
puts 'New Lexer initialized' if debug
@debug = debug
end
# Kickstart the lexer
def start
def start(filename, queue)
@input = read_file(filename)
@start = 0
@pos = 0
@queue = queue
lex method :lex_text
end
# Main lexer function loop
def lex(state)
Thread.new do
state = state.call until state.nil?
end
emit nil
end
# Send lex token to parser queue
def emit(type)
# Put input[start..pos] into queue
@queue.push type
end
# Get next char
......@@ -49,9 +61,11 @@ class Lexer < LexerFunctions
backup
c
end
end
l = Lexer.new
l.input = '<?php print("test\n"); ?>'
l.start
puts l.input
# Try to read file to lex
def read_file(filename)
filename = File.expand_path filename
@input = File.read filename
puts "Read #{filename}" if @debug
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment