Yesterday I posted about tweaking Deluge. In there I also talked about the block lists.Today I decided I would take the time to update the script that compiles all the blocklists to one file every weekend.
It now has: Level1-3, Microsoft, IANA filters, and the Bogon lists. Also, it now uses several for loops for better modularity of adding new lists.
Visit http://stephentanner.info/public-share/blocklist-updated/ to find all the files you need.
-
#!/bin/bash
-
##
-
##
-
-
##This bash will automatically download new
-
##Blocklists from bluetack.co.uk
-
-
#Distributed under the GPL
-
#Updated 2009.03.11
-
-
#Change Dir
-
cd ~/blocklists
-
-
#Download the block lists
-
#adding the -nv option to wget
-
# to make the output shorter
-
for list in level1 level2 level3 bogon Microsoft iana-multicast iana-private iana-reserved
-
do
-
wget -nv http://bluetack.co.uk/config/$list.zip
-
done
-
-
echo "——————————————"
-
echo
-
-
#Extract the text files
-
for list in `ls | grep .zip`
-
do
-
unzip $list
-
done
-
echo "——————————————"
-
echo
-
-
#Merge the files to one
-
touch blocklist
-
for list in `ls | grep .txt`
-
do
-
cat $list >> blocklist
-
done
-
echo "combined blocklist created"
-
echo
-
echo "——————————————"
-
echo
-
-
#Change extention on blocklist file
-
mv blocklist blocklist.txt
-
echo "blocklist.txt created"
-
echo
-
echo "——————————————"
-
echo
-
-
#Create Zip of new file
-
zip blocklist blocklist.txt
-
echo "——————————————"
-
echo
-
-
#Time Stamp The update
-
echo "This was last updated:" > CHANGELOG.txt
-
date >> CHANGELOG.txt
-
echo "change log created"
-
echo
-
echo "—————————————–"
-
echo
-
-
#Delete Old Files
-
rm ~/stephentanner.info/public-share/blocklist-old/*
-
-
#Move New files to Old Files
-
mv ~/stephentanner.info/public-share/blocklist-updated/* ~/stephentanner.info/public-share/blocklist-old/
-
-
#Copy New Files to New Files
-
cp ./* ~/stephentanner.info/public-share/blocklist-updated/
-
-
#Clean up New Files
-
rm ./*.txt
-
rm ./*.zip
-
echo "House keeping done"
-
echo
-
echo "—————————————-"
-
echo
-
-
#Yay
-
cat ~/stephentanner.info/public-share/blocklist-updated/CHANGELOG.txt
-
echo
-
echo "Seems like everything went well."
-
echo
-
echo "New File Sizes are:"
-
ls -lh ~/stephentanner.info/public-share/blocklist-updated/ | awk ‘{print $5,$8}’ | grep -v CH | grep -v down
-
echo
-
echo "Old File Sizes are:"
-
ls -lh ~/stephentanner.info/public-share/blocklist-old/ | awk ‘{print $5,$8}’ | grep -v CH | grep -v down
Share and enjoy!