Skip to content

Commit

Permalink
#66 Refactor the summary() method of passive total analyzer
Browse files Browse the repository at this point in the history
  • Loading branch information
nadouani committed Jun 27, 2017
1 parent 04942fe commit 495efd8
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions analyzers/PassiveTotal/passivetotal_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def summary(self, raw):
result['malware'] = False
level = "safe"
value = "\"{}\"".format(result['malware'])
taxonomies.append(self.buid_taxonomy(level, namespace, predicate, value))
taxonomies.append(self.build_taxonomy(level, namespace, predicate, value))

# osint service
elif self.service == 'osint':
Expand All @@ -44,28 +44,22 @@ def summary(self, raw):
else:
result['osint'] = False
value = "\"{}\"".format(result['osint'])
taxonomies.append(self.buid_taxonomy(level, namespace, predicate, value))
taxonomies.append(self.build_taxonomy(level, namespace, predicate, value))

# passive dns service
elif self.service == 'passive_dns':
predicate = "PassiveDNS"
if 'firstSeen' in raw and raw['firstSeen']:
result['firstSeen'] = raw['firstSeen']
if 'lastSeen' in raw and raw['lastSeen']:
result['lastSeen'] = raw['lastSeen']
if 'totalRecords' in raw and raw['totalRecords']:
result['total'] = raw['totalRecords']
else:
result['total'] = 0

if result['total'] < 2:
value = "\"{} record\"".format(result['total'])
else:
value = "\"{} records\"".format(result['total'])

print(level)
print(namespace)
print(predicate)
print(value)
taxonomies.append(self.buid_taxonomy(level, namespace, predicate, value))
taxonomies.append(self.build_taxonomy(level, namespace, predicate, value))

# ssl certificate details service
elif self.service == 'ssl_certificate_details':
Expand Down

0 comments on commit 495efd8

Please sign in to comment.