1@Echo off
2rem Convert the Yoyo.org anti-ad server listing
3rem into an unbound dns spoof redirection list.
4rem Written by Y.Voinov (c) 2014
5
6rem Note: Wget required!
7
8rem Variables
9set prefix="C:\Program Files (x86)"
10set dst_dir=%prefix%\Unbound
11set work_dir=%TEMP%
12set list_addr="http://pgl.yoyo.org/adservers/serverlist.php?hostformat=nohtml&showintro=1&startdate%5Bday%5D=&startdate%5Bmonth%5D=&startdate%5Byear%5D="
13
14rem Check Wget installed
15for /f "delims=" %%a in ('where wget') do @set wget=%%a
16if /I "%wget%"=="" echo Wget not found. If installed, add path to PATH environment variable. & exit 1
17echo Wget found: %wget%
18
19"%wget%" -O %work_dir%\yoyo_ad_servers %list_addr%
20
21del /Q /F /S %dst_dir%\unbound_ad_servers
22
23for /F "eol=; tokens=*" %%a in (%work_dir%\yoyo_ad_servers) do (
24echo local-zone: %%a redirect>>%dst_dir%\unbound_ad_servers
25echo local-data: "%%a A 127.0.0.1">>%dst_dir%\unbound_ad_servers
26)
27
28echo Done.
29rem  then add an include line to your unbound.conf pointing to the full path of
30rem  the unbound_ad_servers file:
31rem
32rem   include: $dst_dir/unbound_ad_servers
33rem
34