Hello,I have written this script to telnet from Ubuntu system to windows7 running system. This script goes fine upto login name, then it takes the password but it is not able to process the password. Although it looks as if the password has reached other side but in real it doesn't reach, as we can see it doesn't enter the 'C:>'prompt. Later I have given a command, even the command is not getting processed. Can anyone please tell me whats wrong with this script or why I am unable to get into winndows machine ???? Thanks !!!!!!!

import telnetlib
import sys
import time
import os


tn = telnetlib.Telnet('192.168.10.15')
#tn.interact()
tn.set_debuglevel(9)

tn.read_until('Service',15)

tn.read_until('\n\rlogin: ',5)
time.sleep(2)
tn.write('admin\n')
#tn.write('\n')


tn.read_until('password:',5)
time.sleep(2)
tn.write('password')
#tn.write('\n')

#time.sleep(5)
tn.read_until('>',15)

tn.write('help')
time.sleep(2)

str_All = tn.read_some()
print "666666666 "+str_All+" 66666666 \n"
str_All = tn.read_eager()
print "666666666 "+str_All+" 66666666 \n"
str_All = tn.read_some()
print "666666666 "+str_All+" 66666666 \n"
str_All = tn.read_some()
print "666666666 "+str_All+" 66666666 \n"

im confused from what you are trying to achieve is it that for instance your useing linux to access windows to run a process and for it to come up on linux if so you would have to write a program on windows to accept these types of commands.

I'm stuck with the same issue. I need to login to a remote Win7 machine to start a program and get stuck at the password prompt... please update the thread if you find a fix. Thanks.

ok.. found a solution... just use "\r" as a carriage return and the issue goes away. For some reason, Win7 doesn't like "\n". Hope this helps.

commented: thanks to let the rest of us know +13

Tnx syntron :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.