Skip to content

Commit

Permalink
#56 update MISP summary() and short reports
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromeleonard committed Jun 16, 2017
1 parent e321f01 commit 743aa3c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
12 changes: 10 additions & 2 deletions analyzers/MISP/misp.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ def __init__(self):
name=self.getParam('config.name', None))

def summary(self, raw):
taxonomy = {"level": "info", "namespace": "MISP", "predicate": "Search", "value": 0}
taxonomies = []

data = []
for r in raw['results']:
Expand All @@ -23,9 +25,15 @@ def summary(self, raw):

# return number of unique events
if data == []:
return {'results': 0}
taxonomy["value"] = 0
taxonomies.append(taxonomy)
else:
return {'results': len(list(set(data)))}
taxonomy["value"] = "\"{} event(s)\"".format(len(list(set(data))))

result = {"taxonomies": taxonomies}
return result



def run(self):
if self.data_type == 'hash':
Expand Down
3 changes: 2 additions & 1 deletion thehive-templates/MISP_2_0/short.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
<span class="label label-info">MISP:Search="{{content.results}} event(s)"
<span class="label" ng-repeat="t in content.taxonomies" ng-class="{'info': 'label-info', 'safe': 'label-success', 'suspicious': 'label-warning', 'malicious':'label-danger'}[t.level]">
{{t.namespace}}:{{t.predicate}}={{t.value}}
</span>&nbsp;

0 comments on commit 743aa3c

Please sign in to comment.