Created
August 22, 2015 14:21
-
-
Save Zenithar/83f34962ba3804d8b2f8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
# | |
# Convert the Yoyo.org anti-ad server listing | |
# into an unbound dns spoof redirection list. | |
# Modified by Y.Voinov (c) 2014 | |
# | |
# Note: Wget required! | |
# | |
# Source : https://github.com/jedisct1/unbound/blob/master/contrib/create_unbound_ad_servers.sh | |
# | |
# Variables | |
dst_dir="/etc/unbound" | |
work_dir="/tmp" | |
list_addr="http://pgl.yoyo.org/adservers/serverlist.php?hostformat=nohtml&showintro=1&startdate%5Bday%5D=&startdate%5Bmonth%5D=&startdate%5Byear%5D=" | |
# OS commands | |
CAT=`which cat` | |
ECHO=`which echo` | |
WGET=`which wget` | |
# Check Wget installed | |
if [ ! -f $WGET ]; then | |
echo "Wget not found. Exiting..." | |
exit 1 | |
fi | |
$WGET -O $work_dir/yoyo_ad_servers "$list_addr" && \ | |
$CAT $work_dir/yoyo_ad_servers | \ | |
while read line ; \ | |
do \ | |
$ECHO "local-zone: \"$line\" redirect" ;\ | |
$ECHO "local-data: \"$line A 127.0.0.1\"" ;\ | |
done > \ | |
$dst_dir/unbound_ad_servers | |
echo "Done." | |
# then add an include line to your unbound.conf pointing to the full path of | |
# the unbound_ad_servers file: | |
# | |
# include: $dst_dir/unbound_ad_servers | |
# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment