problems with telnetlib

jtoy jtoy at tcgfinancial.com
Wed Jul 26 14:14:17 EDT 2000


I have tried several sample scripts including the oses at python.org,
but I can't get any of the scripts to work properly.  I have Python
1.5.2 on Linux 2.2.15.  All I want to do is write a script that telnets
into a machine and executes '/etc/email'.  I can safely get up to the
password prompt with:

from telnetlib import Telnet
tn = Telnet('192.168.0.254')
tn.read_until('login: ')
tn.write('someuser\n')
tn.read_until('password: ')
tn.write('password\n')
tn.read_until('$ ')

then I get error in line 224 read_very_lazy and in 300 read_very_lazy
My exact login prompt after a normail telnetsession is:
[user at localnet user]$
So reading until '$' should be write.  Also, after I type
tn.read_until('password: '), thr python prompt freezes for 30 seconds
but continues normally after, why is this?



--
Jason Toy
toyboy at toy.eyep.net
jtoy at tcgfinancial.com
http://toy.eyep.net





More information about the Python-list mailing list