type: capa.engine

This commit is contained in:
William Ballenthin
2021-06-09 23:51:55 -06:00
parent 1c66ebe638
commit 5408481606
3 changed files with 9 additions and 3 deletions

View File

@@ -9,7 +9,13 @@
import copy import copy
import collections import collections
from typing import Union, List, Dict, Set
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from capa.rules import Rule
import capa.features.common import capa.features.common
from capa.features.common import Feature
class Statement(object): class Statement(object):
@@ -78,7 +84,7 @@ class Result(object):
we need this so that we can render the tree of expressions and their results. we need this so that we can render the tree of expressions and their results.
""" """
def __init__(self, success, statement, children, locations=None): def __init__(self, success: bool, statement: Union[Statement, Feature], children: List["Result"], locations=None):
""" """
args: args:
success (bool) success (bool)
@@ -199,7 +205,7 @@ class Subscope(Statement):
raise ValueError("cannot evaluate a subscope directly!") raise ValueError("cannot evaluate a subscope directly!")
def match(rules, features, va): def match(rules: List["Rule"], features: Dict[Feature, Set[int]], va: int):
""" """
Args: Args:
rules (List[capa.rules.Rule]): these must already be ordered topologically by dependency. rules (List[capa.rules.Rule]): these must already be ordered topologically by dependency.

View File

@@ -33,7 +33,6 @@ 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.rules import Rule
from capa.features.common import MAX_BYTES_FEATURE_SIZE, Feature from capa.features.common import MAX_BYTES_FEATURE_SIZE, Feature
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@@ -25,6 +25,7 @@ requirements = [
"vivisect==1.0.3", "vivisect==1.0.3",
"smda==1.5.18", "smda==1.5.18",
"pefile==2021.5.24", "pefile==2021.5.24",
"typing==3.7.4.3",
] ]
# this sets __version__ # this sets __version__