#!/usr/bin/python
import sys
import socket
HOST=''
PORT=80
if (len(sys.argv) < 2):
print sys.argv[0], ""
sys.exit(0)
HOST = sys.argv[1]
for res in socket.getaddrinfo(HOST, PORT, socket.AF_UNSPEC, socket.SOCK_STREAM):
print res[4][0]
For example, if we execute the script and pass parameter 'www.google.com', we'd get this:
$ ./getdns.py www.google.com
74.125.224.50
74.125.224.51
74.125.224.48
74.125.224.49
74.125.224.52
No comments:
Post a Comment