Created
August 28, 2015 14:12
-
-
Save pedrompcaetano/7da33f75cf9f0fefeaea to your computer and use it in GitHub Desktop.
block hosts via dns
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
( | |
# Retrieves ad blacklist and adds them to unbound as NXDOMAIN | |
ftp -V -o - http://winhelp2002.mvps.org/hosts.txt | awk '!/^#/ {print $2}' |egrep -v '^$|localhost' | sort -u | sed -e 's/ | |
//g' | sed 's/^/local-zone: \"/' | sed 's/$/\" static/' | |
# Retrieves URLs from phishtank and adds them to unbound as NXDOMAIN | |
# It might be a good idea to get an API key at phishtank for the download | |
ftp -V -o - http://data.phishtank.com/data/online-valid.csv.gz | gzcat | awk -F ',' '{print $2}' | awk -F '/' '{print $3}' | sort -u | sed 's/^/local-zone: \"/' | sed 's/$/\" static/' | sed 's/local-zone: "" static//g' | |
) | tr '[A-Z]' '[a-z]' | sort -u > /var/unbound/etc/blacklist.conf | |
rcctl reload unbound |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment