Skip to content

Instantly share code, notes, and snippets.

@xxdesmus
Forked from sethkinast/gist:5914577
Created November 28, 2015 23:14
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 xxdesmus/72e9254963ebea33a0d2 to your computer and use it in GitHub Desktop.
Save xxdesmus/72e9254963ebea33a0d2 to your computer and use it in GitHub Desktop.
Tiny script to grab Tor exitnodes and ban them via CloudFlare's API
#!/bin/bash
SERVERS=(108.162.196.125 108.162.197.125)
for server in ${SERVERS[*]}
do
echo "Now processing $server"
wget --timeout=10 -t1 -O tor.txt https://check.torproject.org/cgi-bin/TorBulkExitList.py?ip=$server
for ip in `tail -n +4 tor.txt`
do
curl https://www.cloudflare.com/api_json.html \
-d 'a=ban' \
-d 'tkn=xxxxxx' \
-d 'email=xxx@xxx.com' \
-d "key=${ip}"
done
done
rm tor.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment