Automating a telnet session with an echo to stdout

Samuel newsgroups at debain.org
Sat Jun 2 13:41:01 EDT 2007


Hi,

I am trying to automate a telnet session (currently using Python's 
telnetlib) and would like to echo any response of the remote host to 
stdout, as soon as it arrives on telnetlib's open TCP socket.

Currently I print the return value of the read_some() method (or other 
read* methods) to the screen. However, that way of doing it means that 
the response gotten from the remote host is printed only periodically.

Can anyone point me to how to enable the immediate echo? I know that this 
is possible using interact(), but I do not want to hand the session over 
to the user, I just want him to see what's going on.

-Samuel



More information about the Python-list mailing list