Skip to content

Instantly share code, notes, and snippets.

@P3lUZa
Created April 20, 2015 16:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save P3lUZa/a8a4dfeb67745a3aa9fa to your computer and use it in GitHub Desktop.
Save P3lUZa/a8a4dfeb67745a3aa9fa to your computer and use it in GitHub Desktop.
Block BitTorrent Tor relay
echo This is to block known signatures of BitTorrent activity.
echo Written by\: Mr\-Protocol
sudo iptables -t raw -A OUTPUT -m string --algo bm --string "GET /announce?info_hash=" -j DROP
sudo iptables -t raw -A PREROUTING -m string --algo bm --string "GET /announce?info_hash=" -j DROP
echo Blocking\: \"GET \/announce?info_hash=\"
sleep 1
sudo iptables -t raw -A OUTPUT -m string --algo bm --string "GET /scrape?info_hash=" -j DROP
sudo iptables -t raw -A PREROUTING -m string --algo bm --string "GET /scrape?info_hash=" -j DROP
echo Blocking\: \"GET \/scrape?info_hash=\"
sleep 1
sudo iptables -t raw -A OUTPUT -m string --algo bm --string "GET /announce.php?info_hash=" -j DROP
sudo iptables -t raw -A PREROUTING -m string --algo bm --string "GET /announce.php?info_hash=" -j DROP
echo Blocking\: \"GET \/announce.php?info_hash=\"
sleep 1
sudo iptables -t raw -A OUTPUT -m string --algo bm --string "GET /scrape.php?info_hash=" -j DROP
sudo iptables -t raw -A PREROUTING -m string --algo bm --string "GET /scrape.php?info_hash=" -j DROP
echo Blocking\: \"GET \/scrape.php?info_hash=\"
sleep 1
sudo iptables -t raw -A OUTPUT -m string --algo bm --string "GET /announce.php?passkey=" -j DROP
sudo iptables -t raw -A PREROUTING -m string --algo bm --string "GET /announce.php?passkey=" -j DROP
echo Blocking\: \"GET \/announce.php?passkey=\"
sleep 1
sudo iptables -t raw -A OUTPUT -m string --algo bm --string "GET /scrape.php?passkey=" -j DROP
sudo iptables -t raw -A PREROUTING -m string --algo bm --string "GET /scrape.php?passkey=" -j DROP
echo Blocking\: \"GET \/scrape.php?passkey=\"
sleep 1
sudo iptables -t raw -A OUTPUT -m string --algo bm --hex-string "|13426974546f7272656e742070726f746f636f6c|" -j DROP
sudo iptables -t raw -A PREROUTING -m string --algo bm --hex-string "|13426974546f7272656e742070726f746f636f6c|" -j DROP
echo Blocking\: \"\(0x13\) \+ \"BitTorrent protocol\"
sleep 1
echo Running Tor with config \file\: \/home\/protocol\/torrc
sleep 3
sudo tor -f /home/protocol/torrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment