import ripe import censys import bong import sys import json r = ripe.Ripe() c = censys.Censys_WEB("dummyuser", "dummypass") b = bong.Bing() targets = r.search(sys.argv[1]) 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") hosts_bing = b.search_hosts(hosts) result = [] for host in hosts: 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))