[Python] DNS lookup
Published Sep 13, 2011
Updated Sep 24, 2011
This is an easy DNS lookup function for Python IRC bots.
Its really buggy, but that's not my script. its the "gethostbyaddr" function.
<Aha2Y> !dns hawkee.com
<&System> Address : ('hawkee.com', , ['220.127.116.11'])
<~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:
dns = data.split( ''+ chan +' :!dns' )
dnsget = dns.strip()
dnserv = socket.gethostbyaddr(dnsget)
irc.send ( 'PRIVMSG '+ chan +' :Address : '+ str(dnserv) +'\n' )
irc.send ( 'PRIVMSG '+ chan +' :[ERROR] Something is wrong here!!!\n' )