Monthly Archives: July 2013

Configure Tor to use a node in a specific country

Create a configuration file, say “torrc”

(Default configuration file and a sample file location in Mac OS X Lion: /usr/local/etc/tor/)

Include the following lines in the configuration file:


ExitNodes {TR}
StrictExitNodes 1

Run Tor from the Terminal:


tor -f /Users/admin/Documents/Python/MyProject/torrc

To test it with Python:


from selenium import webdriver
import socket
profile=webdriver.FirefoxProfile()
profile.set_preference('network.proxy.type', 1)
profile.set_preference('network.proxy.socks', '127.0.0.1')
profile.set_preference('network.proxy.socks_port', 9050)
browser=webdriver.Firefox(profile)
browser.get("http://www.iplocation.net/")

Useful link for checking Tor status, Tor servers with country information, etc:

http://torstatus.blutmagie.de

See also: