print(user) print('\n') os.system("php getPwd.php -p" + idServer + " > pwd.json") fp = open("pwd.json", "r") array = json.load(fp) fp.close() password = (array['result']['pass']) #Conexão SSH ssh = chilkat.CkSsh() success = ssh.UnlockComponent("Anything for 30-day trial") port = 22 intVal = ssh.get_ConnectTimeoutMs() ssh.put_ConnectTimeoutMs(2000) success = ssh.Connect(hostname, port) if (success == True): print("Connected") #Autenticar usuário e senha succs = ssh.AuthenticatePw(user, password)
import sys import chilkat # Important: It is helpful to send the contents of the # ssh.LastErrorText property when requesting support. ssh1 = chilkat.CkSsh() # Any string automatically begins a fully-functional 30-day trial. success = ssh1.UnlockComponent("Anything for 30-day trial") if (success != True): print(ssh1.lastErrorText()) sys.exit() # Hostname may be an IP address or domain name: hostname = "192.168.1.108" port = 22 # Connect directly to the 1st SSH server: success = ssh1.Connect(hostname,port) if (success != True): print(ssh1.lastErrorText()) sys.exit() # Wait a max of 15 seconds when reading responses.. ssh1.put_IdleTimeoutMs(15000) # Authenticate using login/password: success = ssh1.AuthenticatePw("myLogin","myPassword") if (success != True):