Skip to content

Commit

Permalink
#56 update Firehol 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 fcd8197 commit a05169e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
23 changes: 17 additions & 6 deletions analyzers/FireHOLBlocklists/firehol_blocklists.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,23 @@ def _check_ip(self, ip):
return hits

def summary(self, raw):
result = {
'count': raw.get('count'),
'hits': []
}
for hit in raw.get('hits'):
result['hits'].append(hit.get('list'))
taxonomy = {"level": "info", "namespace": "Filehol", "predicate": "Blocklists", "value": 0}
taxonomies = []

r = raw.get('count', 0)

if r == 0 or r == 1:
taxonomy["value"] = "\"{} hit\"".format(r)
else:
taxonomy["value"] = "\"{} hits\"".format(r)

if r > 0:
taxonomy["level"] = "suspicious"
else:
taxonomy["level"] = "success"

taxonomies.append(taxonomy)
result = {"taxonomies": taxonomies}
return result

def run(self):
Expand Down
5 changes: 3 additions & 2 deletions thehive-templates/FireHOLBlocklists_1_0/short.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
<span ng-if="content.count == 0" class="label label-success">Firehol: No match</span>&nbsp;
<span ng-if="content.count > 0" class="label label-danger">Firehol: {{content.count}} match(es)</span>&nbsp
<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 a05169e

Please sign in to comment.