Class: Rex::PeScan::Scanner::RegexScanner
- Inherits:
-
Generic
- Object
- Generic
- Rex::PeScan::Scanner::RegexScanner
show all
- Defined in:
- lib/rex/pescan/scanner.rb
Instance Attribute Summary
Attributes inherited from Generic
#pe, #regex
Instance Method Summary
collapse
Methods inherited from Generic
#initialize, #scan
Instance Method Details
#config(param) ⇒ Object
197
198
199
|
# File 'lib/rex/pescan/scanner.rb', line 197
def config(param)
self.regex = Regexp.new(param['args'], nil, 'n')
end
|
#scan_section(section, param = {}) ⇒ Object
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
|
# File 'lib/rex/pescan/scanner.rb', line 201
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
|