acasown.py 823 B

123456789101112131415161718192021222324252627
  1. import ripe
  2. import censys
  3. import bong
  4. import sys
  5. import json
  6. r = ripe.Ripe()
  7. c = censys.Censys_WEB("dummyuser", "dummypass")
  8. b = bong.Bing()
  9. targets = r.search(sys.argv[1])
  10. print("Found " + str(len(targets)) + " ranges from Ripe")
  11. hosts = c.search_ipv4(c.build_query_ipv4(targets))
  12. print("Found " + str(len(hosts)) + " hosts from Censys")
  13. hosts_bing = b.search_hosts(hosts)
  14. result = []
  15. for host in hosts:
  16. result_ip = host['ip']
  17. result_vhosts = host['vhosts']
  18. result_urls = []
  19. for host_bing in hosts_bing:
  20. if host_bing['ip'] == result_ip:
  21. result_urls = host_bing['urls']
  22. for vhost in host_bing['vhosts']:
  23. if vhost not in result_vhosts:
  24. result_vhosts.append(vhost)
  25. result.append({'ip': result_ip, 'urls': result_urls, 'vhosts': result_vhosts, 'protocols': host['protocols']})
  26. print(json.dumps(result))