On Tue, Sep 07, 2021 at 09:44:43AM +0200,
 Stephane Bortzmeyer <bortzme...@nic.fr> wrote 
 a message of 34 lines which said:

> I'm not aware of a tool (free software or not) which does it. Some
> programming will be required.

Attached is an example program. Free software licence, whatever you
prefer. Requires Python and the dnspython library. For many many
requests, it would probably be better to parallelize it. 

% ./list-auth.py bortzmeyer.org www.bortzmeyer.org fr toto.tata.trucmachin.fx 
3.3.1.0.6.8.0.0.0.0.0.0.0.0.0.0.7.0.0.0.8.4.3.1.c.7.6.0.1.0.0.2.ip6.arpa  
lists.isc.org tristatelogic.com

bortzmeyer.org.: ns3.absolight.net. ns2.bortzmeyer.org. ns4.bortzmeyer.org. 
ns.eu.org. ns2.absolight.net. ns1.bortzmeyer.org. 

www.bortzmeyer.org.: ns2.absolight.net. ns1.bortzmeyer.org. ns3.absolight.net. 
ns2.bortzmeyer.org. ns4.bortzmeyer.org. ns.eu.org. 

fr.: d.nic.fr. e.ext.nic.fr. f.ext.nic.fr. g.ext.nic.fr. 

toto.tata.trucmachin.fx.: DOES NOT EXIST

3.3.1.0.6.8.0.0.0.0.0.0.0.0.0.0.7.0.0.0.8.4.3.1.c.7.6.0.1.0.0.2.ip6.arpa.: 
ns3.nic.fr. ns1.nic.fr. ns2.nic.fr. 

lists.isc.org.: ns.isc.afilias-nst.info. ns1.isc.org. ns3.isc.org. ns2.isc.org. 

tristatelogic.com.: t1.zoneedit.com. t2.zoneedit.com. 

#!/usr/bin/env python3

import dns.message
import dns.query
import dns.resolver

import sys

resolver = None # Use the default resolver. Set to an IP address otherwise.

def parent(name):
    return dns.name.Name(name[1:])
    
def get_ns(name):
    message = dns.message.make_query(name, dns.rdatatype.NS, use_edns=True,
                                     want_dnssec=False)
    response = dns.query.udp(message, resolver)
    if response.rcode() == dns.rcode.NXDOMAIN:
        return "DOES NOT EXIST"
    elif response.rcode() != dns.rcode.NOERROR:
        return "SOMETHING WENT WRONG"
    if len(response.answer) > 0:
        result = ""
        for rrset in response.answer:
            for record in rrset:
                if record.rdtype == dns.rdatatype.NS:
                    result += "%s " % record.target
        return result
    else:
        return get_ns(parent(name))

if resolver is None:
    resolver = dns.resolver.Resolver().nameservers[0]
print("Using the resolver %s" % resolver)
print()
for arg in sys.argv[1:]:
    name = dns.name.from_text(arg)
    print("%s: " % name, end="")
    print(get_ns(name))
    print()
_______________________________________________
Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe 
from this list

ISC funds the development of this software with paid support subscriptions. 
Contact us at https://www.isc.org/contact/ for more information.


bind-users mailing list
bind-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/bind-users

Reply via email to