From e3d4f17384e2d0a0830bb99f933aacb3bdfd94bc Mon Sep 17 00:00:00 2001 From: Nabil Adouani Date: Mon, 3 Dec 2018 14:21:21 +0100 Subject: [PATCH] #373 Update Cyberprotect threatscore analyzer to handle result if no scores are found --- analyzers/Cyberprotect/CyberprotectAnalyzer.py | 3 ++- thehive-templates/Cyberprotect_ThreatScore_1_0/long.html | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/analyzers/Cyberprotect/CyberprotectAnalyzer.py b/analyzers/Cyberprotect/CyberprotectAnalyzer.py index 5314329c7..662060117 100755 --- a/analyzers/Cyberprotect/CyberprotectAnalyzer.py +++ b/analyzers/Cyberprotect/CyberprotectAnalyzer.py @@ -35,7 +35,8 @@ def run(self): if self.service == 'ThreatScore' and (self.data_type == 'domain' or self.data_type == 'ip'): try: response = requests.get("{}{}".format(self.URI, self.get_data())) - self.report({'result': response.json()}) + result = response.json() + self.report(result if len(result) > 0 else {}) except Exception as e: self.unexpectedError(e) else: diff --git a/thehive-templates/Cyberprotect_ThreatScore_1_0/long.html b/thehive-templates/Cyberprotect_ThreatScore_1_0/long.html index 714978715..ceab3b796 100755 --- a/thehive-templates/Cyberprotect_ThreatScore_1_0/long.html +++ b/thehive-templates/Cyberprotect_ThreatScore_1_0/long.html @@ -4,20 +4,20 @@
Report for {{artifact.data}} -
+

{{content.scores.length}} scores found.

- +
Date Score
{{score.date}} {{score.score}}
-
+
No results found