Skip to content

Commit

Permalink
#373 Update Cyberprotect threatscore analyzer to handle result if no …
Browse files Browse the repository at this point in the history
…scores are found
  • Loading branch information
nadouani committed Dec 3, 2018
1 parent bd29b53 commit 50cd7e0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion analyzers/Cyberprotect/CyberprotectAnalyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions thehive-templates/Cyberprotect_ThreatScore_1_0/long.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
<br/> Report for
<strong>{{artifact.data}}</strong>
</div>
<div class="panel-body" ng-if="content.result.scores.length > 0">
<div class="panel-body" ng-if="content.scores.length > 0">
<h4 class="dl-horizontal">{{content.scores.length}} scores found.</h4>
<table class="table table-bordered">
<tr>
<th>Date</th>
<th>Score</th>
</tr>
<tr ng-repeat="score in ::content.result.scores">
<tr ng-repeat="score in ::content.scores">
<td>{{score.date}}</td>
<td>{{score.score}}</td>
</tr>
</table>
</div>
<div class="panel-body" ng-if="!(content.result.scores.length > 0)">
<div class="panel-body" ng-if="!(content.scores.length > 0)">
No results found
</div>
</div>
Expand Down

0 comments on commit 50cd7e0

Please sign in to comment.