Last month I had to build a DNS resolver for a course that I’m taking.
I’ve uploaded the code for this to https://github.com/adarshdec23/DNS-Resolver.
A write up of what exactly has been done will follow. But for now there are reports and a README that contain information on how the two programs have to be run.
There are two similar programs that can be combined into one:
- mydig.py: A program similar to
dig. Provides a similar interface. It can be run by invoking:
python mydig.py <url> <record_type>
- q2.py: This is the more interesting of the two. This contains an implementation of DNSSEC as I have understood it. Writing it was quite a fascinating leaning experience.
Output and commands to run both of the programs can be found in the README.
Here’s a sample output from mydig:
python3 mydig.py wikipedia.org MX
wikipedia.org IN MX
wikipedia.org. 3600 IN MX 10 mx1001.wikimedia.org.
wikipedia.org. 3600 IN MX 50 mx2001.wikimedia.org.
mx1001.wikimedia.org. 3600 IN A 184.108.40.206
mx2001.wikimedia.org. 3600 IN A 220.127.116.11
MSG SIZE: 142
Time taken: 0.3288142681121826 s