Advertisement
Guest User

Untitled

a guest
May 17th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.59 KB | None | 0 0
  1. import paramiko
  2.  
  3.  
  4. class stuff():
  5.     def __init__(self):
  6.         print("nothing")
  7.  
  8.     def real_init(self, ip, usr, mdp):
  9.         self.ssh = paramiko.SSHClient()
  10.         self.ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  11.         self.ssh.connect(ip,username = usr, password = mdp)
  12.  
  13. s = stuff()
  14. # Executing command
  15. try:
  16.     s.real_init('10.0.0.5','root','root')
  17. except Exception as e:
  18.     print('error', e)
  19.     print('\nProblem while connecting')
  20.  
  21. try:
  22.     stdin, stdout, stderr = s.ssh.exec_command('echo "haha" > haha.txt')
  23. except Exception as e:
  24.     print('error',e)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement