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