DNS Sinkhole Implementation in Python: A DNS sink server and JSON publisher that block specified domains and serve as a DNS sinkhole, redirecting queries to a local blacklist or Google DNS. Designed for testing and managing unwanted domain resolutions.
This project offers a DNS sink server and a JSON publisher to manage and block specified domains. It functions as a DNS sinkhole, redirecting queries to a local blacklist or Google DNS, providing a robust solution for testing and managing unwanted domain resolutions.
- DNS Sink Server: Processes DNS queries, redirecting specified domains to a sinkhole IP address.
- JSON Publisher: Serves domain blacklists in compressed JSON format via HTTP.
- Flexible Configuration: Easily modify the list of blocked domains and customize settings.
- Usage of Third-Party DNS: Can query external DNS servers (e.g., Google's 8.8.8.8) for unresolved domains.
- Python 3.x
- Required libraries:
dnspython
,colorama
,requests
- Prepare DNS Blacklist: Ensure
dns.blacklist
contains the list of blocked domains. - Install Required Libraries:
pip install dnspython colorama requests
- Generate Executables: Create standalone executables using
pyinstaller
(for Windows):pyinstaller --onefile dnssinker.py pyinstaller --onefile http-dns-publisher.py
- Start JSON Publisher: Serve the JSON data from the DNS blacklist:
python3 http-dns-publisher.py
- Start DNS Sink Server: Run the DNS sink server to process queries:
python3 dnssinker.py
- Perform DNS Queries: From a client machine, execute DNS queries:
dig @<ip-addr-sink-server> -p 59 <domain-name>
Feel free to contribute by opening issues or creating pull requests.
This project is licensed under the MIT License.