Last active
September 8, 2015 11:35
-
-
Save anch0vy/cae2a3cb64d07bfee4b8 to your computer and use it in GitHub Desktop.
ssh test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import paramiko | |
import code | |
ssh = paramiko.SSHClient() | |
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) | |
ssh.connect('localhost', username='root', password='password', port = 22) | |
stdin, stdout, stderr = ssh.exec_command('ls -al') | |
print 'ls -al test 1' | |
print stdout.read() | |
ch = ssh.invoke_shell() | |
ch.send('ls -al\n') | |
print 'ls -al test 2' | |
print ch.recv(100000) | |
print 'arrow up test' | |
ch.send('\xE0\x50\xE0\xD0') #down arrow | |
#http://stackoverflow.com/questions/2876275/what-are-the-ascii-values-of-up-down-left-right | |
q = ch.recv(100000) | |
code.interact(local = locals()) | |
#print q -> ls -al\r\n |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment