【问题标题】:Python Tor sharing socket port with local networkPython Tor 与本地网络共享套接字端口
【发布时间】:2018-12-04 19:30:20
【问题描述】:

您好,我正在尝试弄清楚如何与网络中的另一台电脑共享我的 tor 连接。我使用专家包创建 Tor,torrc 文件看起来像这样。

# Where data will be stored?
DataDirectory C:\Users\someuser\Tor\TorData\data\10002

# Countdown time before exit
ShutdownWaitLength 5

# Where to write PID
PidFile C:\Users\someuser\Tor\TorData\data\10002\pid

# Communication ports
SocksPort xx.xxx.xxx.xx:10002
ControlPort xx.xxx.xxx.xx:10003

# Authentication of Tor
CookieAuthentication 1

# GeoIP file paths?
GeoIPFile C:\Users\someuser\Tor\Data\Tor\geoip
GeoIPv6File C:\Users\someuser\Tor\Data\Tor\geoip6

SocksListenAddress xx.xxx.xxx.xx
SocksPolicy accept xx.xxx.xxx.xx/24

所以现在我正尝试使用来自另一台电脑的相同 tor 连接。

import requests

ses = requests.session()
ses.proxies = {'http': '{0}{1}:{2}'.format('socks5://','xx.xxx.xxx.xx', 10002),
            'https': '{0}{1}:{2}'.format('socks5://','xx.xxx.xxx.xx', 10002)}

r = ses.get('some http webpage')
print r.content

我确实检查了防火墙设置是否正常。在阀杆上,我可以连接到控制端口。但不知道为什么 SockPort 没有通过。

无论interpeter的版本如何,我都会遇到的错误

  File "C:\Python27\lib\site-packages\requests\packages\urllib3\contrib\socks.py", line 73, in _new_conn
    conn = socks.create_connection(
AttributeError: 'module' object has no attribute 'create_connection'

任何想法我错过了什么?

【问题讨论】:

    标签: python tor


    【解决方案1】:

    我发现这毕竟是因为 python interperter 的差异。它必须在 python 3 中运行,它会像一个魅力一样工作。

    希望有人帮忙配置torrc。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-02-08
      • 1970-01-01
      • 2013-07-24
      • 2022-01-15
      • 1970-01-01
      • 2020-10-14
      • 2011-07-25
      • 2014-03-05
      相关资源
      最近更新 更多