mirror of
https://github.com/mandiant/capa.git
synced 2025-12-12 15:49:46 -08:00
extractor: tweak hashes to fix mypy
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user