5

I have installed Tor to run as a service on my windows machine and I am trying to make requests in python through the Stem package. In my torrc file I have specified ControlPort as 9051 and set a HashedControlPassword. When I run netstat, I see that Tor is running on localhost:9050 but there is nothing listening to port 9051. As a result, when I try to connect to the ControlPort in python:

Controller.from_port(port=9051)

results in a

[Errno 10061] No connection could be made because the target machine actively refused it

I've tried restarting the service, I even reinstalled Tor Browser but nothing seems to make the ControlPort work.

4

2 回答 2

14

您遇到的问题是因为您将 tor 作为 Windows 服务运行。问题是当 Tor 作为服务安装时,无论出于何种原因,控制端口都未启用。要解决您的问题,请打开您的终端,导航到 tor 目录并输入以下命令:

tor --service remove
tor --service install -options ControlPort 9051

现在,tor 已作为服务安装,并且在端口 9051 上启用了 ControlPort。如果您键入“netstat -an”,您现在将看到端口 9051 已打开。

然后,您将能够使用 Stem 连接到 ControlPort。

我希望这有帮助。

和平。坐禅阿难。

于 2017-09-19T15:09:34.727 回答
2

对我有用的解决方案(windows 10),对Sat Cit Ananda的答案进行了一些调整:

[at your terminal]
cd ...\Tor Browser\Browser\TorBrowser\Tor
tor --service remove
tor --service install -options ControlPort 9151
netstat -an

Tor 服务在默认端口9150和 ControlPort 上运行9151。您应该能够看到本地地址127.0.0.1:9150127.0.0.1:9151运行时间netstat -an

于 2018-01-07T16:42:39.420 回答