i am trying to do a DNS lookup to an IP with Python, im using Python 3.x.
im using a long list of URLs, which look like :
yahoo.com
google.com
linkedin.com
facebook.com
cnn.com
foxnews.com
here is my scirpt :
import socket
file = '/Users/Python/Scripts/URL-list.txt'
file_O=open(file, 'r')
for i in file_O:
print(i + socket.gethostbyname('i'))`
for some reason, when i run it for a URL at a time, it works perfect but when i run it on my list, they all return the same IP. here is an example;
yahoo.com
69.16.143.64
google.com
69.16.143.64
linkedin.com
69.16.143.64
facebook.com
69.16.143.64
cnn.com
69.16.143.64
foxnews.com
69.16.143.64
any idea what am i doing wrong? im guessing its in the way its read the text file, but then this IP doesnt map to any or the URLs.