Python ssh client on top of socks (proxy)

So, I need to connect to the SSH server through proxy socks. I read paramiko and twisted.conch docs but did not find proxy support there.

+3
source share
2 answers

This socket shell allows the use of static ssh tunnels. I found a general solution for my problem:

  • Use paramiko SSHClient class
  • Extend SSHClient with your own class
  • Reimplement the connect() method: Instead of using a standard socket object, we pass it a fixed proxy socket from the python sockipy
+4
source

Paraproxy (adding Paramiko for SSH2 ProxyCommands) looks like it can do it. There is no documentation online, but when downloading the source and checking the README I found this:

Paraproxy is an addition to the great "paramiko" SSH2 module. Although paramiko has good support for SSH (2), it lacks the function of ProxyCommand.

Proxy commands can be used, for example. to connect to VPN tunnels, but they provide manny with other nice features.

Paraproxy, after import, will be in the SSHClient class provided by paramiko, which, in turn, supports SSH ProxyCommands.

There are no changes to the existing code. necessary.

Give it a shot!

+2
source

Source: https://habr.com/ru/post/1481962/


All Articles