say i have a list of IP addresses,what's the best way to identify if these servers are the authoritative name servers?i'm currently using python
Asked
Active
Viewed 341 times
-2
-
An authoritative Nameserver is a DNS Server that holds the actual DNS zone for a **particular domain**, so your question can't be answered (you need to provide the domain name) – Dusan Bajic May 10 '18 at 07:49
-
thank you.i think i have the answers i need – Elliot May 10 '18 at 09:03
1 Answers
0
Your question is unclear - I'm assuming you mean the authoritive NS for the PTR record (.in-addr.arpa.)?
using the dnspython module from http://www.dnspython.org/ and a tip on converting the IP address into the in-addr.arpa format
import dns.resolver
resolver = dns.resolver.Resolver()
for ipaddr in myIPAddrList:
req = '.'.join(reversed(ipaddr.split("."))) + ".in-addr.arpa"
ptr_rrs = resolver.query(req, "PTR")
for ptr_rr in ptr_rrs:
ns_rrs = resolver.query(ptr_rr, "NS")
for ns_rr in ns_rrs:
print "%s is an NS record for the PTR record %s for IP Address %s" % (ns_rr, ptr_rr, ipaddr)

Ben Sholdice
- 389
- 1
- 11