def query_dns(domain, nameserver=None, rdtypes=None): data = {} dnsinfo = gatherdns.GatherDNS(domain, nameserver) data['auth_nameserver'] = dnsinfo.find_authoritative_nameserver(domain) dnsinfo.query_domain(rdtypes) for rdtype in rdtypes: function = getattr(dnsinfo, 'get_{}_record'.format(rdtype)) result = function() if result is not None: data[rdtype] = result return data
def DNSMetaRun(domain): data = {} dnsinfo = gatherdns.GatherDNS(domain, Config.dnsmeta.dns_server) data['auth'] = dnsinfo.find_authoritative_nameserver(domain) # query for specified types and add to dictionary dnsinfo.query_domain(Config.dnsmeta.rdtypes) for rdtype in Config.dnsmeta.rdtypes: function = getattr(dnsinfo, 'get_{}_record'.format(rdtype)) result = function() if result is not None: data[rdtype] = result return data