extractor: tweak hashes to fix mypy

This commit is contained in:
Willi Ballenthin
2023-08-25 09:38:23 +00:00
parent b930523d44
commit 164b08276c
2 changed files with 1 additions and 7 deletions

View File

@@ -126,7 +126,6 @@ class StaticFeatureExtractor:
"""
raise NotImplementedError()
@abc.abstractmethod
def get_sample_hashes(self) -> SampleHashes:
"""
fetch the hashes for the sample contained within the extractor.
@@ -363,7 +362,6 @@ class DynamicFeatureExtractor:
super().__init__()
self._sample_hashes = hashes
@abc.abstractmethod
def get_sample_hashes(self) -> SampleHashes:
"""
fetch the hashes for the sample contained within the extractor.

View File

@@ -156,10 +156,9 @@ GLOBAL_HANDLERS = (
class ElfFeatureExtractor(StaticFeatureExtractor):
def __init__(self, path: Path):
super().__init__()
super().__init__(SampleHashes.from_bytes(self.path.read_bytes()))
self.path: Path = path
self.elf = ELFFile(io.BytesIO(path.read_bytes()))
self.sample_hashes = SampleHashes.from_bytes(self.path.read_bytes())
def get_base_address(self):
# virtual address of the first segment with type LOAD
@@ -167,9 +166,6 @@ class ElfFeatureExtractor(StaticFeatureExtractor):
if segment.header.p_type == "PT_LOAD":
return AbsoluteVirtualAddress(segment.header.p_vaddr)
def get_sample_hashes(self) -> SampleHashes:
return self.sample_hashes
def extract_global_features(self):
buf = self.path.read_bytes()