acasown/acasown.py

27 lines
823 B
Python
Raw Normal View History

2018-11-08 12:56:36 +01:00
import ripe
import censys
import bong
2018-11-09 00:30:20 +01:00
import sys
import json
2018-11-08 12:56:36 +01:00
r = ripe.Ripe()
2018-11-08 22:24:53 +01:00
c = censys.Censys_WEB("dummyuser", "dummypass")
2018-11-09 00:30:20 +01:00
b = bong.Bing()
targets = r.search(sys.argv[1])
2018-11-08 15:55:24 +01:00
print("Found " + str(len(targets)) + " ranges from Ripe")
hosts = c.search_ipv4(c.build_query_ipv4(targets))
print("Found " + str(len(hosts)) + " hosts from Censys")
2018-11-09 00:30:20 +01:00
hosts_bing = b.search_hosts(hosts)
result = []
2018-11-08 22:24:53 +01:00
for host in hosts:
2018-11-09 00:30:20 +01:00
result_ip = host['ip']
result_vhosts = host['vhosts']
result_urls = []
for host_bing in hosts_bing:
if host_bing['ip'] == result_ip:
result_urls = host_bing['urls']
for vhost in host_bing['vhosts']:
if vhost not in result_vhosts:
result_vhosts.append(vhost)
result.append({'ip': result_ip, 'urls': result_urls, 'vhosts': result_vhosts, 'protocols': host['protocols']})
print(json.dumps(result))