Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python3
- # python3 dotoip.py list.txt
- # list without http://
- # source : https://github.com/dextercyberlab/Domain-to-IP-Converter
- import socket
- d = []
- def domaintoip(file):
- with open(file) as t:
- for Hostname in t:
- Hostname = Hostname.rstrip()
- try:
- s = socket.gethostbyname(Hostname)
- d.append(s)
- print(Hostname + ' ===> ' + s)
- except:
- print(Hostname, 'Not Valid')
- continue
- with open('output.txt', 'w') as output:
- for out in d:
- print(out, file=output)
- output.close()
- f = str(input('Enter the file you want to extract: '))
- domaintoip(f)
Add Comment
Please, Sign In to add comment