Skip to content

Instantly share code, notes, and snippets.

@yekm
Created August 31, 2015 13:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yekm/9e66d7b977be898db5fb to your computer and use it in GitHub Desktop.
Save yekm/9e66d7b977be898db5fb to your computer and use it in GitHub Desktop.
hostname based adblock
# add addn-hosts=/tmp/adblocker_hostlist to dnsmasq config
HOST_LISTS="
http://adaway.org/hosts.txt
http://www.malwaredomainlist.com/hostslist/hosts.txt
http://www.mvps.org/winhelp2002/hosts.txt
http://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=0&startdate%5Bday%5D=&startdate%5Bmonth%5D=&star
"
wget -O- $HOST_LISTS | sed -rn 's/^(127.0.0.1|0.0.0.0)/0.0.0.0/p' | awk '{ print $1,$2 }' | sort -uk2 | sed -r 's/([^ ]+)$/\1\n:: \1/' >/tmp/adblocker_hostlist
killall -HUP dnsmasq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment