mirror of
https://github.com/mandiant/capa.git
synced 2025-12-22 07:10:29 -08:00
type: capa.engine
This commit is contained in:
@@ -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.
|
||||||
|
|||||||
@@ -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__)
|
||||||
|
|||||||
Reference in New Issue
Block a user