Created
April 20, 2022 10:40
-
-
Save KuJoe/b8d422ee4272b78ec68a3868e5e6fb9c to your computer and use it in GitHub Desktop.
Simple bash script to create a list of TOR exit node IPs and format to deny them in nginx
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
#!/bin/bash | |
/usr/bin/wget -q -O - "https://www.dan.me.uk/torlist/?exit" -U SXTorBlocker/1.0 > /tmp/temp_tor_list | |
/usr/bin/wget -q -O - "https://check.torproject.org/cgi-bin/TorBulkExitList.py?ip=$IP_ADDRESS&port=80" -U NoSuchBrowser/1.0 >> /tmp/temp_tor_list | |
/usr/bin/wget -q -O - "https://check.torproject.org/cgi-bin/TorBulkExitList.py?ip=$IP_ADDRESS&port=9998" -U NoSuchBrowser/1.0 >> /tmp/temp_tor_list | |
/usr/bin/cat /tmp/temp_tor_list | grep -v ":" | grep -v "#" > /tmp/torlist | |
/usr/bin/sort -u /tmp/torlist > /tmp/nginxtorlist | |
/usr/bin/sed "s/^/deny /g; s/$/;/g" /tmp/nginxtorlist > /etc/nginx/block-tor.txt | |
/usr/bin/systemctl reload nginx |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment