# guppy Copyright (C) 2010-2011 guppy team members. # # This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. # This is free software, and you are welcome to redistribute it # under certain conditions; type `show c' for details. # dns module # --gry import urllib.request, urllib.parse, urllib.error import socket @plugin class dns(object): """DNS lookups.""" def __init__(self, server): self.server = server self.commands = ["dns"] self.server.handle("command", self.handle_command, self.commands) def handle_command(self, channel, user, cmd, args): if cmd == "dns": if len(args) < 1: self.server.doMessage(channel, user+": Return a fully qualified domain name for a list of space-separated IPs or hostnames.") return try: for each in args: self.server.doMessage(channel, user+": "+ each+" = "+socket.getfqdn(each)) except Exception as e: self.server.doMessage(channel, user+": "+str(e))