Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- !/bin/bash
- # This script downloads bluetack blocklists, then merges them.
- #
- # For descriptions of each list, see
- # http://www.bluetack.co.uk/forums/index.php?autocom=faq&CODE=02&qid=17
- #
- # If using rtorrent with ipfilter enhancement patch from trac located at
- # http://libtorrent.rakshasa.no/ticket/239 ,
- # then remember to add the following 2 lines to your .rtorrent.rc:
- # ip_filter=path/to/ipfilter/blocklist
- # schedule = filter,18:30:00,24:00:00,reload_ip_filter=
- # Remember to change "path/to/ipfilter" above to the same path as below,
- # and then set cron to run this script daily.
- # Edit the following to the desired parent folder for the blocklist.
- # This folder should only be used for this script.
- # Choose either a writable nonexistant path, or an empty existing path.
- dir=/path/to/ipfilter
- # This sets the name of the blocklist to "blocklist".
- # Change this if you need it to match your ip_filter= setting.
- bl=$dir/blocklist
- # Directory and blocklist check
- if [ -d $dir ]; then
- if [ -f $bl ]; then
- echo Blocklist exists.
- else
- touch $bl
- if [ $? = 0 ]; then
- echo Empty blocklist created.
- else
- echo -e "Error creating file.\nPlease repair permissions in $dir.\nExiting."
- exit 0
- fi
- fi
- else
- mkdir $dir
- touch $bl
- if [ $? = 0 ]; then
- echo Directory and empty blocklist created.
- else
- echo -e "Error writing to directory.\nPlease repair permissions in parent directory.\nExiting."
- exit 0
- fi
- fi
- cd $dir
- # Backup current blocklist
- mv -f blocklist blocklist.backup
- if [ $? = 0 ]
- then
- echo Downloading blocklists...
- else
- echo -e "Error backing up current blocklist.\nPlease repair permissions in $dir.\nExiting."
- exit 0
- fi
- # Uncomment each file you want included in the final blocklist
- #
- #wget -q -t 3 http://www.bluetack.co.uk/config/ads-trackers-and-bad-pr0n.gz
- #wget -q -t 3 http://www.bluetack.co.uk/config/badpeers.gz
- wget -q -t 3 http://www.bluetack.co.uk/config/bogon.gz
- wget -q -t 3 http://www.bluetack.co.uk/config/dshield.gz
- #wget -q -t 3 http://www.bluetack.co.uk/config/edu.gz
- #wget -q -t 3 http://www.bluetack.co.uk/config/exclusions.gz
- #wget -q -t 3 http://www.bluetack.co.uk/config/fornonlancomputers.gz
- #wget -q -t 3 http://www.bluetack.co.uk/config/gnutella.gz
- #wget -q -t 3 http://www.bluetack.co.uk/config/hijacked.gz
- #wget -q -t 3 http://www.bluetack.co.uk/config/HOSTS.gz
- #wget -q -t 3 http://www.bluetack.co.uk/config/iana-multicast.gz
- #wget -q -t 3 http://www.bluetack.co.uk/config/iana-private.gz
- #wget -q -t 3 http://www.bluetack.co.uk/config/iana-reserved.gz
- wget -q -t 3 http://www.bluetack.co.uk/config/level1.gz
- wget -q -t 3 http://www.bluetack.co.uk/config/level2.gz
- #wget -q -t 3 http://www.bluetack.co.uk/config/level3.gz
- wget -q -t 3 http://www.bluetack.co.uk/config/Microsoft.gz
- #wget -q -t 3 http://www.bluetack.co.uk/config/proxy.gz
- #wget -q -t 3 http://www.bluetack.co.uk/config/rangetest.gz
- #wget -q -t 3 http://www.bluetack.co.uk/config/spider.gz
- #wget -q -t 3 http://www.bluetack.co.uk/config/spyware.gz
- #wget -q -t 3 http://www.bluetack.co.uk/config/webexploit-forumspam.gz
- # Extract blocklists (blocklist.backup is ignored)
- gunzip -r $dir
- # Combine blocklists into one file
- shopt -s extglob
- cat !(blocklist.backup) > blocklist
- # Cleanup individual blocklists
- rm !(bl*)
- echo Done.
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement