Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import paramiko
- class stuff():
- def __init__(self):
- print("nothing")
- def real_init(self, ip, usr, mdp):
- self.ssh = paramiko.SSHClient()
- self.ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- self.ssh.connect(ip,username = usr, password = mdp)
- s = stuff()
- # Executing command
- try:
- s.real_init('10.0.0.5','root','root')
- except Exception as e:
- print('error', e)
- print('\nProblem while connecting')
- try:
- stdin, stdout, stderr = s.ssh.exec_command('echo "haha" > haha.txt')
- except Exception as e:
- print('error',e)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement