袜子上的 Python ssh 客户端(代理) [英] Python ssh client over socks (proxy)
本文介绍了袜子上的 Python ssh 客户端(代理)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
所以,我需要通过代理袜子连接到 SSH 服务器.我阅读了 paramiko 和twisted.conch 文档,但没有在那里找到代理袜子支持.
So, I need to connect to SSH server through proxy socks. I read paramiko and twisted.conch docs, but didn`t found proxy socks support there.
推荐答案
此套接字包装器允许您使用静态 ssh 隧道.我为我的问题找到了一个通用的解决方案:
This socket-wrapper allows you to use static ssh-tunnels. I found a common solution for my problem:
- 使用paramiko
SSHClient
类 - 使用您自己的类扩展
SSHClient
- 重新实现
connect()
方法:我们没有使用标准的套接字对象,而是从 python 包sockipy
传递给它一个固定的代理套接字
- Use paramiko
SSHClient
class - Extend
SSHClient
with your own class - Re-implement the
connect()
method: Instead of using a standard socket object we pass to it a fixed proxied socket from the python packagesockipy
这篇关于袜子上的 Python ssh 客户端(代理)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文