Skip to content

Commit

Permalink
#56 update Hippocampe 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 d0036cd commit f1b3d94
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
19 changes: 17 additions & 2 deletions analyzers/Hippocampe/hippo.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,25 @@ def scoreSummary(self, raw):
return result

def summary(self, raw):
taxonomy = {"level": "success", "namespace": "Hippocampe", "predicate": "Score", "value": 0}
taxonomies = []


if (self.service == 'hipposcore'):
return self.scoreSummary(raw)
r = self.scoreSummary(raw).get("data", 0)
taxonomy["value"] = r
if r > 0:
taxonomy["level"] = "malicious"
taxonomies.append(taxonomy)
elif (self.service == 'more'):
return self.moreSummary(raw)
r = self.moreSummary(raw).get("data", 0)
taxonomy["value"] = "\"{} record(s)\"".format(r)
if r > 0:
taxonomy["level"] = "malicious"
taxonomies.append(taxonomy)

result = {"taxonomies": taxonomies}
return result

def run(self):
data = self.getData()
Expand Down
4 changes: 3 additions & 1 deletion thehive-templates/HippoMore_1_0/short.html
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
<span ng-if="content[artifact.data] !== 0" class="label label-danger">Hippocampe: {{content[artifact.data]}} record(s)</span>
<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;
7 changes: 3 additions & 4 deletions thehive-templates/Hipposcore_1_0/short.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<span ng-init="score = content[artifact.data]" class="label"
ng-class="{'label-danger': score < 0, 'label-default': score == 0, 'label-success': score > 0}">
Hippocampe:Score= {{score}}
</span>
<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 f1b3d94

Please sign in to comment.