From ad880dd668ff59b30037a1c339c678d78d004394 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Srokosz?= Date: Wed, 26 Jul 2023 17:24:03 +0200 Subject: [PATCH] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: MichaƂ Praszmo --- malduck/extractor/extract_manager.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/malduck/extractor/extract_manager.py b/malduck/extractor/extract_manager.py index 98a75f7..287ff81 100644 --- a/malduck/extractor/extract_manager.py +++ b/malduck/extractor/extract_manager.py @@ -111,7 +111,7 @@ def match_procmem(self, p: ProcessMemory) -> YaraRulesetMatch: bound with current ExtractManager. """ matches = p.yarap(self.rules, extended=True) - log.debug("Matched rules: %s", list(matches.keys())) + log.debug("Matched rules: %s", ",".join(list(matches.keys()))) return matches def carve_procmem(self, p: ProcessMemory) -> List[ProcessMemoryBinary]: @@ -130,13 +130,13 @@ def carve_procmem(self, p: ProcessMemory) -> List[ProcessMemoryBinary]: binaries += carved_bins return binaries - def push_config(self, config: Config): + def push_config(self, config: Config) -> bool: if not config.get("family"): return False family = config["family"] if family in self.configs: - if is_config_better(self.configs[family], config): + if is_config_better(base_config=self.configs[family], new_config=config): self.configs[family] = config log.debug("%s config looks better than previous one", family) return True @@ -171,7 +171,7 @@ def push_config(self, config: Config): self.configs[family] = config return True - def _extract_procmem(self, p: ProcessMemory, matches): + def _extract_procmem(self, p: ProcessMemory, matches) -> List[Config]: log.debug("%s - ripping...", repr(p)) # Create extraction context for single file manager = ExtractionContext(parent=self) @@ -237,7 +237,7 @@ def __init__(self, parent: ExtractManager) -> None: self.parent = parent #: Bound ExtractManager instance @property - def family(self): + def family(self) -> str: """Matched family""" return self.collected_config.get("family")