Sha256: be3535692ee6c3e4e87b08ec3bd4077d4afd0ddd54b53a72b9afd63250f1e869

Contents?: true

Size: 795 Bytes

Versions: 3

Compression:

Stored size: 795 Bytes

Contents

#!/usr/bin/env ruby

# $Id: search.rb 5413 2008-02-13 02:43:56Z ramon $

module Rex
module ElfScan
module Search

	class DumpRVA
		attr_accessor :elf
		
		def initialize(elf)
			self.elf = elf
		end
		
		def config(param)
			@address = param['args']
		end
		
		def scan(param)
			config(param)
			
			$stdout.puts "[#{param['file']}]"
			
			# Adjust based on -A and -B flags
			pre = param['before'] || 0
			suf = param['after']  || 16
			
			@address -= pre
			@address = 0 if (@address < 0 || ! @address)
			buf = elf.read_rva(@address, suf)
			$stdout.puts elf.ptr_s(@address) + " " + buf.unpack("H*")[0]
		end	
	end

	class DumpOffset < DumpRVA
		def config(param)
			begin
				@address = elf.offset_to_rva(param['args'])
			rescue Rex::ElfParsey::BoundsError
			end
		end
	end	
end
end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
librex-0.0.4 lib/rex/elfscan/search.rb
librex-0.0.3 lib/rex/elfscan/search.rb
librex-0.0.1 lib/rex/elfscan/search.rb