Skip to content

Commit

Permalink
#56 VirusTotal() 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 4a24c01 commit 4b4e3f5
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 13 deletions.
2 changes: 1 addition & 1 deletion analyzers/VirusTotal/VirusTotal_GetReport.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "VirusTotal_GetReport",
"version": "2.0",
"version": "3.0",
"author": "CERT-BDF",
"url": "https://github.com/CERT-BDF/Cortex-Analyzers",
"license": "AGPL-V3",
Expand Down
2 changes: 1 addition & 1 deletion analyzers/VirusTotal/VirusTotal_Scan.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "VirusTotal_Scan",
"version": "2.0",
"version": "3.0",
"author": "CERT-BDF",
"url": "https://github.com/CERT-BDF/Cortex-Analyzers",
"license": "AGPL-V3",
Expand Down
14 changes: 14 additions & 0 deletions analyzers/VirusTotal/virustotal.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ def read_scan_response(self, response, func):
self.error('Scan not found')

def summary(self, raw):

taxonomy = {"level": "clean", "namespace": "VT", "predicate": "Score", "value": 0}
taxonomies = []

result = {
"has_result": True
}
Expand Down Expand Up @@ -91,6 +95,16 @@ def summary(self, raw):
result["detected_downloaded_samples"] = len(
raw["detected_downloaded_samples"])

taxonomy['value'] = "{}/{}".format(result["positives"], result["total"])
if result["positives"] == 0:
taxonomy["level"] = "safe"
elif result["positives"] < 5 :
taxonomy["level"] = "suspicious"
else:
taxonomy["level"] = "malicious"

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

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

This file was deleted.

3 changes: 3 additions & 0 deletions thehive-templates/VirusTotal_GetReport_3_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;
3 changes: 0 additions & 3 deletions thehive-templates/VirusTotal_Scan_2_0/short.html

This file was deleted.

3 changes: 3 additions & 0 deletions thehive-templates/VirusTotal_Scan_3_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 4b4e3f5

Please sign in to comment.