I originally wrote dnsrezulf.py to prototype the Assembly + C code for the DNS resolver in Panah. That being said, I decided to package it separately as a Gist because I reckon it merits that. You may find a very simple, yet fast, DNS Resolver in C + Assembly, only for Linux, in the afore-linked repository.
Basically, this Python script is the Walter Blanco to dig's Walter White. If dig is partying at the club, dnsrezulf.py is sitting at hoome, popping ritty after ritty, and writing useless code whilst he runs out of money. If dig is Daniel J. Bernstein, dnsrezulf.py is Terry A. Davis. If dig is Linux, dnsrezulf.py is a magnetic tape which has to be manually handled to read the next punch card. Basically, you get the gist (pun intended).
That being said, dnsrezulf.py contains implementation of the DNS protocol from scratch, based on RFC #1035. It is also commented to hell and back, and reading the entire script from top to bottom, bot