#!/bin/bash
# Filename: blocklists.sh
# Version: 170511
# Author: robz
# AFAIK "transmission" can only be configured to download a single blocklist
# automatically. That default, if set, being the level1 blocklist from
# http://update.transmissionbt.com/level1.gz. This script is to auto download
# the latest or extra P2P blocklists to suppliment or replace the default.
# All being well the script will download from the "$URLS" list and create a
# file which "transmisson-gtk" can parse, the old list will then be replaced
# ready for "transmission-gtk" to create a new binery file on startup.
# If this doesn't happen for some reason the existing will be left in place.
# Script can be used on it's own, or uncomment the last line and create a
# custom launcher for the Transmission bittorent client.
# Some reading http://torrentfreak.com/do-p2p-blocklists-keep-you-safe/
# Some suggested urls:
# http://list.iblocklist.com/?list=bt_level1 # General default list.
# http://list.iblocklist.com/?list=bt_level2 # Labs or researchers.
# http://list.iblocklist.com/?list=bt_level3 # The paranoids list.
# http://list.iblocklist.com/?list=bt_bogon # Unallocated addresses.
# http://list.iblocklist.com/?list=bt_templist # Suspected bad peers.
# http://list.iblocklist.com/?list=bt_spyware # Suspected spy/malware.
# Add urls to this $URLS list.
URLS="
http://list.iblocklist.com/?list=bt_level2
http://list.iblocklist.com/?list=bt_level3
http://list.iblocklist.com/?list=bt_bogon
"
TMP="/tmp/blocklists/" # Temporary workspace.
LISTS="$HOME/.config/transmission/blocklists" # Blocklists location.
rm -rf $TMP; mkdir $TMP; cd $TMP # Clear the way.
wget --retry-connrefused $URLS # Get lists.....persist.
if [ ! $? = 0 ]; then exit $?; fi
cat * > extras.gz # Concatenate the lists.
gunzip -c extras.gz > extras
if [ ! $? = 0 ]; then exit $?; fi
if [[ -s "extras" ]]; then
sort -u extras -o extras.txt # Sort unique to txt file.
else exit $?
fi
rm -f $LISTS/extras* # Purge old txt/bin files.
mv -f extras.txt $LISTS/"extras $(date +%d-%b-%R).txt"
#transmission-gtk & # Start bt client?
No comments:
Post a Comment