Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > telnet session

Reply
Thread Tools

telnet session

 
 
eight02645999@yahoo.com
Guest
Posts: n/a
 
      03-29-2006
hi
i am using a telnet session to simulate an authentication mechanism
USER = "user"
PASSWORD = "password"
try:
telnet = telnetlib.Telnet(HOST)
telnet.set_debuglevel(5)
telnet.read_until("login: ")
telnet.write(USER + "\n")
telnet.read_until("Password: ")
telnet.write(PASSWORD + "\n")
except:
print "failed to telnet"
else:
try:
telnet.write("ls\n")
except:
print "cannot ls"
else:
telnet.write("exit\n")
print telnet.read_all()


When i purposely input a wrong password, it "hangs" at the login prompt
waiting for
login and Password. The host i am telnetting to is a unix server.
How can i "exit" this login prompt if the user keys in wrong password
in my script?

thanks

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Telnet - attempting to initiate a telnet session within an established telnet session Carcarius Ruby 0 12-06-2007 03:26 AM
Help about router's Telnet session BB Cisco 1 01-04-2005 05:39 AM
Need to talk to a telnet server and send a telnet break Jim Isaacson C Programming 5 11-05-2004 09:17 PM
Unable to type in AS5300 telnet session Matt Cisco 3 06-15-2004 04:27 PM
How can I telnet when I dont have specific access to a telnet client Jack B. Pollack Computer Support 4 07-24-2003 08:58 PM



Advertisments