File: xfr.py

package info (click to toggle)
dnspython 2.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,556 kB
  • sloc: python: 37,194; sh: 7; makefile: 4
file content (16 lines) | stat: -rwxr-xr-x 452 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env python3

import dns.query
import dns.resolver
import dns.zone

# Note that running this doesn't currently work because
# dnspython.org's nameservers do not permit AXFR

soa_answer = dns.resolver.resolve("dnspython.org", "SOA")
master_answer = dns.resolver.resolve(soa_answer[0].mname, "A")

z = dns.zone.Zone("dnspython.org")
dns.query.inbound_xfr(master_answer[0].address, z)
for n in sorted(z.nodes.keys()):
    print(z[n].to_text(n))