Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
TOR ip renew script using pytorctl which is a python based module to interact with the Tor Controller.
from TorCtl import TorCtl
import urllib2
user_agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/2009021910 Firefox/3.0.7'
def request(url):
def _set_urlproxy():
proxy_support = urllib2.ProxyHandler({"http" : ""})
opener = urllib2.build_opener(proxy_support)
request=urllib2.Request(url, None, headers)
return urllib2.urlopen(request).read()
def renew_connection():
conn = TorCtl.connect(controlAddr="", controlPort=9051, passphrase="Password12")
for i in range(0, 10):
print request("")

This comment has been minimized.

Copy link
Owner Author

arulrajnet commented May 3, 2015

For TOR with Privoxy use the docker container


apt-get install git
apt-get install python-dev python-pip
wget --no-check-certificate
pip install pytorctl-master/

Then to run python

you can configure the TOR controller password in the above script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.