Below is the file 'plugins/dns.py' from this revision. You can also download the file.
#!/usr/bin/python import socket from ftplib import FTP import scan # requires the python-dns package import DNS export = { "name" : "dns", "version" : "0.1", "description" : "Look for open DNS servers", "type" : "scanner", "tcp_ports" : [53], "udp_ports" : [53] } sites = [(scan.urgency_warning, 'www.google.com'), (scan.urgency_info, 'www.uwa.edu.au')] def host_callback(library, host, tcp_ports, udp_ports): rv = [] ip_addresses = filter(lambda x: x[1] == "ipv4", host.addresses) if len(ip_addresses) == 0: return rv address, protocol = ip_addresses[0] DNS.Base.defaults['server'] = [address] for urgency, site in sites: r = DNS.DnsRequest(name=site, qtype='A') a = r.req() if len(a.answers) > 0: response = scan.ScannerResponse() response.plugin_name = export['name'] response.address = (address, protocol) response.urgency = urgency response.short_mesg = "Server answers for: " + site response.long_mesg = '%d results' % len(a.answers) rv.append(response) return rv