[BusyBox] scriptable telnet

Rob Landley rob at landley.net
Fri Nov 19 03:45:38 UTC 2004


On Thursday 18 November 2004 12:10 pm, Paul Fox wrote:

> with some telnet programs you can do something like this:
>
>     (
>      sleep 2
>      echo username
>      sleep 2
>      echo somepassword
>      sleep 2
>      echo date
>      sleep 2
>     ) | telnet somehost > session.log
>
> there's no error checking, and no synchronization.  but for a
> quick and dirty solution it can be handy.
>
> this doesn't work in busybox because busybox telnet exits if stdion
> is not a terminal.  the following patch (only quickly tested)
> makes this work.
>
> paul

Busybox did have a netcat command last time I checked.  I didn't blanket 
replace it with mine because it has some strange so-security server mode mine 
doesn't.

Its netcat works just fine (and the whole point of netcat is to not insist on 
input/output involving a terminal), it just doesn't have the ability to close 
only one direction of the connection and leave the other open.  (I.E. "echo 
GET / | netcat www.cnn.com 80" won't do anything useful because as soon as 
EOF on input is reached, netcat exits without waiting for any data from the 
other end...)

So for what you're trying, test out the netcat built into busybox.  (Finite 
pauses aren't a good solution because the network can have unpredictable 
pauses of its own, but for the moment it's worth a shot...)

Rob



More information about the busybox mailing list