From da9f8fede4cd6b7009799bf3fb459f9b7fff2f90 Mon Sep 17 00:00:00 2001 From: William Ballenthin Date: Wed, 1 Jul 2020 12:05:43 -0600 Subject: [PATCH] render: json: include locations for range closes #43 --- capa/render/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/capa/render/__init__.py b/capa/render/__init__.py index cafa7aac..e53aca1f 100644 --- a/capa/render/__init__.py +++ b/capa/render/__init__.py @@ -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