2018-11-08 12:56:36 +01:00
|
|
|
import ripe
|
|
|
|
import censys
|
|
|
|
import bong
|
2019-04-14 16:04:33 +02:00
|
|
|
import webtech
|
|
|
|
import sys
|
|
|
|
import json
|
|
|
|
import ripe
|
|
|
|
import censys
|
|
|
|
import bong
|
|
|
|
import webtech
|
2018-11-09 00:30:20 +01:00
|
|
|
import sys
|
|
|
|
import json
|
2018-11-08 12:56:36 +01:00
|
|
|
|
|
|
|
r = ripe.Ripe()
|
2019-04-14 16:04:33 +02:00
|
|
|
c = censys.Censys_WEB("stripped", "stripped")
|
2018-11-09 00:30:20 +01:00
|
|
|
b = bong.Bing()
|
2019-04-14 16:04:33 +02:00
|
|
|
w = webtech.WebTech(options={'json': True})
|
2018-11-09 00:30:20 +01:00
|
|
|
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)
|
2019-04-14 16:04:33 +02:00
|
|
|
result.append({'ip': result_ip, 'urls': result_urls, 'vhosts': list(dict.fromkeys(result_vhosts)), 'protocols': host['protocols']})
|
|
|
|
print("Result has " + str(len(result)) + " entries")
|
|
|
|
final = {}
|
|
|
|
for host in result:
|
|
|
|
if "443/https" in host['protocols']:
|
|
|
|
try:
|
|
|
|
url = 'https://' + host['ip']
|
|
|
|
report = w.start_from_url(url, timeout=2)
|
|
|
|
final[url] = report
|
|
|
|
except webtech.utils.ConnectionException:
|
|
|
|
print("Site down " + url)
|
|
|
|
if "80/http" in host['protocols']:
|
|
|
|
try:
|
|
|
|
url = 'http://' + host['ip']
|
|
|
|
report = w.start_from_url('http://' + host['ip'], timeout=2)
|
|
|
|
final[url] = report
|
|
|
|
except webtech.utils.ConnectionException:
|
|
|
|
print("Site down " + url)
|
|
|
|
for vhost in host['vhosts']:
|
|
|
|
if "443/https" in host['protocols']:
|
|
|
|
try:
|
|
|
|
url = 'https://' + host['ip'] + ' (' + vhost + ')'
|
|
|
|
report = w.start_from_url(url, headers={'Host': vhost}, timeout=2)
|
|
|
|
final[url] = report
|
|
|
|
except webtech.utils.ConnectionException:
|
|
|
|
print("Site down " + url)
|
|
|
|
if "80/http" in host['protocols']:
|
|
|
|
try:
|
|
|
|
url = 'http://' + host['ip'] + ' (' + vhost + ')'
|
|
|
|
report = w.start_from_url('http://' + host['ip'], headers={'Host': vhost}, timeout=2)
|
|
|
|
final[url] = report
|
|
|
|
except webtech.utils.ConnectionException:
|
|
|
|
print("Site down " + url)
|
|
|
|
for urls in host['urls']:
|
|
|
|
try:
|
|
|
|
report = w.start_from_url(url, timeout=2)
|
|
|
|
final[url] = report
|
|
|
|
except webtech.utils.ConnectionException:
|
|
|
|
print("Site down " + url)
|
|
|
|
|
|
|
|
print(json.dumps(final, indent=4))
|