mirror of
https://github.com/valitydev/Cortex-Analyzers.git
synced 2024-11-08 01:48:53 +00:00
#56 fixed format of summary() output and short reports
This commit is contained in:
parent
ee2bf0c973
commit
ee94e1ef92
@ -21,20 +21,23 @@ class SafebrowsingAnalyzer(Analyzer):
|
||||
|
||||
def summary(self, raw):
|
||||
|
||||
result = {"level":"info", "taxonomy":{"namespace": "Google", "predicate": "Safebrowsing", "value":0}}
|
||||
taxonomy = {"level":"info", "namespace": "Google", "predicate": "Safebrowsing", "value":0}
|
||||
taxonomies = []
|
||||
|
||||
if ("results" in raw):
|
||||
r = len(raw['results'])
|
||||
|
||||
if r == 0 or r == 1:
|
||||
result["taxonomy"]["value"] = "\"{} match\"".format(r)
|
||||
taxonomy["value"] = "\"{} match\"".format(r)
|
||||
else:
|
||||
result["taxonomy"]["value"] = "\"{} matches\"".format(r)
|
||||
taxonomy["value"] = "\"{} matches\"".format(r)
|
||||
|
||||
if r > 0:
|
||||
result["level"] = "malicious"
|
||||
taxonomy["level"] = "malicious"
|
||||
# level : info, safe, suspicious, malicious
|
||||
|
||||
taxonomies.append(taxonomy)
|
||||
result = {"taxonomies": taxonomies}
|
||||
return result
|
||||
|
||||
def run(self):
|
||||
|
@ -1,3 +1,3 @@
|
||||
<span class="label" ng-init="t = content.taxonomy" ng-class="{'info': 'label-info', 'safe': 'label-success', 'suspicious': 'label-warning', 'malicious':'label-danger'}[content.level]">
|
||||
<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>
|
||||
</span>
|
||||
|
Loading…
Reference in New Issue
Block a user