开发者

Establish SSH Connection Between Two Isolated Machines Using a 3rd System

开发者 https://www.devze.com 2023-02-04 11:36 出处:网络
I\'d like to do the following with Python: Computer 1 starts SSH server (probably using twisted or paramiko)

I'd like to do the following with Python:

  1. Computer 1 starts SSH server (probably using twisted or paramiko)
  2. Computer 1 connects to Server 1 (idle connection)
  3. Computer 2 connects to Server 1
  4. Server 1 forwards Computer 2's connection to Computer 1 (connection no longer idle)
  5. Computer 1 forwards Server 1's connection to listening SSH port (on computer 1)

Res开发者_C百科ult being Computer 2 now has a SSH session with Computer 1, almost as if Computer 2 had started a normal SSH session (but with Server 1's IP instead of Computer 1's)

I need this because I can't port forward on Computer 1's network (the router doesn't support it).


I'd use ssh to create a remote tunnel (-R) from the server to the local system. If you're insistent on doing this with Python then there's the subprocess module.


I found out how to do it, using an example from twisted's (hard to find) example of conch @ http://twistedmatrix.com/trac/browser/trunk/twisted/conch/scripts/conch.py

I'll be able to extract what I need from that. Thanks!!!!

0

精彩评论

暂无评论...
验证码 换一张
取 消