forked from ebouillon/Censys-Maltego
-
Notifications
You must be signed in to change notification settings - Fork 0
/
censys_domain2hash.py
41 lines (36 loc) · 1.49 KB
/
censys_domain2hash.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#############################################
# Censys API Cert Hash to IP
#
# Author: Emmanuel Bouillon
# Email: [email protected]
# Date: 11/06/2015
#############################################
import sys
import json
import censys.ipv4
import censys.certificates
from censys_util import *
if __name__ == '__main__':
dom = sys.argv[1]
mt = MaltegoTransform()
mt.addUIMessage('[INFO] ' + dom + ' to IP')
cert = censys.certificates.CensysCertificates(UID, SECRET)
try:
for c in cert.search(dom):
j = json.loads(json.dumps(c))
if j.has_key('parsed.fingerprint_sha256'):
for i in j['parsed.fingerprint_sha256']:
me = MaltegoEntity('maltego.Hash', i)
mt.addEntityToMessage(me);
if j.has_key('parsed.fingerprint_sha1'):
for i in j['parsed.fingerprint_sha1']:
me = MaltegoEntity('maltego.Hash', i)
mt.addEntityToMessage(me);
if j.has_key('parsed.fingerprint_md5'):
for i in j['parsed.fingerprint_md5']:
me = MaltegoEntity('maltego.Hash', i)
mt.addEntityToMessage(me);
me.addAdditionalFields('notes#', 'notes', False, j['parsed.subject_dn'][0])
except Exception as e:
mt.addUIMessage('[Error] ' + str(e))
mt.returnOutput()