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
173
174
175
|
# File 'lib/rex/pescan/scanner.rb', line 173
def config(param)
self.regex = Regexp.new(param['args'], nil, 'n')
end
|
#scan_section(section, param = {}) ⇒ Object
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
|
# File 'lib/rex/pescan/scanner.rb', line 177
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
|