[ale] telnet test

Björn Gustafsson bg-ale at bjorng.net
Fri Apr 21 08:25:02 EDT 2006


Very nice!  Substitute `read' for `cat' and you truly only use bash to do
the test:

bjorn at linux1:~$ read < /dev/tcp/127.0.0.1/23
bash: connect: Connection refused
bash: /dev/tcp/127.0.0.1/21: Connection refused
bjorn at linux1:~$ echo $?
1
bjorn at linux1:~$ read < /dev/tcp/127.0.0.1/22
bjorn at linux1:~$ echo $?
0

On 4/21/06, James P. Kinney III <jkinney at localnetsolutions.com> wrote:
>
> That's pretty slick! It will leave an open connection if there is a
> listening process, though. Maybe a fork and a timer with a close/kill
> would work.
>
> On Thu, 2006-04-20 at 21:32 -0400, Christopher Fowler wrote:
> > Don't count me out yet :)
> >
> > [cfowler at shuttle ~]$ cat </dev/tcp/192.168.2.103/23
> > bash: connect: No route to host
> > bash: /dev/tcp/192.168.2.103/23: No route to host
> > [cfowler at shuttle ~]$
> >
> > http://www.tldp.org/LDP/abs/html/devref1.html
> >
> > All done avec bash!
>

--
Bj?rn Gustafsson     "GMail.com: Better living through wasted disk space."
-------------- next part --------------
An HTML attachment was scrubbed...




More information about the Ale mailing list