简体   繁体   中英

How to configure a tor proxy on windows?

How do I configure a tor proxy on windows?

For example, I want to run the following python script through a tor proxy:

import requests

proxies = {
    'http':'socks5h://localhost:9050',
    'https':'socks5h:/localhost:9050'
}
url = 'someWebsite.onion'
res = requests.get(url, proxies=proxies)

On unix systems, you can simply run tor in terminal, but this doesn't seem to work on windows.

navigate to \\Tor Browser\\Browser\\TorBrowser\\Data\\Tor and edit torcc file

# ControlPort 9051
SocksPort 9051

Then restart tor.

Use tor proxy everywhere:

control panel -> network & internet -> internet options -> connection -> lan setting -> tick proxy server & goto advance & add:

proxy 127.0.0.1 port 9051

Use tor proxy in a browser like firefox:

options -> network setting -> tick Manual proxy configuration & add:

proxy 127.0.0.1 port 9051

Use with Python requests library:

import requests

proxies = {
    'http':'socks5://127.0.0.1:9051',
    'https':'socks5:/127.0.0.1:9051'
}
url = 'https://check.torproject.org/'
res = requests.get(url, proxies=proxies)

Note: You have to keep running tor browser for this

Txtorcon and Stem are libraries developed by the Tor Project for controlling Tor from Python. Stem doesn't have any external dependencies. However, txtorcon allows one to launch Tor from Python, rather than just connect to a running instance.

Both of these libraries require a Tor binary already installed though. It is possible to use the Tor included with the Tor Browser Bundle, connecting on port 9150 (with control port of 9151).

Better yet though, you can download the "Expert Bundle" to get the Tor binary without any browser. The download for it is not currently linked from their new website, but the latest version can still be pulled from https://dist.torproject.org/torbrowser/ . Navigate to a directory for either the alpha or stable version and search for "tor-win64-" (or "tor-win32-" if you need 32-bit).

he working good, but need start tor service in windows or made service tor auto start in windows when startup

all time tor service in this path after download tor browser

your_installation_path\\Tor Browser\\Browser\\TorBrowser\\Tor

the bin name is tor.exe you should add path in the windows PATH

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM