我尝试通过python使用ssh socks5。
我首先手动测试我的ssh连接(我从一个免费的socks5提供商那里获得了这个帐户)
实际用户名=用户
真实服务器ip =服务器
ssh -vvv -ND 5545 -p 443 user@server
[...]
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
server@server s password:
<I enter my password here>
debug1: Entering interactive session.
debug1: pledge: network -> it works smoothly! 现在,我尝试用交互式python3做同样的事情:
带有Python 3.6.8的centos 8
已安装的模块:
python3-pysocks.noarch
python38-pysocks.noarch
我遵循了/usr/share/ doc /python38-pysocks/README.md说明文档。
python3
import socks
c = socks.socksocket()
c.set_proxy(socks.SOCKS5, "localhost", 5545, username="user", password="pass")
c.connect(("server",443))尝试连接上述配置时出现两个错误:
Traceback (most recent call last):
File "/usr/liConnectionRefusedError: [Errno 111]
Connection refusedb/python3.6/site-packages/socks.py", line 832, in connect
super(socksocket, self).connect(proxy_addr)
debuConnectionRefusedError: [Errno 111] Connection refusedg1: Entering interactive session.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.6/site-packages/socks.py", line 100, in wrapper
return function(*args, **kwargs)
File "/usr/lib/python3.6/site-packages/socks.py", line 844, in connect
raise ProxyConnectionError(msg, error)
socks.ProxyConnectionError: Error connecting to SOCKS5 proxy localhost:5545: [Errno 111] Connection refused我已经在网上找到了解决方案,但到目前为止,我只找到了与http代理相关的东西。
发布于 2021-05-31 23:11:18
在这里找到了解决方案:https://pypi.org/project/pr0cks/
pr0CKS --proxy SOCKS5:127.0.1.1:5545https://stackoverflow.com/questions/67719009
复制相似问题