]>
Commit | Line | Data |
---|---|---|
89c4ed63 A |
1 | #!/bin/sh |
2 | # | |
3 | # Convert the Yoyo.org anti-ad server listing | |
4 | # into an unbound dns spoof redirection list. | |
5 | # Modified by Y.Voinov (c) 2014 | |
6 | ||
7 | # Note: Wget required! | |
8 | ||
9 | # Variables | |
10 | dst_dir="/etc/opt/csw/unbound" | |
11 | work_dir="/tmp" | |
12 | list_addr="http://pgl.yoyo.org/adservers/serverlist.php?hostformat=nohtml&showintro=1&startdate%5Bday%5D=&startdate%5Bmonth%5D=&startdate%5Byear%5D=" | |
13 | ||
14 | # OS commands | |
15 | CAT=`which cat` | |
16 | ECHO=`which echo` | |
17 | WGET=`which wget` | |
18 | ||
19 | # Check Wget installed | |
20 | if [ ! -f $WGET ]; then | |
21 | echo "Wget not found. Exiting..." | |
22 | exit 1 | |
23 | fi | |
24 | ||
25 | $WGET -O $work_dir/yoyo_ad_servers "$list_addr" && \ | |
26 | $CAT $work_dir/yoyo_ad_servers | \ | |
27 | while read line ; \ | |
28 | do \ | |
29 | $ECHO "local-zone: \"$line\" redirect" ;\ | |
30 | $ECHO "local-data: \"$line A 127.0.0.1\"" ;\ | |
31 | done > \ | |
32 | $dst_dir/unbound_ad_servers | |
33 | ||
34 | echo "Done." | |
35 | # then add an include line to your unbound.conf pointing to the full path of | |
36 | # the unbound_ad_servers file: | |
37 | # | |
38 | # include: $dst_dir/unbound_ad_servers | |
39 | # |