firmex/python/matcher/elf.py
nganhkhoa d50ec846c2 [python] some updates
- add ELF
- add basic ROMFS
2024-08-30 21:23:14 +07:00

18 lines
494 B
Python

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