Class: Rex::ElfScan::Search::DumpRVA

Inherits:
Object
  • Object
show all
Defined in:
lib/rex/elfscan/search.rb

Direct Known Subclasses

DumpOffset

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(elf) ⇒ DumpRVA

Returns a new instance of DumpRVA.



10
11
12
# File 'lib/rex/elfscan/search.rb', line 10

def initialize(elf)
  self.elf = elf
end

Instance Attribute Details

#elfObject

Returns the value of attribute elf.



8
9
10
# File 'lib/rex/elfscan/search.rb', line 8

def elf
  @elf
end

Instance Method Details

#config(param) ⇒ Object



14
15
16
# File 'lib/rex/elfscan/search.rb', line 14

def config(param)
  @address = param['args']
end

#scan(param) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/rex/elfscan/search.rb', line 18

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