I can't seem to figure out how to do this or if it is even doable, any help would be appreciated.
I have not tried much due to the lack of answers i can find on google.
I can't seem to figure out how to do this or if it is even doable, any help would be appreciated.
I have not tried much due to the lack of answers i can find on google.
If not doing a recursive query it means you already know which nameservers to contact, and over UDP or TCP.
dnspythonprovides thequerymodule to do exactly that, as explained in documentation at https://dnspython.readthedocs.io/en/stable/query.html#udpQuick POC:
Why 205.251.196.9? Because this is the IP address of
ns-1033.awsdns-01.org.which is one of the authoritative nameservers onstackoverflow.com.Note how the answer has the flag
AAwhich means authoritative.Another way, especially if you want to profit for all the internal retry logic, handling truncation, switching to TCP, etc. is using
dns.resolver.Resolverbut then forcibly setting itsnameserversattribute to the one and only nameserver you want to query, to bypass the usual default recursive use of this class (that will use by default the OS configured recursive nameservers).