From fe27d294b1ca5884586a8713c169780030d3b7bc Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 7 Jan 2020 18:07:34 +0100 Subject: [PATCH] Add script to detect DNS64 prefix --- detect-dns64-prefix.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 detect-dns64-prefix.py diff --git a/detect-dns64-prefix.py b/detect-dns64-prefix.py new file mode 100644 index 0000000..e5bd179 --- /dev/null +++ b/detect-dns64-prefix.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python3 +# Nico Schottelius, 2020-01-07 +# Detect the DNS64 prefix +# Based on https://tools.ietf.org/html/draft-ietf-behave-nat64-discovery-heuristic-05 + +import dns.resolver +import ipaddress + + +if __name__ == '__main__': + dns64_prefix = None + answers = dns.resolver.query('ipv4only.arpa', 'AAAA') + + for rdata in answers: + address = str(rdata) + network = ipaddress.IPv6Network("{}/96".format(address), + strict=False) + # print("{}: {}".format(rdata, network)) + print("{}".format(network))