Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import datetime, time
- from time import sleep
- from Tkinter import *
- import paramiko
- def backup():
- canvas = Canvas(page3, relief = FLAT, background = "#D2D2D2", width = 694, height = 120)
- canvas.pack()
- txtOutput = Text(canvas, wrap = NONE, height =14, width = 86, borderwidth=2)
- txtOutput.pack()
- def backup():
- try:
- ssh = paramiko.SSHClient()
- ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- ssh.connect("t0001cms01", port=22, username='cms', password='sl33py')
- transport = ssh.get_transport()
- session = transport.open_session()
- session.get_pty()
- except paramiko.AuthenticationException:
- print("Authentication failed, please verify your credentials: %s")
- except paramiko.SSHException as sshException:
- print("Unable to establish SSH connection: %s" % sshException)
- except paramiko.BadHostKeyException as badHostKeyException:
- print("Unable to verify server's host key: %s" % badHostKeyException)
- except Exception as e:
- print(e.args)
- stdin, stdout, stderr =session.exec_command("su")
- stdin.write("password" + 'n')
- stdin.flush()
- command1 = 'menu'
- command2= '5'
- command3='6'
- stdin, stdout, stderr =session.exec_command(command1)
- stdin, stdout, stderr =session.exec_command(command2)
- stdin, stdout, stderr =session.exec_command(command3)
Add Comment
Please, Sign In to add comment