袜子上的 Python ssh 客户端(代理) [英] Python ssh client over socks (proxy)

查看:76
本文介绍了袜子上的 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:

  1. 使用paramiko SSHClient
  2. 使用您自己的类扩展 SSHClient
  3. 重新实现 connect() 方法:我们没有使用标准的套接字对象,而是从 python 包 sockipy
  4. 传递给它一个固定的代理套接字
  1. Use paramiko SSHClient class
  2. Extend SSHClient with your own class
  3. Re-implement the connect() method: Instead of using a standard socket object we pass to it a fixed proxied socket from the python package sockipy

这篇关于袜子上的 Python ssh 客户端(代理)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆