Live data from Hacker News

A Unix Utility You Should Know About: Netcat (2009)

catonmat.net

1–10 of 39 posts

Re: A Unix Utility You Should Know About: Netcat (2009)

#4
Netcat is indeed very versatile and useful but most of the time it's used improperly when used as a server (-l mode). Unless you're doing basic network diagnostics (ex: testing if firewall ports are open) you're better off using openssl (s_server mode) or more likely good ol' SSH port forwarding.

Re: A Unix Utility You Should Know About: Netcat (2009)

#5
You should also know about the so-called "netcat mode" in OpenSSH:

   -W host:port
       Requests that standard input and output on the client be
       forwarded to host on port over the secure channel.  Implies -N,
       -T, ExitOnForwardFailure and ClearAllForwardings.  Works with
       Protocol version 2 only.

Re: A Unix Utility You Should Know About: Netcat (2009)

#6
post #3

There is a better utility available for folks. Ncat - part of famous the Nmap (5) project. It has more features than netcat that people might find useful - like SCTP, SOCKS, etc.. You can find out more about it: http://nmap.org/ncat/

Ncat is also more compassionate regarding command line parameters.

Depending on the nc app you have installed on your machine, params will have to be passed using different flags or in differing orders (someone should post why there are different kinds of netcat, I forget). Ncat accepts either format, and sends you cards on your birthday.

Re: A Unix Utility You Should Know About: Netcat (2009)

#8

There are so many different variants of netcat: nc, netcat, ncat, socat... I can never be sure of which syntax I'm going to get on an unfamiliar server.

nc, ncat, and netcat are all the "same". Any of them could be any of:

  * the original netcat (http://nc110.sourceforge.net/)
  * OpenBSD netcat
  * "GNU netcat" (not affiliated with GNU)
  * BusyBox netcat
  * Nmap ncat (well, this one is typically always "ncat")
They all take roughly the same, but different, syntax, like 'cp', 'ls', or any of the *nix utilities with multiple implementations.
Post reply on HN