redlegoman / DNSMasqBlockIffyDomains

A bit of code for updating DNSMasq config file so it blocks iffy domains

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DNSMasqBlockIffyDomains

Python and Bash script combo.

Simple objective to downloading and parse domain lists from the following websites:

These lovely websites collate lists of dodgy malware, parasitic websites. This Python script will download and parse this information to produce a DnsMasq Address formatted file that directs all these domains to 127.0.0.1 (When a web browser receives 127.0.0.1 as the IP address to fetch content from, it's very quickly rejects the connection)

Also, you can manually specify TLDs and domains to block - add these to the blacklist constants file domainsBlacklist.conf Similarly you can whitelist domains in the file domainsWhitelist.conf

The Bash script takes this generated DnsMasq Address formatted file (dnsmasq.blockeddomains.conf) and places it in the standard /etc/dnsmasq.d folder to be picked up on service restart.

Installation

cd /usr/local/src/
sudo git clone https://github.com/AndersUk/DNSMasqBlockIffyDomains.git 

Usage

No need to run these scripts more than once a week as updates don't happen on a regular basis, plus we don't want to cause unnecessary costs to these great services

cd /usr/local/src/DNSMasqBlockIffyDomains
sudo ./updateDNSMasqConf.sh

CRON Task to run every Sunday at midnight:

sudo crontab -e

0 0 * * 0 cd /usr/local/src/DNSMasqBlockIffyDomains/; sudo updateDNSMasqConf.sh > /dev/null 2>&1

test

About

A bit of code for updating DNSMasq config file so it blocks iffy domains


Languages

Language:Python 69.9%Language:Shell 30.1%