[Tutor] Capturing and parsing over telnet

Stephen Nelson-Smith sanelson at gmail.com
Sun Nov 30 11:41:37 CET 2008


Hi,

> How about pexpect;
> http://www.noah.org/wiki/Pexpect

Ah yes - I've used that before to good effect.

ATM I'm playing with telnetlib.  Is there a way to read everything on
the screen, even if I don't know what it will be?

eg:
c = telnetlib.Telnet("test.lan")
c.read_until("name: ")
c.write("test\n")
c.read_until("word: ")
c.write("test\n")

And now I don't know what I will see - nor is there a prompt which
indicates that the output is complete.

I effectively want something like c.read_everything()

I tried c.read_all() but I don't get anything from that.

Suggestions?

S.


More information about the Tutor mailing list