A fully python 3 implementation of a DNS server
- At the moment the only records supported are IPV4 A records (however the main codebase is there to support others)
- TTL will be set to 0 as not to corrupt cache with bad records, in the future this can be changed
- Sometimes must run as root/admin to bind port 53 (any port < 1000)
- This "server" only supports UDP based DNS requests (ATM), and will not make actual DNS queries to retrieve actual results: the intention of this "server" is to send fake addresses back to clients that send requests to it based on the contents of the given
hosts.txt
file
You can setup hosts in a hosts.txt
file in the format
DOMAIN IP
Example
test.com 127.0.0.1
google.com 216.58.212.110
Must use python 3
python main.py
usage: main.py [-h] [-f HOSTS] [-a ADDRESS] [-p PORT] [-d]
A python DNS server
optional arguments:
-h, --help show this help message and exit
-f HOSTS, --hosts HOSTS
The file to load hosts from
-a ADDRESS, --address ADDRESS
Address to bind
-p PORT, --port PORT Port to bind
-d, --debug Print debug messages
- Open
nslookup
- Enter
SET debug
- Optional enter
SET TYPE=ALL
- Enter
server 127.0.0.1
or whatever IP you bound to (must be using port 53) - Query a domain name you have in your
hosts.txt
configuration
drill @127.0.0.1 domain
See the drill manpage for more info