Created
June 29, 2017 17:44
-
-
Save scottwallacesh/d1ce003259272b52282701562a1dafae to your computer and use it in GitHub Desktop.
Script for OpenWRT ad blocking
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
BLOCKADS=/etc/dnsmasq.d/blockads | |
CONF=/etc/dnsmasq.conf | |
cat - << EOF > ${CONF} | |
conf-dir=$(dirname ${BLOCKADS}) | |
EOF | |
# Create the directory | |
mkdir -p $(dirname ${BLOCKADS}) | |
# Fetch the List Of Evil™ | |
( | |
/usr/bin/wget -q -O - "http://pgl.yoyo.org/adservers/serverlist.php?hostformat=nohtml&showintro=0&mimetype=plaintext" | while read LINE; do | |
echo "address=/${LINE}/127.0.0.1" | |
done | |
) > ${BLOCKADS} | |
# Whitelist some domains | |
sed -i '/scorecardresearch.com/d' ${BLOCKADS} | |
# Bounce! | |
/etc/init.d/dnsmasq reload |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment