Apply suggestions from code review

Co-authored-by: Willi Ballenthin <willi.ballenthin@gmail.com>
This commit is contained in:
Zander Work
2023-03-09 11:51:19 -05:00
committed by GitHub
parent dbb0200147
commit 7e823057b9
3 changed files with 2 additions and 4 deletions

View File

@@ -4,7 +4,7 @@
### New Features
- new cli flag `-o`/`--os` to override auto-detected operating system for a sample @captainGeech42
- new cli flag `--os` to override auto-detected operating system for a sample @captainGeech42
### Breaking Changes

View File

@@ -29,14 +29,13 @@ class VivisectFeatureExtractor(FeatureExtractor):
super().__init__()
self.vw = vw
self.path = path
self.os = os
with open(self.path, "rb") as f:
self.buf = f.read()
# pre-compute these because we'll yield them at *every* scope.
self.global_features: List[Tuple[Feature, Address]] = []
self.global_features.extend(capa.features.extractors.viv.file.extract_file_format(self.buf))
self.global_features.extend(capa.features.extractors.common.extract_os(self.buf, self.os))
self.global_features.extend(capa.features.extractors.common.extract_os(self.buf, os))
self.global_features.extend(capa.features.extractors.viv.global_.extract_arch(self.vw))
def get_base_address(self):

View File

@@ -880,7 +880,6 @@ def install_common_args(parser, wanted=None):
]
os_help = ", ".join(["%s (%s)" % (o[0], o[1]) if len(o) == 2 else o[0] for o in oses])
parser.add_argument(
"-o",
"--os",
choices=[o[0] for o in oses],
default=OS_AUTO,