在 Google Colab 中连接 Tor

问题描述 投票:0回答:1

我尝试在我的colab中使用以下githttps://github.com/cubicbyte/reddit-account-generator),而我正在努力解决以下错误:

How many accounts do you want to make? 1 2024-05-09 16:31:17 INFO Checking if tor is running... 2024-05-09 16:31:20 INFO Tor is running. Connecting to Tor... Traceback (most recent call last):   File "/usr/local/lib/python3.10/dist-packages/stem/socket.py", line 535, in _make_socket     control_socket.connect((self.address, self.port)) ConnectionRefusedError: [Errno 111] Connection refused  During handling of the above exception, another exception occurred:  Traceback (most recent call last):   File "/content/reddit-account-generator/create_accounts.py", line 58, in <module>     proxy_manager = TorProxy(TOR_IP, TOR_PORT, TOR_PASSWORD, TOR_CONTROL_PORT, TOR_DELAY)   File "/content/reddit-account-generator/reddit_account_generator/proxies.py", line 58, in __init__     self.controller = Controller.from_port(port=self.control_port)   File "/usr/local/lib/python3.10/dist-packages/stem/control.py", line 1033, in from_port     control_port = stem.socket.ControlPort(address, port)   File "/usr/local/lib/python3.10/dist-packages/stem/socket.py", line 503, in __init__     self.connect()   File "/usr/local/lib/python3.10/dist-packages/stem/socket.py", line 172, in connect     self._socket = self._make_socket()   File "/usr/local/lib/python3.10/dist-packages/stem/socket.py", line 538, in _make_socket     raise stem.SocketError(exc) stem.SocketError: [Errno 111] Connection refused` 

我也尝试用以下方法处理它:

!sudo apt-get install tor
!sudo service tor start
!sudo service tor status 
* Starting tor daemon...
   ...done.
* tor is running

这也产生了 Errno111。

有什么建议吗?

我尝试将 colab 中的 jupyternotebook 连接到 Tor。

python google-colaboratory tor
1个回答
0
投票

错误消息stem.SocketError: [Errno 111] Connection Connectionrejected表示脚本无法与Tor控制端口建立连接。 确保 Tor 正在 Google Colab 机器上运行。您可以使用

!service tor status
检查其状态。如果它没有运行,请使用
!sudo service tor start
启动它。 仔细检查脚本中的
TOR_CONTROL_PORT
值。默认值可能是 9051,但请在您的 Tor 配置中验证它

© www.soinside.com 2019 - 2024. All rights reserved.