Advertisement
hellboy2k8

Untitled

Jun 28th, 2016
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.94 KB | None | 0 0
  1. class MyStr(str):                                                                
  2.     def read(self):                                                              
  3.         return self                                                              
  4.                                                                                  
  5.                                                                                  
  6. __builtin__.str = MyStr  
  7.  
  8.  
  9. @classmethod
  10. def _get_connection(cls, hostname):
  11.     client = paramiko.SSHClient()
  12.     client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  13.     if cls.options.ssh_key is None:
  14.         client.connect(hostname=hostname, username=cls.options.user,
  15.                        password=cls.options.password)
  16.     else:
  17.         k = paramiko.RSAKey.from_private_key_file(cls.options.ssh_key)
  18.         client.connect(hostname=hostname, username=cls.options.user,
  19.                        pkey=k)
  20.     return client
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement