python - cant telnet from linux pc to windows pc "login Failed error" -
i'm trying telnet linux windows pc it's showing error "login failed".
here python script. using pexpect
module. tried telnetlib
same error:
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"
error :
connected 192.168.0.105. escape character '^]'. welcome microsoft telnet service login: user password: user@123 operation completed successfully. login failed
@vish can debug problem using wireshark according marcin.you try below mentioned code had same problem , got solution
import pexpect import time,sys telconn = pexpect.spawn('telnet 192.168.0.105') time.sleep(20) telconn.logfile = sys.stdout telconn.expect(":") time.sleep(20) telconn.send("user" + "\r") telconn.expect(":") telconn.send("user@123" + "\r") telconn.send("\r\n") time.sleep(20) telconn.expect(">")
i hope work.
Comments
Post a Comment