I'm trying to do some port forwarding from a python app using paramiko. I can set up the SSH connection just fine, but I'm a bit stumped as to how to use paramiko.transport. I've already found this file, but I can't work out what's going on in it. From looking at the paramiko.Transport docs, it seems that a single line using the open_channel function, but I can't work out how to implement that. I'm trying to replicate a simple ssh -L 8000:localhost:8000.
Can anyone help me out?
Please find some code using
paramiko-1.7.7.1
,pycrypto-2.6
and the forward.py script from which I did remove code from the line 115 to the end (to avoid options parsing).I've tested it successfully from a Windows station, using a ssh server under Red Hat and pointing to a 3rd server. (I'm using
Python 2.7.2
)Hope it helps,
You can use https://github.com/pahaz/sshtunnel
Code example: