Skip to content

Commit

Permalink
#56 fix bugs in summary()
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromeleonard committed Jun 16, 2017
1 parent 60b64e1 commit 8ebcb36
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 24 deletions.
12 changes: 6 additions & 6 deletions analyzers/DNSDB/dnsdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ def summary(self, raw):
if ("records" in raw):
r = len(raw["records"])

if r == 0 or r == 1:
taxonomy["value"] = "\"{} record\"".format(r)
else:
taxonomy["value"] = "\"{} records\"".format(r)
taxonomies.append(taxonomy)
if r == 0 or r == 1:
taxonomy["value"] = "\"{} record\"".format(r)
else:
taxonomy["value"] = "\"{} records\"".format(r)

result = {'taxonomies': taxonomies}
taxonomies.append(taxonomy)

result = {'taxonomies': taxonomies}
return result

def run(self):
Expand Down
4 changes: 4 additions & 0 deletions analyzers/DomainTools/domaintools.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,22 @@ def summary(self, raw):
if r["service"] == "reverse-ip":
report["predicate"] = "Reverse_IP"
taxonomy["value"] = "\"{}, {} domains\"".format(r["ip"]["address"], r["ip"]["domain_count"])
taxonomies.append(taxonomy)

if r["service"] == "name-server-domains":
taxonomy["predicate"] = "Reverse_Name_Server"
taxonomy["value"] = "\"{}, {} domains\"".format(r["name_server"], r["domain_count"])
taxonomies.append(taxonomy)

if r["service"] == "reverse-whois":
taxonomy["predicate"] = "Reverse_Whois"
taxonomy["value"] = "\"curr:{} / hist:{} domains\"".format(r["domain_count"]["current"], r["domain_count"]["historic"])
taxonomies.append(taxonomy)

if r["service"] == "whois/history":
taxonomy["predicate"] = "Whois_History"
taxonomy["value"] = "\"{}, {} domains \"".format(r["name_server"], r["domain_count"])
taxonomies.append(taxonomy)

if (r["service"] == "whois/parsed") or (r['service'] == "whois"):
taxonomy["predicate"] = "Whois"
Expand Down
22 changes: 12 additions & 10 deletions analyzers/FireHOLBlocklists/firehol_blocklists.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,19 +115,21 @@ def summary(self, raw):
taxonomy = {"level": "info", "namespace": "Filehol", "predicate": "Blocklists", "value": 0}
taxonomies = []

r = raw.get('count', 0)
if 'count' in raw:
r = raw.get('count', 0)

if r == 0 or r == 1:
taxonomy["value"] = "\"{} hit\"".format(r)
else:
taxonomy["value"] = "\"{} hits\"".format(r)
if r == 0 or r == 1:
taxonomy["value"] = "\"{} hit\"".format(r)
else:
taxonomy["value"] = "\"{} hits\"".format(r)

if r > 0:
taxonomy["level"] = "suspicious"
else:
taxonomy["level"] = "success"
if r > 0:
taxonomy["level"] = "suspicious"
else:
taxonomy["level"] = "success"

taxonomies.append(taxonomy)

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

Expand Down
16 changes: 8 additions & 8 deletions analyzers/GoogleSafebrowsing/safebrowsing_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ def summary(self, raw):
if ("results" in raw):
r = len(raw['results'])

if r == 0 or r == 1:
taxonomy["value"] = "\"{} match\"".format(r)
else:
taxonomy["value"] = "\"{} matches\"".format(r)

if r > 0:
taxonomy["level"] = "malicious"
# level : info, safe, suspicious, malicious
if r == 0 or r == 1:
taxonomy["value"] = "\"{} match\"".format(r)
else:
taxonomy["value"] = "\"{} matches\"".format(r)
if r > 0:
taxonomy["level"] = "malicious"
# level : info, safe, suspicious, malicious

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

0 comments on commit 8ebcb36

Please sign in to comment.