Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def handler(title, instructions, fields):
- if len(fields) > 1:
- raise sftp.SSHException("Expecting one field only.")
- return [password]
- def create_sftp_client():
- #from transport object
- sftp.util.log_to_file("paramiko", level="DEBUG")
- transport = sftp.Transport(('myhost', 2222), default_max_packet_size=10000,
- default_window_size=10000)
- transport.connect(username='myuser', password='mypassword')
- transport.auth_interactive(username, handler)
- channel = transport.open_channel("session")
- channel.invoke_shell()
- channel.send('ls\n')
- return channel
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement