dns reverse look up with python ?
Donn Cave
donn at oz.net
Tue Jan 9 11:25:24 EST 2001
Quoth "Ralf Claus" <ralf.claus at t-online.de>:
| any suggestion about this theme ?
| Is there a way for me (newbie) ?
>>> import socket
>>> socket.gethostbyname('t-online.de')
'194.25.134.132'
>>> socket.gethostbyaddr('194.25.134.132')
('www1.sul.t-online.de', [], ['194.25.134.132'])
That's what I understand "reverse lookup" to mean. Given
a DNS name, like the host name that appears in your email
address "t-online.de", first I look up the IP address with
gethostbyname(). Then, I look up the DNS address by the
IP address.
Hopefully, after this procedure you have a stable pair of
IP and DNS addresses, so if you repeat this procedure you
will continue to get the same answer. That's the point.
Donn Cave, donn at oz.net
More information about the Python-list
mailing list