Sha256: 5e8f0cd995c33a2a04aa5c2c8c82d4b7394482fe24866875d261ef3d051d2776

Contents?: true

Size: 806 Bytes

Versions: 2

Compression:

Stored size: 806 Bytes

Contents

#!/usr/bin/env ruby
# -*- coding: binary -*-

# $Id: search.rb 15548 2012-06-29 06:08:20Z rapid7 $

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

2 entries across 2 versions & 1 rubygems

Version Path
librex-0.0.68 lib/rex/elfscan/search.rb
librex-0.0.66 lib/rex/elfscan/search.rb