paramiko/paramiko — pull request #77 by acrish (2012-08-16 09:53:21+00:00)
Title: SSHClient may connect on an already opened socket

Hi,

SSHClient should be able to connect to a host through a lander when a direct connection to the host is not possible.

The steps I followed to connect through a lander are the following:
'''
ssh = paramiko.SSHClient()
ssh.connect(lander, username=myuser)
transport = ssh.get_transport()
channel = transport.open_channel('direct-tcpip', (host, SSH_PORT), ('127.0.0.1', 0))
ssh.connect(host, channel, username=myuser)
'''

So, SSHClient.connect may receive a stream (sock=None) and attach a SSH Transport either to a new socket or to the given stream.