pytinydns
pytinydns copied to clipboard
PYTinyDNS
PyTinyDNS:
Usage: pytinydns.py [OPTION]... -h, --help Print this message -c, --config=file Specify the config file to use -d, --default=ip Specify the default IP address to fall back on -l, --list=host_file Specify host file to use instead of redis -n, --noredis Specify not to use redis db. Default IP will be used -r, --resolve Specify to resolve non matches to actual IP
This is a tiny DNS server that resolves A records to IPs.
Sample Host File:
Comment
google.com.:127.0.0.1 yahoo.com.:192.168.1.1
Sample Config File: [PyTinyDNS] DefaultIP = 192.168.1.99 Use_Redis = yes Redis_Server = localhost
Resolve_Nonmatch will query your normal DNS for domains with no local match.
May cause delays in answering other requests. Default is no.
Resolve_Nonmatch = yes
Host_File = pytinydns.host
PyTinyDNS redis import tool will import the host file and save the keys and values into the redis db.
If you elect not to use redis, then you can either resolve every domain to the default IP or use a config file to supply A records.
The above host file will resolve google to 127.0.0.1 and yahoo.com to 192.168.1.1 respectively
Added redis_import.py:
Usage: redis_import.py import_file
Can be used to update live instance of the DNS server.
Borrowed DNSQuery class from http://code.activestate.com/recipes/491264-mini-fake-dns-server/