Skip to content

Instantly share code, notes, and snippets.

@yekm
Created August 31, 2015 13:11
Show Gist options
  • 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="
https://adaway.org/hosts.txt
https://www.malwaredomainlist.com/hostslist/hosts.txt
https://www.mvps.org/winhelp2002/hosts.txt
https://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