diff --git a/capa/engine.py b/capa/engine.py index 19207afc..b28a15a2 100644 --- a/capa/engine.py +++ b/capa/engine.py @@ -235,8 +235,8 @@ class Subscope(Statement): the engine should preprocess rules to extract subscope statements into their own rules. """ - def __init__(self, scope, child): - super(Subscope, self).__init__() + def __init__(self, scope, child, description=None): + super(Subscope, self).__init__(description=description) self.scope = scope self.child = child diff --git a/capa/rules.py b/capa/rules.py index 18bfa061..b57e7b51 100644 --- a/capa/rules.py +++ b/capa/rules.py @@ -426,7 +426,7 @@ def build_statements(d, scope: str): if len(d[key]) != 1: raise InvalidRule("subscope must have exactly one child statement") - return ceng.Subscope(FUNCTION_SCOPE, build_statements(d[key][0], FUNCTION_SCOPE)) + return ceng.Subscope(FUNCTION_SCOPE, build_statements(d[key][0], FUNCTION_SCOPE), description=description) elif key == "basic block": if scope != FUNCTION_SCOPE: @@ -435,7 +435,7 @@ def build_statements(d, scope: str): if len(d[key]) != 1: raise InvalidRule("subscope must have exactly one child statement") - return ceng.Subscope(BASIC_BLOCK_SCOPE, build_statements(d[key][0], BASIC_BLOCK_SCOPE)) + return ceng.Subscope(BASIC_BLOCK_SCOPE, build_statements(d[key][0], BASIC_BLOCK_SCOPE), description=description) elif key.startswith("count(") and key.endswith(")"): # e.g.: