class Rex::MachScan::Scanner::Generic

Attributes

fat[RW]
mach[RW]
regex[RW]

Public Class Methods

new(binary) click to toggle source
# File lib/rex/machscan/scanner.rb, line 9
def initialize(binary)
  if binary.class == Rex::MachParsey::Mach
    self.mach = binary
  else
    self.fat = binary
  end
end

Public Instance Methods

config(param) click to toggle source
# File lib/rex/machscan/scanner.rb, line 17
def config(param)
end
scan(param) click to toggle source
# File lib/rex/machscan/scanner.rb, line 20
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={}) click to toggle source
# File lib/rex/machscan/scanner.rb, line 45
def scan_segment(segment, param={})
  []
end