1#!/bin/sh 2 3# void-zones-update.sh 4# void-zones-tools 5# 6# Shell Script for updating the void zones list by downloading from pre-defined hosts file providers 7# 8# Created by Dr. Rolf Jansen on 2016-11-16. 9# Copyright (c) 2016, projectworld.net. All rights reserved. 10# 11# Redistribution and use in source and binary forms, with or without modification, 12# are permitted provided that the following conditions are met: 13# 14# 1. Redistributions of source code must retain the above copyright notice, 15# this list of conditions and the following disclaimer. 16# 17# 2. Redistributions in binary form must reproduce the above copyright notice, 18# this list of conditions and the following disclaimer in the documentation 19# and/or other materials provided with the distribution. 20# 21# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS 22# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 23# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 24# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 27# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 28# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 30 31### verify the path to the fetch utility 32if [ -e "/usr/bin/fetch" ]; then 33 FETCH="/usr/bin/fetch" 34elif [ -e "/usr/local/bin/fetch" ]; then 35 FETCH="/usr/local/bin/fetch" 36elif [ -e "/opt/local/bin/fetch" ]; then 37 FETCH="/opt/local/bin/fetch" 38else 39 echo "No fetch utility can be found on the system -- Stopping." 40 echo "On Mac OS X, execute either 'sudo port install fetch' or install" 41 echo "fetch from source into '/usr/local/bin', and then try again." 42 exit 1 43fi 44 45 46### Storage location of the dowloaded void hosts lists 47ZONES_DIR="/usr/local/etc/void-zones" 48if [ ! -d "$ZONES_DIR" ]; then 49 mkdir -p "$ZONES_DIR" 50fi 51if [ ! -f "$ZONES_DIR/my_void_hosts.txt" ]; then 52 echo "# white list" > "$ZONES_DIR/my_void_hosts.txt" 53 echo "1.1.1.1 my.white.dom" >> "$ZONES_DIR/my_void_hosts.txt" 54 echo "" >> "$ZONES_DIR/my_void_hosts.txt" 55 echo "# black list" >> "$ZONES_DIR/my_void_hosts.txt" 56 echo "0.0.0.0 my.black.dom" >> "$ZONES_DIR/my_void_hosts.txt" 57fi 58 59 60### Updating the void zones 61$FETCH -o "$ZONES_DIR/pgl_void_hosts.txt" "http://pgl.yoyo.org/as/serverlist.php?hostformat=hosts&showintro=0&useip=0.0.0.0&mimetype=plaintext" 62$FETCH -o "$ZONES_DIR/sowc_void_hosts.txt" "http://someonewhocares.org/hosts/zero/hosts" 63$FETCH -o "$ZONES_DIR/mvps_void_hosts.txt" "http://winhelp2002.mvps.org/hosts.txt" 64$FETCH -o "$ZONES_DIR/mdl_void_hosts.txt" "http://www.malwaredomainlist.com/hostslist/hosts.txt" 65$FETCH -o "$ZONES_DIR/away_void_hosts.txt" "https://adaway.org/hosts.txt" 66$FETCH -o "$ZONES_DIR/jdom_void_list.txt" "http://mirror1.malwaredomains.com/files/justdomains" 67$FETCH -o "$ZONES_DIR/ucky_void_host.txt" "https://raw.githubusercontent.com/FadeMind/hosts.extras/master/UncheckyAds/hosts" 68$FETCH -o "$ZONES_DIR/wintelm_void_hosts.txt" "https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/spy.txt" 69 70 71if [ ! -f "$ZONES_DIR/pgl_void_hosts.txt" ] ; then 72 echo "# No hosts from pgl." > "$ZONES_DIR/pgl_void_hosts.txt" 73fi 74 75if [ ! -f "$ZONES_DIR/sowc_void_hosts.txt" ] ; then 76 echo "# No hosts from sowc." > "$ZONES_DIR/sowc_void_hosts.txt" 77fi 78 79if [ ! -f "$ZONES_DIR/mvps_void_hosts.txt" ] ; then 80 echo "# No hosts from mvps." > "$ZONES_DIR/mvps_void_hosts.txt" 81fi 82 83if [ ! -f "$ZONES_DIR/mdl_void_hosts.txt" ] ; then 84 echo "# No hosts from mdl." > "$ZONES_DIR/mdl_void_hosts.txt" 85fi 86 87if [ ! -f "$ZONES_DIR/away_void_hosts.txt" ] ; then 88 echo "# No hosts from adaway." > "$ZONES_DIR/away_void_hosts.txt" 89fi 90 91if [ ! -f "$ZONES_DIR/jdom_void_list.txt" ] ; then 92 echo "# No domain list from DNS-BH – Malware Domain Blocklist." > "$ZONES_DIR/jdom_void_list.txt" 93fi 94 95if [ ! -f "$ZONES_DIR/ucky_void_host.txt" ] ; then 96 echo "# No hosts from FadeMind/unchecky." > "$ZONES_DIR/ucky_void_host.txt" 97fi 98 99if [ ! -f "$ZONES_DIR/wintelm_void_hosts.txt" ] ; then 100 echo "# No hosts from WindowsSpyBlocker/hosts/spy." > "$ZONES_DIR/wintelm_void_hosts.txt" 101fi 102 103 104/usr/local/bin/hosts2zones /tmp/local-void.zones \ 105 "$ZONES_DIR/my_void_hosts.txt" \ 106 "$ZONES_DIR/pgl_void_hosts.txt" \ 107 "$ZONES_DIR/sowc_void_hosts.txt" \ 108 "$ZONES_DIR/mvps_void_hosts.txt" \ 109 "$ZONES_DIR/mdl_void_hosts.txt" \ 110 "$ZONES_DIR/away_void_hosts.txt" \ 111 "$ZONES_DIR/jdom_void_list.txt" \ 112 "$ZONES_DIR/ucky_void_host.txt" \ 113 "$ZONES_DIR/wintelm_void_hosts.txt" \ 114 "$ZONES_DIR/x_void_list.txt" \ 115 "$ZONES_DIR/y_void_list.txt" \ 116 "$ZONES_DIR/z_void_list.txt" \ 117 && /bin/mv /tmp/local-void.zones /var/unbound/local-void.zones 118