#!/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! # Variables setglobal dst_dir = '"/etc/opt/csw/unbound'" setglobal work_dir = '"/tmp'" setglobal list_addr = '"http://pgl.yoyo.org/adservers/serverlist.php?hostformat=nohtml&showintro=1&startdate%5Bday%5D=&startdate%5Bmonth%5D=&startdate%5Byear%5D='" # OS commands setglobal CAT = $[which cat] setglobal ECHO = $[which echo] setglobal WGET = $[which wget] # Check Wget installed if test ! -f $WGET { echo "Wget not found. Exiting..." exit 1 } $WGET -O $work_dir/yoyo_ad_servers $list_addr && \ $CAT $work_dir/yoyo_ad_servers | \ while read line \ { \ $ECHO "local-zone: \"$line\" redirect" ;\ $ECHO "local-data: \"$line A 127.0.0.1\"" ;\ } > \ $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 #