Class: Rex::MachScan::Scanner::Generic
- Inherits:
-
Object
- Object
- Rex::MachScan::Scanner::Generic
- Defined in:
- lib/rex/machscan/scanner.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#fat ⇒ Object
Returns the value of attribute fat.
-
#mach ⇒ Object
Returns the value of attribute mach.
-
#regex ⇒ Object
Returns the value of attribute regex.
Instance Method Summary collapse
- #config(param) ⇒ Object
-
#initialize(binary) ⇒ Generic
constructor
A new instance of Generic.
- #scan(param) ⇒ Object
- #scan_segment(segment, param = {}) ⇒ Object
Constructor Details
#initialize(binary) ⇒ Generic
Returns a new instance of Generic.
10 11 12 13 14 15 16 |
# File 'lib/rex/machscan/scanner.rb', line 10 def initialize(binary) if binary.class == Rex::MachParsey::Mach self.mach = binary else self.fat = binary end end |
Instance Attribute Details
#fat ⇒ Object
Returns the value of attribute fat.
8 9 10 |
# File 'lib/rex/machscan/scanner.rb', line 8 def fat @fat end |
#mach ⇒ Object
Returns the value of attribute mach.
8 9 10 |
# File 'lib/rex/machscan/scanner.rb', line 8 def mach @mach end |
#regex ⇒ Object
Returns the value of attribute regex.
8 9 10 |
# File 'lib/rex/machscan/scanner.rb', line 8 def regex @regex end |
Instance Method Details
#config(param) ⇒ Object
18 19 |
# File 'lib/rex/machscan/scanner.rb', line 18 def config(param) end |
#scan(param) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/rex/machscan/scanner.rb', line 21 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] = hit[1].is_a?(Array) ? hit[1].join(" ") : hit[1] $stdout.puts self.mach.ptr_s(vaddr - self.mach.fat_offset) + " " + end end end end |
#scan_segment(segment, param = {}) ⇒ Object
46 47 48 |
# File 'lib/rex/machscan/scanner.rb', line 46 def scan_segment(segment, param={}) [] end |