address review comments: rename SampleHashes's from_sample() method to from_bytes() method

This commit is contained in:
Yacine Elhamer
2023-07-20 21:53:28 +01:00
parent ab092cb536
commit 6ee1dfd656
4 changed files with 4 additions and 4 deletions

View File

@@ -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)

View File

@@ -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

View File

@@ -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())

View File

@@ -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]] = []