Created
June 29, 2017 08:29
-
-
Save scottwallacesh/b90efd82f214f9dd7a5d3e04ff71a92c to your computer and use it in GitHub Desktop.
Block ads using dnsmasq
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/bash | |
BLOCKADS=/etc/dnsmasq.d/blockads | |
# Create the directory | |
mkdir -p $(dirname ${BLOCKADS}) | |
# Fetch the List Of Evil™ | |
/bin/curl -sq "http://pgl.yoyo.org/adservers/serverlist.php?hostformat=nohtml&showintro=0&mimetype=plaintext" | /bin/xargs -n1 -I@ echo "address=/@/127.0.0.1" > ${BLOCKADS} | |
# Whitelist some domains | |
sed -i '/scorecardresearch.com/d' ${BLOCKADS} | |
# Bounce! | |
systemctl restart dnsmasq |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment