render: json: include locations for range

closes #43
This commit is contained in:
William Ballenthin
2020-07-01 12:05:43 -06:00
parent f55c1ac604
commit da9f8fede4

View File

@@ -1,6 +1,7 @@
import json
import six
import capa.rules
import capa.engine
@@ -150,6 +151,9 @@ def convert_match_to_result_document(rules, capabilities, result):
if isinstance(result.statement, capa.features.Feature):
if bool(result.success):
doc['locations'] = result.locations
elif isinstance(result.statement, capa.rules.Range):
if bool(result.success):
doc['locations'] = result.locations
# if we have a `match` statement, then we're referencing another rule.
# this could an external rule (written by a human), or