Class: Rex::ElfScan::Scanner::RegexScanner
- Inherits:
-
JmpRegScanner
- Object
- Generic
- JmpRegScanner
- Rex::ElfScan::Scanner::RegexScanner
- Defined in:
- lib/rex/elfscan/scanner.rb
Instance Attribute Summary
Attributes inherited from Generic
Instance Method Summary collapse
Methods inherited from JmpRegScanner
#_build_byte_list, #_parse_ret, #_ret_size
Methods inherited from Generic
Constructor Details
This class inherits a constructor from Rex::ElfScan::Scanner::Generic
Instance Method Details
#config(param) ⇒ Object
193 194 195 |
# File 'lib/rex/elfscan/scanner.rb', line 193 def config(param) self.regex = Regexp.new(param['args'], nil, 'n') end |
#scan_segment(program_header, param = {}) ⇒ Object
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 |
# File 'lib/rex/elfscan/scanner.rb', line 197 def scan_segment(program_header, param={}) offset = program_header.p_offset hits = [] while offset < program_header.p_offset + program_header.p_filesz && (offset = elf.index(regex, offset)) != nil idx = offset buf = '' mat = nil while (! (mat = buf.match(regex))) buf << elf.read(idx, 1) idx += 1 end rva = elf.offset_to_rva(offset) hits << [ rva, buf.unpack("H*") ] offset += buf.length end return hits end |