Archive for the Python Category

#!/usr/bin/python import pexpect,sys,string,os,time,subprocess,getpass if len(sys.argv) !=2: print ("usage: backup [user@]hostname") else: input_data = sys.argv[1] data=input_data.split("@") switch_un = data[0] switch_ip = data[1] switch_pw1 = getpass.getpass("Enable Password:") switch_pw2 = getpass.getpass("Privilege Password:") basic_backup_directory = "/tmp/Network_Backups" print ("Please wait ...") try: try: child = pexpect.spawn('ssh %s@%s' % (switch_un, switch_ip)) child.timeout Read more [...]