Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- import paramiko, os, logging
- paramiko.common.logging.basicConfig(level=paramiko.common.DEBUG)
- conn=paramiko.SSHClient()
- conn.load_system_host_keys()
- conn.load_host_keys(os.path.expanduser('~/.ssh/known_hosts'))
- conn.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- conn.connect('xxxxxxx', username='root', password='xxxxxxxx')
- stdin, stdout, stderr = conn.exec_command('uptime')
- print stdout.readlines()
- DEBUG:paramiko.transport:starting thread (client mode): 0xbcfec190L
- INFO:paramiko.transport:Connected (version 1.99, client Cisco-1.25)
- DEBUG:paramiko.transport:kex algos:['diffie-hellman-group1-sha1'] server key:['ssh-rsa'] client encrypt:['aes128-cbc', '3des-cbc', 'aes192-cbc', 'aes256-cbc'] server encrypt:['aes128-cbc', '3des-cbc', 'aes192-cbc', 'aes256-cbc'] client mac:['hmac-sha1', 'hmac-sha1-96', 'hmac-md5', 'hmac-md5-96'] server mac:['hmac-sha1', 'hmac-sha1-96', 'hmac-md5', 'hmac-md5-96'] client compress:['none'] server compress:['none'] client lang:[''] server lang:[''] kex follows?False
- DEBUG:paramiko.transport:Ciphers agreed: local=aes128-cbc, remote=aes128-cbc
- DEBUG:paramiko.transport:using kex diffie-hellman-group1-sha1; server key type ssh-rsa; cipher: local aes128-cbc, remote aes128-cbc; mac: local hmac-sha1, remote hmac-sha1; compression: local none, remote none
- DEBUG:paramiko.transport:Switch to new keys ...
- DEBUG:paramiko.transport:Trying SSH agent key 118f881a61f1025ce083fdbb3f18e615
- DEBUG:paramiko.transport:userauth is OK
- DEBUG:paramiko.transport:Authentication type (publickey) not permitted.
- DEBUG:paramiko.transport:Allowed methods: ['keyboard-interactive', 'password']
- INFO:paramiko.transport:Disconnect (code 2): Protocol error: expected packet type 50, got 5
- Traceback (most recent call last):
- File "./test_sssh.py", line 11, in <module>
- conn.connect('xxxxxxxxxxx', username='root', password='xxxxxxxx')
- File "/usr/local/lib/python2.7/dist-packages/paramiko-1.11.0-py2.7.egg/paramiko/client.py", line 342, in connect
- self._auth(username, password, pkey, key_filenames, allow_agent, look_for_keys)
- File "/usr/local/lib/python2.7/dist-packages/paramiko-1.11.0-py2.7.egg/paramiko/client.py", line 533, in _auth
- raise saved_exception
- paramiko.AuthenticationException: Authentication failed.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement