problems with telnetlib

Andre van Straaten andre at UltraShell.Net
Fri Jul 28 05:28:29 EDT 2000


As no one has responded so far, my hint is to have a look for the
specification of the terminal you send to the server.

The following three lines are a simple script which sets up as default a
very dumb terminal which cannot even filename completion, but you insert
characters (after naturally having logged in).

import telnetlib
se = telnetlib.Telnet("209.150.158.130")
se.interact()

Try this to exclude other sources of errors, and then search for terminal
set up (and maybe the prompt, too).

-- avs

jtoy <jtoy at tcgfinancial.com> wrote:
> 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



-- 

Andre van Straaten
http://www.vanstraatensoft.com
______________________________________________
flames please to /dev/null at vanstraatensoft.com




More information about the Python-list mailing list