I'm trying to build fast script for parsing all DNS records for a single domain name. The 'ANY' command seems to do the trick, but I have strange problems with TTLs. When using ANY like this
domain = dns.name.from_text(domain)
nameserver = '127.0.0.1'
query = dns.message.make_query(domain, dns.rdatatype.ANY)
response = dns.query.udp(query, nameserver, timeout = 2)
print response
The returned data is what I need, but when the TTLs expire the script just don't return the expired records. The 'DIG domain ANY' command seems to have this problem too.
So my question is what is the fastest way to get all DNS records for a single domain?