Class: Rex::ElfScan::Scanner::Generic

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

Direct Known Subclasses

JmpRegScanner

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(elf) ⇒ Generic

Returns a new instance of Generic.



12
13
14
# File 'lib/rex/elfscan/scanner.rb', line 12

def initialize(elf)
	self.elf = elf
end

Instance Attribute Details

#elfObject

Returns the value of attribute elf.



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

def elf
  @elf
end

#regexObject

Returns the value of attribute regex.



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

def regex
  @regex
end

Instance Method Details

#config(param) ⇒ Object



16
17
# File 'lib/rex/elfscan/scanner.rb', line 16

def config(param)
end

#scan(param) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/rex/elfscan/scanner.rb', line 19

def scan(param)
	config(param)

	$stdout.puts "[#{param['file']}]"
	elf.program_header.each do |program_header|

		# Scan only loadable segment entries in the program header table
		if program_header.p_type == Rex::ElfParsey::ElfBase::PT_LOAD
			hits = scan_segment(program_header, param)
			hits.each do |hit|
				rva  = hit[0]
				message  = hit[1].is_a?(Array) ? hit[1].join(" ") : hit[1]
				$stdout.puts elf.ptr_s(rva) + " " + message
			end
		end

	end
end

#scan_segment(program_header, param = {}) ⇒ Object



38
39
40
# File 'lib/rex/elfscan/scanner.rb', line 38

def scan_segment(program_header, param={})
	[]
end