From e34fdfae1ab8efccc89a14b4a3d3fc78a7caa3c1 Mon Sep 17 00:00:00 2001 From: Willi Ballenthin Date: Mon, 9 Jan 2023 13:01:41 +0100 Subject: [PATCH] mypy --- capa/features/common.py | 2 ++ capa/features/extractors/common.py | 1 + 2 files changed, 3 insertions(+) diff --git a/capa/features/common.py b/capa/features/common.py index 782094d8..cf2c02f3 100644 --- a/capa/features/common.py +++ b/capa/features/common.py @@ -180,6 +180,7 @@ class String(Feature): super().__init__(value, description=description) def get_value_str(self) -> str: + assert isinstance(self.value, str) return escape_string(self.value) @@ -236,6 +237,7 @@ class Substring(String): return Result(False, _MatchedSubstring(self, {}), []) def get_value_str(self) -> str: + assert isinstance(self.value, str) return escape_string(self.value) def __str__(self): diff --git a/capa/features/extractors/common.py b/capa/features/extractors/common.py index 585c0040..d72fcefd 100644 --- a/capa/features/extractors/common.py +++ b/capa/features/extractors/common.py @@ -9,6 +9,7 @@ import pefile import capa.features import capa.features.extractors.elf import capa.features.extractors.pefile +import capa.features.extractors.strings from capa.features.common import OS, FORMAT_PE, FORMAT_ELF, OS_WINDOWS, FORMAT_FREEZE, Arch, Format, String, Feature from capa.features.freeze import is_freeze from capa.features.address import NO_ADDRESS, Address, FileOffsetAddress