J
Jinming Xu
Hello Everyone,
I am trying to write a python script to telnet to a server and then do
something there. As the first step, I practiced the python example in Lib
Reference 11.13.2. But I am finding the script stops after I supplied the
password. Does anyone know why?
Thanks in advance!
Jinming Xu
PS: Here is the script:
import getpass
import sys
import telnetlib
HOST = "localhost"
user = raw_input("Enter your remote account: ")
password = getpass.getpass()
tn = telnetlib.Telnet(HOST)
tn.read_until("login: ")
tn.write(user + "\n")
if password:
tn.read_until("Password: ")
tn.write(password + "\n")
tn.write("ls\n")
tn.write("exit\n")
print tn.read_all()
_________________________________________________________________
MSN Toolbar provides one-click access to Hotmail from any Web page – FREE
download! http://toolbar.msn.com/go/onm00200413ave/direct/01/
I am trying to write a python script to telnet to a server and then do
something there. As the first step, I practiced the python example in Lib
Reference 11.13.2. But I am finding the script stops after I supplied the
password. Does anyone know why?
Thanks in advance!
Jinming Xu
PS: Here is the script:
import getpass
import sys
import telnetlib
HOST = "localhost"
user = raw_input("Enter your remote account: ")
password = getpass.getpass()
tn = telnetlib.Telnet(HOST)
tn.read_until("login: ")
tn.write(user + "\n")
if password:
tn.read_until("Password: ")
tn.write(password + "\n")
tn.write("ls\n")
tn.write("exit\n")
print tn.read_all()
_________________________________________________________________
MSN Toolbar provides one-click access to Hotmail from any Web page – FREE
download! http://toolbar.msn.com/go/onm00200413ave/direct/01/