Last active
October 5, 2015 15:10
-
-
Save morr/1df1deeb2023f3a17e5e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create a new set for individual IP addresses | |
#sudo su | |
#ipset -N tor iphash | |
# get a list of Tor exit nodes that can access $YOUR_IP, skip the comments and read line by line | |
#wget -q "https://check.torproject.org/cgi-bin/TorBulkExitList.py?ip=8.8.8.8" -O -|sed '/^#/d' |while read IP | |
#do | |
# add each IP address to the new set, silencing the warnings for IPs that have already been added | |
# ipset -q -A tor $IP | |
#done | |
# filter our new set in iptables | |
#sudo iptables -A INPUT -m set --match-set tor src -j DROP | |
sudo su | |
ipset -N tor2 iphash | |
wget -q "https://check.torproject.org/cgi-bin/TorBulkExitList.py?ip=8.8.8.8" -O -|sed '/^#/d' |while read IP | |
do | |
ipset -q -A tor2 $IP | |
done | |
# swap existing list to the new one | |
ipset swap tor tor2 | |
ipset destroy tor2 | |
sudo iptables -D INPUT -m set --match-set tor src -j DROP | |
sudo iptables -A INPUT -m set --match-set tor src -j DROP |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment