node/lib/metasm/metasm/exe_format/shellcode_rwx.rb
# allows definition of the base address
allows definition of the base address
allows definition of the base address
def parse_parser_instruction(instr)
		case instr.raw.downcase
		when '.base', '.baseaddr', '.base_addr'
			@lexer.skip_space
			raise instr, 'syntax error' if not base = Expression.parse(@lexer).reduce
			raise instr, 'syntax error' if tok = @lexer.nexttok and tok.type != :eol
			if @cursource.equal?(@source_r)
				@base_r = base
			elsif @cursource.equal?(@source_w)
				@base_w = base
			elsif @cursource.equal?(@source_x)
				@base_x = base
			else raise instr, "Where am I ?"
			end
		when '.rdata', '.rodata'
			@cursource = @source_r
		when '.data', '.bss'
			@cursource = @source_w
		when '.text'
			@cursource = @source_x
		else super(instr)
		end
	end
def parse_parser_instruction ( instr ) case instr . raw . downcase when '.base' , '.baseaddr' , '.base_addr' @lexer . skip_space raise instr , 'syntax error' if not base = Expression . parse ( @lexer ) . reduce raise instr , 'syntax error' if tok = @lexer . nexttok and tok . type != :eol if @cursource . equal? ( @source_r ) @base_r = base elsif @cursource . equal? ( @source_w ) @base_w = base elsif @cursource . equal? ( @source_x ) @base_x = base else raise instr , "Where am I ?" end when '.rdata' , '.rodata' @cursource = @source_r when '.data' , '.bss' @cursource = @source_w when '.text' @cursource = @source_x else super ( instr ) end end
allows definition of the base address
allows definition of the base address
# ".base_addr <expression>" # expression should #reduce to integer
instr