How to run multiple Tor processes at once with different exit IPs?

Create four torrc files, say /etc/tor/torrc.1 to .4. In each file, edit the lines: SocksPort 9050 ControlPort 9051 DataDirectory /var/lib/tor to use different resources for each torrc file, e.g. for for torrc.1: SocksPort 9060 ControlPort 9061 DataDirectory /var/lib/tor1 for torrc.2, SocksPort 9062 ControlPort 9063 DataDirectory /var/lib/tor2 and so on. A configuration file containing only the … Read more

Is it possible to block Tor users?

Tor is much easier to block than other open proxies since the list of exit IP addresses is known and published. Read the answer at https://www.torproject.org/docs/faq-abuse.html.en#Bans and if you still want to block users from accessing your site you could use https://www.torproject.org/projects/tordnsel.html.en or the Bulk Exit List exporting tool. If you use the Bulk Exit … Read more

How to make urllib2 requests through Tor in Python?

You are trying to connect to a SOCKS port – Tor rejects any non-SOCKS traffic. You can connect through a middleman – Privoxy – using Port 8118. Example: proxy_support = urllib2.ProxyHandler({“http” : “127.0.0.1:8118”}) opener = urllib2.build_opener(proxy_support) opener.addheaders = [(‘User-agent’, ‘Mozilla/5.0’)] print opener.open(‘http://www.google.com’).read() Also please note properties passed to ProxyHandler, no http prefixing the ip:port

Make requests using Python over Tor

There are 2 aspects to your question – Making requests using Tor Renewing the connection as per requirement (in your case, after every request) Part 1 The first one is easy to do with the latest (upwards of v2.10.0) requests library with an additional requirement of requests[socks] for using the socks proxy. Installation – pip … Read more

How can I block all traffic *except* Tor?

Easy enough with iptables. It can have rules which match specific users, and you should have already set up tor to run under its own user ID; deb and rpm packages provided by major Linux distributions and the Tor Project set up a user for Tor already. Complete sample, usable iptables and Tor configurations follow. … Read more