Blocklist Downloader

A small script to help speed up regular updates for P2P block lists that you might be using for filtering for apps like routers, mail servers, or BitTorrent.

I’ve taken my block lists from iblocklist.com, but you can add your URLs to the list and have it download and concatenate as well. Some apps will need to be restarted to use the new filter list. Others might not.

TMPFILE=iblock.tmp
FINALFILE=iblock.p2p

if [ -f $TMPFILE ]; then
echo Removing temp file $TMPFILE
rm $TMPFILE
fi

for a in "http://list.iblocklist.com/?list=bt_level1&fileformat=p2p&archiveformat=gz" "http://list.iblocklist.com/?list=bt_level2&fileformat=p2p&archiveformat=gz" "http://list.iblocklist.com/?list=bt_level3&fileformat=p2p&archiveformat=gz" "http://list.iblocklist.com/?list=bt_rangetest&fileformat=p2p&archiveformat=gz" "http://list.iblocklist.com/?list=bt_bogon&fileformat=p2p&archiveformat=gz" "http://list.iblocklist.com/?list=bt_ads&fileformat=p2p&archiveformat=gz" "http://list.iblocklist.com/?list=bt_spyware&fileformat=p2p&archiveformat=gz" "http://list.iblocklist.com/?list=bt_templist&fileformat=p2p&archiveformat=gz" "http://list.iblocklist.com/?list=bt_microsoft&fileformat=p2p&archiveformat=gz" "http://list.iblocklist.com/?list=bt_hijacked&fileformat=p2p&archiveformat=gz" "http://list.iblocklist.com/?list=bt_dshield&fileformat=p2p&archiveformat=gz" "http://list.iblocklist.com/?list=ficutxiwawokxlcyoeye&fileformat=p2p&archiveformat=gz" "http://list.iblocklist.com/?list=ghlzqtqxnzctvvajwwag&fileformat=p2p&archiveformat=gz" "http://list.iblocklist.com/?list=bcoepfyewziejvcqyhqo&fileformat=p2p&archiveformat=gz" "http://list.iblocklist.com/?list=cslpybexmxyuacbyuvib&fileformat=p2p&archiveformat=gz" "http://list.iblocklist.com/?list=pwqnlynprfgtjbgqoizj&fileformat=p2p&archiveformat=gz" "http://list.iblocklist.com/?list=mtxmiireqmjzazcsoiem&fileformat=p2p&archiveformat=gz" "http://list.iblocklist.com/?list=sh_drop&fileformat=p2p&archiveformat=gz" "http://list.iblocklist.com/?list=ynkdjqsjyfmilsgbogqf&fileformat=p2p&archiveformat=gz" "http://list.iblocklist.com/?list=zvjxsfuvdhoxktpeiokq&fileformat=p2p&archiveformat=gz" "http://list.iblocklist.com/?list=erqajhwrxiuvjxqrrwfj&fileformat=p2p&archiveformat=gz" "http://list.iblocklist.com/?list=ewqglwibdgjttwttrinl&fileformat=p2p&archiveformat=gz" "http://list.iblocklist.com/?list=tbnuqfclfkemqivekikv&fileformat=p2p&archiveformat=gz" "http://list.iblocklist.com/?list=pfefqteoxlfzopecdtyw&fileformat=p2p&archiveformat=gz" "http://list.iblocklist.com/?list=jcjfaxgyyshvdbceroxf&fileformat=p2p&archiveformat=gz" "http://list.iblocklist.com/?list=ijfqtofzixtwayqovmxn&fileformat=p2p&archiveformat=gz" "http://list.iblocklist.com/?list=npkuuhuxcsllnhoamkvm&fileformat=p2p&archiveformat=gz" "http://list.iblocklist.com/?list=pbqcylkejciyhmwttify&fileformat=p2p&archiveformat=gz" "http://list.iblocklist.com/?list=zhogegszwduurnvsyhdf&fileformat=p2p&archiveformat=gz" "http://list.iblocklist.com/?list=zfucwtjkfwkalytktyiw&fileformat=p2p&archiveformat=gz" "http://list.iblocklist.com/?list=cr_bogon&fileformat=p2p&archiveformat=gz" "http://list.iblocklist.com/?list=dufcxgnbjsdwmwctgfuj&fileformat=p2p&archiveformat=gz" "http://list.iblocklist.com/?list=punkbuster&fileformat=p2p&archiveformat=gz" "http://list.iblocklist.com/?list=joost&fileformat=p2p&archiveformat=gz" "http://list.iblocklist.com/?list=aphcqvpxuqgrkgufjruj&fileformat=p2p&archiveformat=gz"
do
echo "Downloading from $a"
wget -O- -T 60 $a | gunzip -f >>$TMPFILE
done

if [ -f $FINALFILE ]; then
echo "Removing already existing $FINALFILE"
rm $FINALFILE
fi
echo Renaming temp file $TMPFILE to $FINALFILE
mv $TMPFILE $FINALFILE