Skip to content

Instantly share code, notes, and snippets.

@jamiehoward
Last active August 16, 2017 19:28
Show Gist options
  • Save jamiehoward/458c3445fab8873439f27645b9dfb414 to your computer and use it in GitHub Desktop.
Save jamiehoward/458c3445fab8873439f27645b9dfb414 to your computer and use it in GitHub Desktop.
Search a file or directory for known Tor exit node IP addresses
#!/bin/sh
cp tor-search.sh /usr/local/bin/tor-search
chmod +x /usr/local/bin/tor-search
#!/bin/sh
echo "--- Downloading latest list of Tor exit nodes...\r\n"
wget "https://check.torproject.org/cgi-bin/TorBulkExitList.py?ip=1.1.2.1" -O tor.txt
echo "--- Cleaning up the acquired list..."
sed -i '' '/\#/d' ./tor.txt
echo "--- Searching file for IP addresses of known Tor exit nodes..."
timestamp=$(date +%s)
grep -r --file tor.txt $@ > tor-search-$timestamp.txt
echo "--- Removing tor list..."
rm tor.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment