mirror of
https://github.com/mandiant/capa.git
synced 2025-12-12 15:49:46 -08:00
pep8
This commit is contained in:
@@ -285,9 +285,10 @@ def is_global_feature(feature):
|
||||
is this a feature that is extracted at every scope?
|
||||
today, this are OS and file format features.
|
||||
"""
|
||||
if (isinstance(feature, Characteristic)
|
||||
if (
|
||||
isinstance(feature, Characteristic)
|
||||
and isinstance(feature.value, str)
|
||||
and (feature.value.startswith("os/")
|
||||
or feature.value.startswith("format/"))):
|
||||
and (feature.value.startswith("os/") or feature.value.startswith("format/"))
|
||||
):
|
||||
return True
|
||||
return False
|
||||
return False
|
||||
|
||||
@@ -6,7 +6,6 @@ import contextlib
|
||||
import capa.features.extractors.elf
|
||||
from capa.features.common import CHARACTERISTIC_PE, CHARACTERISTIC_ELF, CHARACTERISTIC_WINDOWS, Characteristic
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
||||
@@ -221,4 +221,4 @@ def detect_elf_os(f: BinaryIO) -> str:
|
||||
# so we can get the debugging output of subsequent strategies
|
||||
ret = OS.LINUX if ret is None else ret
|
||||
|
||||
return ret.value if ret is not None else "unknown"
|
||||
return ret.value if ret is not None else "unknown"
|
||||
|
||||
@@ -9,16 +9,16 @@ import logging
|
||||
import functools
|
||||
import contextlib
|
||||
|
||||
import ida_loader
|
||||
import idaapi
|
||||
import ida_loader
|
||||
|
||||
import capa.ida.helpers
|
||||
import capa.features.extractors.elf
|
||||
from capa.features.common import CHARACTERISTIC_PE, CHARACTERISTIC_ELF, Characteristic
|
||||
import capa.features.extractors.ida.file
|
||||
import capa.features.extractors.ida.insn
|
||||
import capa.features.extractors.ida.function
|
||||
import capa.features.extractors.ida.basicblock
|
||||
from capa.features.common import CHARACTERISTIC_PE, CHARACTERISTIC_ELF, Characteristic
|
||||
from capa.features.extractors.base_extractor import FeatureExtractor
|
||||
|
||||
|
||||
|
||||
@@ -29,4 +29,4 @@ def is_runtime_ida():
|
||||
except ImportError:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
return True
|
||||
|
||||
@@ -27,6 +27,7 @@ logger = logging.getLogger("capa.detect-elf-os")
|
||||
def main(argv=None):
|
||||
if capa.helpers.is_runtime_ida():
|
||||
from capa.ida.helpers import IDAIO
|
||||
|
||||
f: BinaryIO = IDAIO()
|
||||
|
||||
else:
|
||||
|
||||
@@ -75,8 +75,8 @@ import capa.rules
|
||||
import capa.engine
|
||||
import capa.helpers
|
||||
import capa.features
|
||||
import capa.features.freeze
|
||||
import capa.features.common
|
||||
import capa.features.freeze
|
||||
|
||||
logger = logging.getLogger("capa.show-features")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user