Skip to content

Commit

Permalink
#373 Update templates and fix the analyzer response when no records a…
Browse files Browse the repository at this point in the history
…re found
  • Loading branch information
nadouani committed Nov 30, 2018
1 parent b2b04d8 commit bd29b53
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions analyzers/Cyberprotect/CyberprotectAnalyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ def summary(self, raw):
taxonomies = []
namespace = "Cyberprotect"
if self.service == 'ThreatScore':
level = 'info';
level = 'info'
value = 'not in database'
if(raw.get('data') and raw.get('scores') and len(raw.get('scores')) > 0):
if raw.get('data') and raw.get('scores') and len(raw.get('scores')) > 0:
value = 'not analyzed yet'
if(raw['scores'][0].get('score')):
level = 'safe';
if raw['scores'][0].get('score'):
level = 'safe'
value = raw['scores'][0]['score']
if value >= 0.5:
level = 'malicious'
Expand All @@ -35,7 +35,7 @@ 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(response.json())
self.report({'result': response.json()})
except Exception as e:
self.unexpectedError(e)
else:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
<div class="panel panel-info" ng-if="success">
<div class="panel-heading">
<a href="https://threatscore.cyberprotect.fr" target="_blank">threatscore.cyberprotect.fr</a> Cyberprotect threat scoring system
Cyberprotect threat scoring system <a href="https://threatscore.cyberprotect.fr" target="_blank"><i class="fa fa-external-link"></i></a>
<br/> Report for
<strong>{{artifact.data}}</strong>
</div>
<div class="panel-body" ng-if="content.scores.length > 0">
<div class="panel-body" ng-if="content.result.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.scores">
<tr ng-repeat="score in ::content.result.scores">
<td>{{score.date}}</td>
<td>{{score.score}}</td>
</tr>
</table>
</div>
<div class="panel-body" ng-if="content.scores.length < 1">
<div class="panel-body" ng-if="!(content.result.scores.length > 0)">
No results found
</div>
</div>
Expand Down

0 comments on commit bd29b53

Please sign in to comment.