CLI over Sockets?

Thomas Wouters thomas at xs4all.net
Thu Apr 6 04:05:30 EDT 2000


On Thu, Apr 06, 2000 at 12:27:32AM -0400, Cliff Daniel wrote:

> Any such module exist that might help in implementing a
> CLI over sockets?  One such beast would preferrably operate in
> character mode and would would need to implement vt100  to provide
> the command line editing features (arrow keys, insert at cursor, etc).
> I'm know I'm asking for a lot but it's worth a shot in case someone
> has implemented this already.

I wrote a little thing like that once, to provide a front-end for our
Lucent (formerly Livingston) Portmasters. I needed a telnet that could log,
and log timestamps. (Portmasters have extraordinary debug information... all
the hexdumps of PPP packets and ISDN frames you want, but no timestamps.) I
shortly thought about adding command history & editing as well (which the
PMs lack too) but the tool had served my purpose and i haven't had use for
it since.

It's dead easy to write such a tool though: look at telnetlib for some good
examples. I ended up overriding the interact() method to add my logging, but
you still get all the protocol stuff for free. (telnet is more than just a
TCP socket, you see.) I'd guess that it isn't too much trouble to add
readline and your own completer function (if necessary, that last bit) but
i'm not sure if readline works properly with the select() method interact
uses... you might want to use mt_interact or something similar instead.

(Then again, i haven't looked at readline at all, partly because of it's
lack of documentation last time i looked, so it might be a lot harder than
that.)

I have my logging telnet somewhere on my laptop still, i could send it if
you want an example.

-- 
Thomas Wouters <thomas at xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!




More information about the Python-list mailing list