mirror of
https://github.com/mandiant/capa.git
synced 2026-02-04 11:07:53 -08:00
remove the usage of SampleHashes's __iter__() 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_bytes(Path(self.bv.name).read_bytes())
|
||||
self.sample_hashes = SampleHashes.from_bytes(Path(bv.file.original_filename).read_bytes())
|
||||
|
||||
def get_base_address(self):
|
||||
return AbsoluteVirtualAddress(self.bv.start)
|
||||
|
||||
@@ -29,9 +29,9 @@ class CapeExtractor(DynamicFeatureExtractor):
|
||||
self.static = static
|
||||
self.behavior = behavior
|
||||
self.sample_hashes = SampleHashes(
|
||||
md5=static["file"]["md5"],
|
||||
sha1=static["file"]["sha1"],
|
||||
sha256=static["file"]["sha256"],
|
||||
md5=static["file"]["md5"].lower(),
|
||||
sha1=static["file"]["sha1"].lower(),
|
||||
sha256=static["file"]["sha256"].lower(),
|
||||
)
|
||||
|
||||
self.global_features = capa.features.extractors.cape.global_.extract_features(self.static)
|
||||
|
||||
@@ -83,6 +83,7 @@ from capa.features.address import NO_ADDRESS, Address
|
||||
from capa.features.extractors.base_extractor import (
|
||||
BBHandle,
|
||||
InsnHandle,
|
||||
SampleHashes,
|
||||
ThreadHandle,
|
||||
ProcessHandle,
|
||||
FunctionHandle,
|
||||
@@ -939,7 +940,8 @@ def collect_metadata(
|
||||
) -> rdoc.Metadata:
|
||||
# if it's a binary sample we hash it, if it's a report
|
||||
# we fetch the hashes from the report
|
||||
md5, sha1, sha256 = extractor.get_sample_hashes()
|
||||
sample_hashes: SampleHashes = extractor.get_sample_hashes()
|
||||
md5, sha1, sha256 = sample_hashes.md5, sample_hashes.sha1, sample_hashes.sha256
|
||||
|
||||
rules = tuple(r.resolve().absolute().as_posix() for r in rules_path)
|
||||
format_ = get_format(sample_path) if format_ == FORMAT_AUTO else format_
|
||||
|
||||
Reference in New Issue
Block a user