Simple whois client
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | """whois.py
simple whois client
"""
import sys
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("whois.arin.net", 43))
s.send(sys.argv[1] + "\r\n")
response = ''
while True:
d = s.recv(4096)
response += d
if d == '':
break
s.close()
print
print response
|
Here's a more complete example that functions exactly like the UNIX whois(1) command:
http://code.activestate.com/recipes/577364-whois-client
Here is with some changes: