Class: Rex::MachScan::Scanner::Generic

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

Direct Known Subclasses

JmpRegScanner

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(binary) ⇒ Generic

Returns a new instance of Generic.



11
12
13
14
15
16
17
# File 'lib/rex/machscan/scanner.rb', line 11

def initialize(binary)
	if binary.class == Rex::MachParsey::Mach
		self.mach = binary
	else
		self.fat = binary
	end
end

Instance Attribute Details

#fatObject

Returns the value of attribute fat.



9
10
11
# File 'lib/rex/machscan/scanner.rb', line 9

def fat
  @fat
end

#machObject

Returns the value of attribute mach.



9
10
11
# File 'lib/rex/machscan/scanner.rb', line 9

def mach
  @mach
end

#regexObject

Returns the value of attribute regex.



9
10
11
# File 'lib/rex/machscan/scanner.rb', line 9

def regex
  @regex
end

Instance Method Details

#config(param) ⇒ Object



19
20
# File 'lib/rex/machscan/scanner.rb', line 19

def config(param)
end

#scan(param) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/rex/machscan/scanner.rb', line 22

def scan(param)
		config(param)

		$stdout.puts "[#{param['file']}]"

		if !self.mach
			for mach in fat.machos
				if mach.mach_header.cputype == 0x7 #since we only support intel for the time being its all we process
					self.mach = mach
				end
			end
		end

		self.mach.segments.each do |segment|
			if segment.segname.include? "__TEXT"
				scan_segment(segment, param).each do |hit|
					vaddr  = hit[0]
					message  = hit[1].is_a?(Array) ? hit[1].join(" ") : hit[1]
					$stdout.puts self.mach.ptr_s(vaddr - self.mach.fat_offset) + " " + message
				end
			end
		end

end

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



47
48
49
# File 'lib/rex/machscan/scanner.rb', line 47

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