work on tor blocking detection

This commit is contained in:
Kevin Froman 2020-08-11 23:49:26 -05:00
parent a24086da62
commit 2ddeab8788
3 changed files with 7674 additions and 1 deletions

22
scripts/block-tor.sh Executable file
View file

@ -0,0 +1,22 @@
#!/bin/bash
# Block Tor Exit nodes
# Adapted from: https://securityonline.info/block-tor-client-iptablesiptables-tor-transparent-proxy/
IPTABLES_TARGET="DROP"
IPTABLES_CHAINNAME="Tor"
if ! iptables -L Tor -n >/dev/null 2>&1 ; then
iptables -N Tor >/dev/null 2>&1
iptables -A OUTPUT -p tcp -j Tor 2>&1
fi
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd "$DIR/../"
iptables -F Tor
CMD=$(cat static-data/tor-node-list.dat | uniq | sort)
for IP in $CMD; do
if [[ $IP =~ .*:.* ]]
then
continue
fi
let COUNT=COUNT+1
iptables -A Tor -d "$IP" -j DROP
done
iptables -A Tor -j RETURN