This commit is contained in:
William Ballenthin
2021-08-11 09:23:41 -06:00
parent 97092c91db
commit 753b003107
4 changed files with 29 additions and 10 deletions

View File

@@ -14,9 +14,8 @@ import capa.features.extractors
import capa.features.extractors.helpers import capa.features.extractors.helpers
import capa.features.extractors.strings import capa.features.extractors.strings
from capa.features.file import Export, Import, Section from capa.features.file import Export, Import, Section
from capa.features.common import String, Characteristic from capa.features.common import CHARACTERISTIC_PE, CHARACTERISTIC_WINDOWS, String, Characteristic
from capa.features.extractors.base_extractor import FeatureExtractor from capa.features.extractors.base_extractor import FeatureExtractor
from capa.features.common import CHARACTERISTIC_WINDOWS, CHARACTERISTIC_PE
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@@ -34,10 +34,15 @@ import capa.features.insn
import capa.features.common import capa.features.common
import capa.features.basicblock import capa.features.basicblock
from capa.engine import Statement, FeatureSet from capa.engine import Statement, FeatureSet
from capa.features.common import MAX_BYTES_FEATURE_SIZE, Feature from capa.features.common import (
from capa.features.common import CHARACTERISTIC_WINDOWS, CHARACTERISTIC_LINUX, CHARACTERISTIC_MACOS CHARACTERISTIC_PE,
from capa.features.common import CHARACTERISTIC_PE, CHARACTERISTIC_ELF CHARACTERISTIC_ELF,
CHARACTERISTIC_LINUX,
CHARACTERISTIC_MACOS,
CHARACTERISTIC_WINDOWS,
MAX_BYTES_FEATURE_SIZE,
Feature,
)
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@@ -21,8 +21,14 @@ import capa.features.file
import capa.features.insn import capa.features.insn
import capa.features.common import capa.features.common
import capa.features.basicblock import capa.features.basicblock
from capa.features.common import ARCH_X32, ARCH_X64 from capa.features.common import (
from capa.features.common import CHARACTERISTIC_WINDOWS, CHARACTERISTIC_LINUX, CHARACTERISTIC_PE, CHARACTERISTIC_ELF ARCH_X32,
ARCH_X64,
CHARACTERISTIC_PE,
CHARACTERISTIC_ELF,
CHARACTERISTIC_LINUX,
CHARACTERISTIC_WINDOWS,
)
CD = os.path.dirname(__file__) CD = os.path.dirname(__file__)

View File

@@ -15,7 +15,16 @@ import capa.engine
import capa.features.common import capa.features.common
from capa.features.file import FunctionName from capa.features.file import FunctionName
from capa.features.insn import Number, Offset from capa.features.insn import Number, Offset
from capa.features.common import ARCH_X32, ARCH_X64, CHARACTERISTIC_PE, CHARACTERISTIC_WINDOWS, OS_WINDOWS, FORMAT_PE, String, Characteristic from capa.features.common import (
ARCH_X32,
ARCH_X64,
FORMAT_PE,
OS_WINDOWS,
CHARACTERISTIC_PE,
CHARACTERISTIC_WINDOWS,
String,
Characteristic,
)
def test_rule_ctor(): def test_rule_ctor():
@@ -979,4 +988,4 @@ def test_format_features():
r = capa.rules.Rule.from_yaml(rule) r = capa.rules.Rule.from_yaml(rule)
children = list(r.statement.get_children()) children = list(r.statement.get_children())
assert (CHARACTERISTIC_PE in children) == True assert (CHARACTERISTIC_PE in children) == True
assert (CHARACTERISTIC_ELF not in children) == True assert (CHARACTERISTIC_ELF not in children) == True