Paramiko can connect to ssh. You do not need the SOCKS library to connect to the ssh server. In addition, when you try, the remote server refuses to connect because you are not authenticating.
The correct way to do this is to link to paramiko sshClient :
import paramiko ssh = paramiko.SSHClient() ssh.connect('yourServer', username='you', password='yay!')
And then get the base transport :
trans = ssh.get_transport()
Finally, ask the ssh client to forward the tcp port with the open channel :
trans.open_channel("forwarded-tcpip", dest_addr=('serverIP',8000), src_addr=('localhost'),8000))
This will cause any connections on port 8000 to be redirected locally to port 8000 remotely through this ssh session.
source share