Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Automating a telnet session with an echo to stdout

5 views
Skip to first unread message

Samuel

unread,
Jun 2, 2007, 1:41:01 PM6/2/07
to
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

Samuel

unread,
Jun 4, 2007, 3:46:59 PM6/4/07
to
On Sat, 02 Jun 2007 17:41:01 +0000, Samuel wrote:

> 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.

For the records: Because I did not find any other solution, I modified
telnetlib to provide a callback that let's me see what is going on. The
patch is here:

http://sourceforge.net/tracker/index.php?func=detail&aid=1730959&group_id=5470&atid=305470

-Samuel

0 new messages