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.



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

#fatObject

Returns the value of attribute fat.



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

def fat
  @fat
end

#machObject

Returns the value of attribute mach.



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

def mach
  @mach
end

#regexObject

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]
          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



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

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