通过python的ssh socks5客户端不起作用



我尝试通过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! 

现在,我对交互式蟒蛇3做了同样的尝试:

centos 8与Python 3.6.8

已安装模块:

蟒蛇3-pysocks.noarch

蟒蛇38-pysocks.noarch

我遵循了/usr/share/doc/python38 pysock/README.md说明文档。

python3
import socks
c = socks.socksocket() 
c.set_proxy(socks.SOCKS5, "localhost", 5545, username="user", password="pass")
c.connect(("server",443))

我在尝试连接上述配置时出现了2个错误:

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代理相关的东西。

在此处找到解决方案:https://pypi.org/project/pr0cks/

pr0CKS --proxy SOCKS5:127.0.1.1:5545

最新更新