mirror of
https://github.com/mandiant/capa.git
synced 2025-12-12 15:49:46 -08:00
address review comments: rename SampleHashes's from_sample() method to from_bytes() method
This commit is contained in:
@@ -35,7 +35,7 @@ class BinjaFeatureExtractor(StaticFeatureExtractor):
|
||||
self.global_features.extend(capa.features.extractors.binja.file.extract_file_format(self.bv))
|
||||
self.global_features.extend(capa.features.extractors.binja.global_.extract_os(self.bv))
|
||||
self.global_features.extend(capa.features.extractors.binja.global_.extract_arch(self.bv))
|
||||
self.sample_hashes = SampleHashes.from_sample(Path(self.bv.name).read_bytes())
|
||||
self.sample_hashes = SampleHashes.from_bytes(Path(self.bv.name).read_bytes())
|
||||
|
||||
def get_base_address(self):
|
||||
return AbsoluteVirtualAddress(self.bv.start)
|
||||
|
||||
@@ -78,7 +78,7 @@ class DnfileFeatureExtractor(StaticFeatureExtractor):
|
||||
def __init__(self, path: Path):
|
||||
super().__init__()
|
||||
self.pe: dnfile.dnPE = dnfile.dnPE(str(path))
|
||||
self.sample_hashes = SampleHashes.from_sample(path.read_bytes())
|
||||
self.sample_hashes = SampleHashes.from_bytes(path.read_bytes())
|
||||
|
||||
# pre-compute .NET token lookup tables; each .NET method has access to this cache for feature extraction
|
||||
# most relevant at instruction scope
|
||||
|
||||
@@ -35,7 +35,7 @@ class IdaFeatureExtractor(StaticFeatureExtractor):
|
||||
self.global_features.extend(capa.features.extractors.ida.file.extract_file_format())
|
||||
self.global_features.extend(capa.features.extractors.ida.global_.extract_os())
|
||||
self.global_features.extend(capa.features.extractors.ida.global_.extract_arch())
|
||||
self.sample_hashes = SampleHashes.from_sample(Path(idaapi.get_input_file_path()).read_bytes())
|
||||
self.sample_hashes = SampleHashes.from_bytes(Path(idaapi.get_input_file_path()).read_bytes())
|
||||
|
||||
def get_base_address(self):
|
||||
return AbsoluteVirtualAddress(idaapi.get_imagebase())
|
||||
|
||||
@@ -37,7 +37,7 @@ class VivisectFeatureExtractor(StaticFeatureExtractor):
|
||||
self.vw = vw
|
||||
self.path = path
|
||||
self.buf = path.read_bytes()
|
||||
self.sample_hashes = SampleHashes.from_sample(self.buf)
|
||||
self.sample_hashes = SampleHashes.from_bytes(self.buf)
|
||||
|
||||
# pre-compute these because we'll yield them at *every* scope.
|
||||
self.global_features: List[Tuple[Feature, Address]] = []
|
||||
|
||||
Reference in New Issue
Block a user