March 2019
Beginner
490 pages
12h 40m
English
We can use the Requests module and the whois.domaintools.com service to get information about the domain we are analyzing, such as the IP address and location.
You can find the following code in the get_whois_info.py file:
#!/usr/bin/env python3from lxml.html import fromstringimport requestsdomain = input("Enter the domain : ")url = 'http://whois.domaintools.com/' + domainheaders = {'User-Agent': 'wswp'}resp = requests.get(url, headers=headers)html = resp.texttree = fromstring(html)info = tree.xpath('//*[@id="stats"]//table/tbody/tr//text()')temp_list = []for each in info: each = each.strip() if each == "": continue temp_list.append(each.strip("\n"))ip_index = temp_list.index('IP Address')print("IP address ", temp_list[ip_index ...Read now
Unlock full access