[BusyBox] Scriptable telnet?

Rob Landley rob at landley.net
Wed Jan 7 03:26:04 UTC 2004


On Tuesday 06 January 2004 05:50, Csaba Henk wrote:
> On Mon, 5 Jan 2004, Gyepi SAM wrote:
> > On Mon, Jan 05, 2004 at 05:34:02PM +0100, Csaba Henk wrote:
> > > --===============2109340540=
> > > Content-Type: TEXT/PLAIN; charset=US-ASCII
> > >
> > > Hi,
> > >
> > > I'd need a scriptable telnet client for busybox, ie. one such that you
> > > can send commands to, eg. via a fifo, like it's done in
> > >
> > > http://okmij.org/ftp/piped_agents.txt
> >
> > You can also use nc instead.
>
> The situation is that I want to script a telnet session. The best beast
> for communicating with a telnet server is a telnet client, ain't it? Using
> nc would mean writing a telnet client in shell... that's not what I want.

I don't think so.  What are you trying to do?

Nc is basically telnet without the terminal control features.  It doesn't do 
things like negotiate with the telnet server to propogate environment 
variables, and other such complexity.  It just connects stdin an stdout to a 
remote socket through the network.  Exactly what you want for scripting 
purposes.

(Now some netcat implementations haven't handled EOF properly, so if you tried 
to do "cat 'GET /\n\n' | netcat www.cnn.com 80" it would would use "close" 
instead of "shutdown" on the socket when it hit the end of the input stream, 
and wind up hanging up immediately after sending the "GET" and not waiting 
for the OTHER end to stop sending data and close its connection.  I fixed 
that in my own personal netcat implementation, haven't looked at busybox's, 
but it's not brain surgery either way...)

> Ok, it's one thing that what I want (I know how to do that), and what's
> good for busybox. I just asked whether wouldn't it be a good idea to add a
> feature to an applet at the "price" of removing a few bytes of code.

The question is why is that chunk of code in there in the first place?  (Does 
it do something useful for interactive sessions, which is what telnet is 
for...?)

> Csaba

Rob




More information about the busybox mailing list