Advertisement
Guest User

Untitled

a guest
Dec 20th, 2016
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. import paramiko, socks
  2.  
  3. # PySocks recommends using no arguments,
  4. # because it only supports the defaults anyway.
  5. sock = socks.socksocket()
  6.  
  7. host, port = '127.0.0.1', 1234
  8.  
  9. # Set up your proxy information for this socket
  10. sock.set_proxy(
  11. proxy_type=socks.SOCKS5,
  12. addr=host,
  13. port=port,
  14. username='spam',
  15. password='eggs',
  16. )
  17.  
  18. # Connect the socket
  19. sock.connect((host, port))
  20.  
  21. # Create your Paramiko Transport
  22. transport = paramiko.Transport(sock)
  23. transport.connect(
  24. username='rabbit',
  25. password='grenade',
  26. )
  27. client = paramiko.SFTPClient.from_transport(transport)
  28.  
  29. # Do stuff
  30.  
  31. # Clean up
  32. client.close()
  33. transport.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement