[BusyBox] Scriptable telnet?
Rob Landley
rob at landley.net
Wed Jan 7 03:39:26 UTC 2004
On Tuesday 06 January 2004 17:13, Csaba Henk wrote:
> On Tue, 6 Jan 2004, Wolfgang Denk wrote:
> > In message <Pine.GSO.4.56.0401061242460.13643 at hexagon.renyi.hu> you wrote:
> > > > > 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
> >
> > Use expect.
> >
> > > 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.
> >
> > Use expect.
>
> Hm, I think I will wait with applying your advice... until busybox will
> have an expect applet :)
What we really need is a sort of circular pipe construct. (Think netcat
shelling out to a script...) Then you just write a shell script instead of
an expect script. (Yeah, far more brittle, but doesn't require an AI engine
written in TCL, just a half-dozen lines of code... :)
Sort of like:
circle 'command 1' 'command 2'
Where the output of command 1 is piped into the input of command 2, and the
output of command 2 is piped back into the input of command 1.
Sort of a bit like "command 1 | command 2 > /dev/stdin", only not exactly...
:)
You might want a -v option too so you could see the data going back and forth
Shouldn't be too hard to write, actually. In fact a better syntax might be:
circle "command 1 | command 2 | command 3..." and just connect stdout from
that to stdin from that. Makes -v potentially a bit more complicated,
though... :)
> Why do you think that a system the telnet client of which is the one of
> busybox, is capable of storing and running expect?
I don't. But would the above be usable to you? We're talking maybe twenty
lines of code here. It _sounds_ like it's just a couple of calls to pipe(),
fdup2(), fork, and exec. (Haven't written it yet though, so dunno what's
really involved...)
> Csaba
Rob
More information about the busybox
mailing list