我正在尝试从 Linux 远程登录到 Windows PC,但它显示错误“登录失败”。
这是我的 Python 脚本。我正在使用pexpect
模块。我也试过telnetlib
但同样的错误:
import os
import pexpect,time
telconn = pexpect.spawn('telnet 192.168.0.105')
telconn.logfile = open("/tmp/telnetlog", "a")
time.sleep(30)
print "connected"
telconn.expect(':')
telconn.sendline("user" + "\r")
#time.sleep(10)
print "connected user"
telconn.expect(':')
password = "user@123"
#print password
telconn.sendline(password + "\r")
time.sleep(60)
#print "connected password"
错误 :
Connected to 192.168.0.105.
Escape character is '^]'.
Welcome to Microsoft Telnet Service
login: user
password: user@123
The operation completed successfully.
Login Failed