Question on 7.0.0.0/8

michael.dillon at bt.com michael.dillon at bt.com
Mon Apr 16 15:59:32 UTC 2007



> With whois, I'd need to do 256 lookups, and I'd probably have to  
> implement the whois protocol myself (ok, trivial, but still) because  
> I can't just use one of the 3 million HTTP utils/libraries.

Really?
Do you know for a fact that the IANA whois server will not support
lookups for 0.0.0.0 and return a complete set of entries in one query? 

Your comment about the whois protocol is one of the funniest things I've
heard all year. Whois is about as complex as the TCP echo protocol found
on port 7. Here is an example in Python:

import socket
server = "whois.arin.net"
whoisport = 43
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((server, whoisport))
s.send("+ 199.1.2.3\n")
print s.recv(8192)

Nevertheless, I agree about using HTTP. The following basically works:

import urllib
answer =
urllib.urlopen("http://ws.arin.net/whois?queryinput=199.4.5.6").read()

print answer

However, to parse it you have to go to the second PRE block to extract
the data. If ARIN would supply a whois service that was designed to be
used with a RESTful API, then it could leave off all the HTML crud that
is there for an interactive viewer and maybe provide the data in XML or
JSON format rather than the RFC 2822/2068 header format.

--Michael Dillon



More information about the NANOG mailing list