Skip to content

Instantly share code, notes, and snippets.

@binkybear
Created January 31, 2016 19:43
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save binkybear/b1d8fec196b60f7bd177 to your computer and use it in GitHub Desktop.
Save binkybear/b1d8fec196b60f7bd177 to your computer and use it in GitHub Desktop.
Quick bash script for TOR/privoxy set up
#!/bin/bash
#
# Quickly get TOR/privoxy running with python modifiable python script to change IP every 10 seconds
# See https://github.com/FrackingAnalysis/PyTorStemPrivoxy for more details
#
echo "Downloading prerequisites"
apt-get install -y tor privoxy python-stem wget
echo "Setting up privoxy"
# Setup privoxy to listen on 127.0.0.1 instead of localhost (can lead to ipv6 errors)
# Also forward to torrc
echo "forward-socks5 / 127.0.0.1:9050 ." >> /etc/privoxy/config
sed -i 's/listen-address localhost:8118/listen-address 127.0.0.1:8118/g' /etc/privoxy/config
# Generate password
read -p "Enter your super secret password: " PASSWORD
# Enable TORRC to listen on 9051 with your hashed password
HASHED_PASS=$(tor --hash-password PASSWORD | grep 16)
sed -i 's/#ControlPort 9051/ControlPort 9051/g' /etc/tor/torrc
sed -i 's/#HashedControlPassword 16:872860B76453A77D60CA2BB8C1A7042072093276A3D701AD684053EC4C/HashedControlPassword $HASHED_PASS/g' /etc/tor/torrc
# Restart services
/etc/init.d/tor restart
/etc/init.d/privoxy restart
cd /opt
wget https://raw.githubusercontent.com/FrackingAnalysis/PyTorStemPrivoxy/master/PyTorStemPrivoxy.py
sed -i 's/'my_password'/'$PASSWORD'/g' PyTorStemPrivoxy.py
echo "Run: python PyTorStemPrivoxy.py"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment