Advertisement
Guest User

Untitled

a guest
Nov 20th, 2014
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.25 KB | None | 0 0
  1. #!/usr/bin/python
  2. import paramiko, os, logging
  3. paramiko.common.logging.basicConfig(level=paramiko.common.DEBUG)
  4. conn=paramiko.SSHClient()
  5. conn.load_system_host_keys()
  6. conn.load_host_keys(os.path.expanduser('~/.ssh/known_hosts'))
  7. conn.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  8. conn.connect('xxxxxxx', username='root', password='xxxxxxxx')
  9. stdin, stdout, stderr = conn.exec_command('uptime')
  10. print stdout.readlines()
  11.  
  12.  
  13.  
  14. DEBUG:paramiko.transport:starting thread (client mode): 0xbcfec190L
  15. INFO:paramiko.transport:Connected (version 1.99, client Cisco-1.25)
  16. 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
  17. DEBUG:paramiko.transport:Ciphers agreed: local=aes128-cbc, remote=aes128-cbc
  18. 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
  19. DEBUG:paramiko.transport:Switch to new keys ...
  20. DEBUG:paramiko.transport:Trying SSH agent key 118f881a61f1025ce083fdbb3f18e615
  21. DEBUG:paramiko.transport:userauth is OK
  22. DEBUG:paramiko.transport:Authentication type (publickey) not permitted.
  23. DEBUG:paramiko.transport:Allowed methods: ['keyboard-interactive', 'password']
  24. INFO:paramiko.transport:Disconnect (code 2): Protocol error: expected packet type 50, got 5
  25. Traceback (most recent call last):
  26. File "./test_sssh.py", line 11, in <module>
  27. conn.connect('xxxxxxxxxxx', username='root', password='xxxxxxxx')
  28. File "/usr/local/lib/python2.7/dist-packages/paramiko-1.11.0-py2.7.egg/paramiko/client.py", line 342, in connect
  29. self._auth(username, password, pkey, key_filenames, allow_agent, look_for_keys)
  30. File "/usr/local/lib/python2.7/dist-packages/paramiko-1.11.0-py2.7.egg/paramiko/client.py", line 533, in _auth
  31. raise saved_exception
  32. paramiko.AuthenticationException: Authentication failed.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement