[Python] DNS lookup
Platform: Python
Published Sep 13, 2011
Updated Sep 24, 2011
Intro
This is an easy DNS lookup function for Python IRC bots.
Its really buggy, but that's not my script. its the "gethostbyaddr" function.
Example
<Aha2Y> !dns hawkee.com
<&System> Address : ('hawkee.com', [], ['72.9.230.138'])
<~Aha2Y> !dns hawkee..org
<&System> [ERROR] Something is wrong here!!!
How to use
Make a variable called 'chan' with the channel name.
Then simply use !dns <ip/host>
- Status -
This snippet is finished. if data.find(''+ chan +' :!dns' ) != -1:
try:
dns = data.split( ''+ chan +' :!dns' )
dnsget = dns[1].strip()
dnserv = socket.gethostbyaddr(dnsget)
irc.send ( 'PRIVMSG '+ chan +' :Address : '+ str(dnserv) +'\n' )
except:
irc.send ( 'PRIVMSG '+ chan +' :[ERROR] Something is wrong here!!!\n' )