[Tutor] Capturing and parsing over telnet

Stephen Nelson-Smith sanelson at gmail.com
Sun Nov 30 10:19:18 CET 2008


I want to write a program that connects to a TCP port using telnet,
and issues commands, parsing the output the command provides, and then
issuing another command.

This might look like this:

$ telnet water.fieldphone.net 7456
Welcome to water, enter your username
>_ sheep
Enter your password
>_ sheep123
>_ examine here
[some info to parse]
[.]
[.]
>_ some command based on parsing the previous screen
[more info to parse]
[.]
[.]

I am confident I can parse the info, if I can read it in.

I am not sure how to handle the telnet I/O

How should I proceed?

S.


More information about the Tutor mailing list