firmex/python/matcher/elf.py

18 lines
494 B
Python
Raw Permalink Normal View History

import io
from .matcher import SignatureMatcher, Match
class ELF(SignatureMatcher):
def __init__(self, file):
self.name = "ELF"
self.signature = b'\x7f\x45\x4c\x46\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00'
super().__init__(file)
def is_valid(self):
for match in self.search():
# walk back for the firmware section header
start = match
self.matches += [Match(start, 0)]
return len(self.matches) != 0