Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import paramiko, socks
- # PySocks recommends using no arguments,
- # because it only supports the defaults anyway.
- sock = socks.socksocket()
- host, port = '127.0.0.1', 1234
- # Set up your proxy information for this socket
- sock.set_proxy(
- proxy_type=socks.SOCKS5,
- addr=host,
- port=port,
- username='spam',
- password='eggs',
- )
- # Connect the socket
- sock.connect((host, port))
- # Create your Paramiko Transport
- transport = paramiko.Transport(sock)
- transport.connect(
- username='rabbit',
- password='grenade',
- )
- client = paramiko.SFTPClient.from_transport(transport)
- # Do stuff
- # Clean up
- client.close()
- transport.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement