[colug-432] nc replacement in RHEL7?

Greg Sidelinger gate at ilive4code.net
Thu May 28 17:04:18 EDT 2015


Personally I like to use "echo > /dev/tcp/hostname/port".  I think
this is a feature of bash.

$ echo > /dev/tcp/127.0.0.1/80
$ echo $?
0
$ echo > /dev/tcp/127.0.0.1/90
-bash: connect: Connection refused
-bash: /dev/tcp/127.0.0.1/90: Connection refused
$ echo $?
1

On Thu, May 28, 2015 at 4:53 PM, Rob Funk <rfunk at funknet.net> wrote:
> Rick Hornsby wrote:
>> RHEL 7 changed a bunch of stuff.  One of the more annoying things is
>> what the nmap folks did to nc.
>
>> Other than rolling your own C app (which I did) and dropping it
>> somewhere, are there any easy/accessible replacements for nc -z?  By
>> easy, I mean not writing a mini perl script, and by accessible I mean
>> maybe something that's already part of or installable from the RHEL
>> repo.  Basically, I want the old nc (or some equivalent) back.
>
> Is downloading and compiling source code considered accessible enough?
>
> Wikipedia says there are lots of variations of netcat:
>   http://en.wikipedia.org/wiki/Netcat#Ports_and_reimplementations
> (FWIW, Ubuntu 14.04 has both netcat-openbsd and netcat-traditional.)
>
> I don't have a RHEL7-based system handy, but maybe it has "socat"?
> (CentOS 6.4 has socat, so maybe that was preserved in RHEL7 even if
> the old netcat wasn't.)
>
>   socat - TCP:127.0.0.1:80 < /dev/null && echo Connection succeeded 1>&2
>
> _______________________________________________
> colug-432 mailing list
> colug-432 at colug.net
> http://lists.colug.net/mailman/listinfo/colug-432


More information about the colug-432 mailing list