Skip to content

Commit

Permalink
#56 Yara summary() and short reports + bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromeleonard committed Jun 20, 2017
1 parent 7bc29d1 commit 2b8f0eb
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion analyzers/Yara/Yara.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"author": "Nils Kuhnert, CERT-Bund",
"license": "AGPL-V3",
"url": "https://github.com/BSI-CERT-Bund/cortex-analyzers",
"version": "1.0",
"version": "2.0",
"baseConfig": "Yara",
"config": {},
"description": "Check files against YARA rules",
Expand Down
11 changes: 11 additions & 0 deletions analyzers/Yara/yara_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,17 @@ def check(self, file):
return result

def summary(self, raw):

taxonomy = {"level": "info", "namespace": "Yara", "predicate": "Match", "value": 0}
taxonomies = []
taxonomy["value"] = "\"{} rules\"".format(len(raw["results"]))
if len(raw["results"]) == 0:
taxonomy["level"] = "safe"
else:
taxonomy["level"] = "malicious"

taxonomies.append(taxonomy)
result = {"taxomonies": taxonomies}
return {"matches":len(raw["results"])}

def run(self):
Expand Down
3 changes: 0 additions & 3 deletions thehive-templates/Yara_1_0/short.html

This file was deleted.

File renamed without changes.
3 changes: 3 additions & 0 deletions thehive-templates/Yara_2_0/short.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<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 2b8f0eb

Please sign in to comment.