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.
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
#fat ⇒ Object
Returns the value of attribute fat.
9 10 11 |
# File 'lib/rex/machscan/scanner.rb', line 9 def fat @fat end |
#mach ⇒ Object
Returns the value of attribute mach.
9 10 11 |
# File 'lib/rex/machscan/scanner.rb', line 9 def mach @mach end |
#regex ⇒ Object
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] = 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
47 48 49 |
# File 'lib/rex/machscan/scanner.rb', line 47 def scan_segment(segment, param={}) [] end |