Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sshClient = paramiko.SSHClient()
- sshClient.connect('127.0.0.1', username='matt', password='password')
- channel = sshClient.get_transport().open_session()
- channel.get_pty()
- channel.invoke_shell()
- while True:
- command = raw_input('$ ')
- if command == 'exit':
- break
- channel.send(command + "n")
- while True:
- if channel.recv_ready():
- output = channel.recv(1024)
- print output
- else:
- time.sleep(0.5)
- if not(channel.recv_ready()):
- break
- sshClient.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement