Is there a python-module that\'s doing the same stuff as nslookup does? I am planning to use nslookup on digging some information regarding the domain of a URL to be scrappe
the problem is that socket.gethostbyname() returns only one ip-address. nslookup returns as many as it has. I use:
import subprocess
process = subprocess.Popen(["nslookup", "www.google.com"], stdout=subprocess.PIPE)
output = process.communicate()[0].split('\n')
ip_arr = []
for data in output:
if 'Address' in data:
ip_arr.append(data.replace('Address: ',''))
ip_arr.pop(0)
print ip_arr
it will print:
['54.230.228.101', '54.230.228.6', '54.230.228.37', '54.230.228.80', '54.230.228.41', '54.230.228.114', '54.230.228.54', '54.230.228.23']