我正在尝试使用 python 脚本(pexpect)从 linux 远程登录 Windows pc。当我尝试连接此错误时弹出 操作成功完成...登录失败下面是我的 python 脚本。
import pexpect,time,sys
from ftplib import FTP
def tel(ipadrr,login,password):
try:
global telconn
telconn = pexpect.spawn(ipadrr)
telconn.logfile = open("/tmp/telnetlog", "a")
print "connected to telnet"
print
except:
print "telconnnet connection refused"
print
sys.exit()
try:
time.sleep(15)
#telconn.expect(": ")
print "username"
telconn.sendline(login + '\r')
telconn.expect(":")
print "password"
telconn.sendline(password + '\r')
#telconn.sendline("\r")
#time.sleep(30)
telconn.expect(">")
print "Authentication Sucesss"
print
except:
print "Authentication Failure"
print
sys.exit()