class Rex::PeScan::Scanner::RegexScanner

Public Instance Methods

config(param) click to toggle source
# File lib/rex/pescan/scanner.rb, line 196
def config(param)
  self.regex = Regexp.new(param['args'], nil, 'n')
end
scan_section(section, param={}) click to toggle source
# File lib/rex/pescan/scanner.rb, line 200
def scan_section(section, param={})
  index = 0

  hits  = [ ]

  while index < section.size && (index = section.index(regex, index)) != nil

    idx = index
    buf = ''
    mat = nil

    while (! (mat = buf.match(regex)))
      buf << section.read(idx, 1)
      idx += 1
    end

    rva = section.offset_to_rva(index)

    hits << [ rva, buf.unpack("H*") ]
    index += buf.length
  end

  return hits
end