forked from dvopsway/datasploit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
domain_history.py
30 lines (24 loc) · 874 Bytes
/
domain_history.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
import sys
import json
import requests
from bs4 import BeautifulSoup
import re
def netcraft_domain_history(domain):
ip_history_dict= {}
print "\t\t\t[+] Searching domain history in netcraft\n"
endpoint = "http://toolbar.netcraft.com/site_report?url=%s" % (domain)
req = requests.get(endpoint)
soup = BeautifulSoup(req.content, 'html.parser')
urls_parsed = soup.findAll('a', href = re.compile(r'.*netblock\?q.*'))
for url in urls_parsed:
if (urls_parsed.index(url) != 0):
ip_history_dict[str(url).split('=')[2].split(">")[1].split("<")[0]] = str(url.parent.findNext('td')).strip("<td>").strip("</td>")
return ip_history_dict
def main():
domain = sys.argv[1]
dns_history = netcraft_domain_history(domain)
for x in dns_history.keys():
print "%s: %s" % (dns_history[x], x)
print "\n-----------------------------\n"
if __name__ == "__main__":
main()