# Netcat

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/Netcat
> Markdown URL: https://mediated.wiki/source/Netcat.md
> Source: https://en.wikipedia.org/wiki/Netcat
> Source revision: 1329946573
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

{{Short description|Computer networking utility}}
{{Lowercase}}
{{Redirect|Ncat||NCAT (disambiguation){{!}}NCAT}}
{{Infobox software
| name = netcat
| logo = 
| screenshot = frameless
| caption = The {{code|netcat}} command
| author = <nowiki>*Hobbit*</nowiki>
| developer = Avian Research
| released = {{Start date and age|1995|10|28}}<ref>{{cite web
| url=https://seclists.org/bugtraq/1995/Oct/28
| title=New tool available: Netcat
| author=Hobbit
| date=1995-10-28
| work=[Bugtraq](/source/Bugtraq) mailing list
| access-date=2019-06-05}}</ref>
| latest_release_version = 1.10
| latest_release_date = {{Start date and age|1996|03||df=yes}}
| operating_system = [Unix](/source/Unix) and [Unix-like](/source/Unix-like), [DOS](/source/DOS), [Microsoft Windows](/source/Microsoft_Windows), [Windows CE](/source/Windows_CE)
| genre = [Network](/source/Computer_network) [utility](/source/Utility_software)
| license = Original version: custom, [permissive](/source/Permissive_free_software_licence) license<br />GNU version: [GPL](/source/GNU_General_Public_License)<br />OpenBSD version: [BSD](/source/BSD_licenses)
| website = {{URL|nc110.sourceforge.io}}
| discontinued = yes
}}

'''netcat''' (often abbreviated to '''nc''') is a computer networking utility for reading from and writing to network connections using [TCP](/source/Transmission_Control_Protocol) or [UDP](/source/User_Datagram_Protocol). The [command](/source/command_(computing)) is designed to be a dependable [back-end](/source/front_and_back_ends) that can be used directly or easily driven by other programs and scripts. At the same time, it is a feature-rich network debugging and investigation tool, since it can produce almost any kind of connection its user could need and has a number of built-in capabilities.

It is able to perform [port scanning](/source/Port_scanner), [file transferring](/source/File_transfer) and port listening.

==Features==
The original netcat's features include:<ref>{{Cite book |last=Vacca |first=John R. |title=Guide to Wireless Network Security |publisher=[Springer Publishing](/source/Springer_Publishing) |year=2006 |isbn=978-0387954257 |pages=266 |language=en}}</ref>

* Outbound or inbound connections, TCP or UDP, to or from any ports
* Full [DNS forward/reverse checking](/source/Reverse_DNS_lookup), with appropriate warnings
* Ability to use any local source port
* Ability to use any locally configured network source address
* Built-in port-scanning capabilities, with randomization
* Built-in loose source-routing capability
* Can read command line arguments from standard input
* Slow-send mode, one line every N seconds
* [Hex dump](/source/Hex_dump) of transmitted and received data
* Optional ability to let another program service establish connections
* Optional [telnet](/source/telnet)-options responder

Rewrites like GNU's and OpenBSD's support additional features. For example, OpenBSD's nc supports [TLS](/source/Transport_Layer_Security), and GNU netcat natively supports a [tunneling](/source/Tunneling_protocol) mode supporting UDP and TCP (optionally allowing one to be tunneled over the other) in a single command,<ref>{{cite web
| url = https://netcat.sourceforge.net/
| title = The GNU Netcat project
| author = Giovanni Giacobbi
| date = 2006-11-01
| access-date = 2020-03-22}}</ref> where other versions may require piping data from one netcat instance to another.

==Ports and reimplementations==
The original version of netcat was a [Unix](/source/Unix) program. The last version (1.10) was released in March 1996.<ref name="nc110">{{cite web |date=2008-02-14 |title=Netcat 1.10 |url=https://nc110.sourceforge.net/ |access-date=2019-06-05 |website=nc110.sourceforge.net}}</ref>

There are several implementations on [POSIX](/source/POSIX) systems, including rewrites from scratch like [GNU](/source/GNU) netcat<ref>{{cite web
| url = https://netcat.sourceforge.net/
| title = The GNU Netcat project
| author = Giovanni Giacobbi
| date = 2006-11-01
| access-date = 2019-06-05}}</ref> or [OpenBSD](/source/OpenBSD) netcat,<ref>{{cite web
| url = https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/nc/
| title = OpenBSD CVSWeb: /src/usr.bin/nc/
| publisher = [OpenBSD](/source/OpenBSD)
| access-date =  2019-06-05}}</ref>
the latter of which supports IPv6 and [TLS](/source/Transport_Layer_Security). The OpenBSD version has been ported to the [FreeBSD](/source/FreeBSD) base,<ref>{{cite web
| url = https://svnweb.freebsd.org/base/release/5.4.0/usr.bin/nc/Makefile?revision=141394&view=markup
| title = Contents of /release/5.4.0/usr.bin/nc/Makefile
| author = delphij
| date = 2005-02-06
| publisher=[FreeBSD](/source/FreeBSD)
| access-date = 2019-06-05}}</ref>
Windows/Cygwin,<ref>{{cite web
| url = https://www.daemon.de/Netcat
| title = Netcat OpenBSD Cygwin Port 1.10.2.3
| author = Thomas Linden
| website = Daemon.de
| date = 2011-03-02
| access-date = 2019-06-05}}</ref>
and Linux.<ref>[https://tracker.debian.org/pkg/netcat-openbsd Debian netcat-openbsd]</ref>
[Mac OS X](/source/macOS) comes with netcat installed as of OSX 10.13 or users can use [MacPorts](/source/MacPorts) to install a variant.<ref>{{cite web
| url = https://www.macports.org/ports.php?by=name&substr=netcat
| title = MacPorts Portfiles: netcat
| publisher = [MacPorts](/source/MacPorts)
| access-date = 2019-06-05}}</ref>

A [DOS](/source/DOS) version of ''netcat'' called ''NTOOL'' is included in the [FreeDOS](/source/FreeDOS) Package group ''Networking''.<ref>{{cite web
| url=https://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/distributions/1.2/repos/pkg-html/group-net.html
| title=ibiblio.org FreeDOS Group -- Networking
| date=2019-03-03
| publisher=[ibiblio](/source/ibiblio)
| access-date=2019-06-05}}</ref> It is based on the WatTCP stack and licensed under the [European Union Public Licence](/source/European_Union_Public_Licence) Version 1.1.<ref>{{cite web
| url=https://www.bttr-software.de/products/jhoffmann/
| title=various tools
| author=Jürgen Hoffmann
| date=2018-11-03
| access-date=2019-06-05}}</ref>

Known ports for embedded systems includes versions for [Windows CE](/source/Windows_CE) (named "Netcat 4 wince"<ref>{{cite web
| url = https://www.dr-bischoff.de/wince/Andreas_WINCE_stuff.html#netcat
| title = Netcat 4 wince
| author = Andreas Bischoff
| date = 2010-06-07
| access-date = 2019-06-05}}</ref>) or for the [iPhone](/source/iPhone).<ref>{{cite web
| url = http://svn.telesphoreo.org/trunk/data/netcat/
| title = Revision 835: /trunk/data/netcat
| date = 2008-08-18
| access-date = 2019-06-05}}</ref>

[BusyBox](/source/BusyBox) includes by default a lightweight version of netcat named mini-netcat.<ref>{{Cite web|url=https://git.busybox.net/busybox/tree/networking/nc.c?h=1_37_0|title=nc: mini-netcat - built from the ground up for LRP|website=git.busybox.net}}</ref> Another version with more features, named bloaty nc, is also available.<ref>{{Cite web|url=https://git.busybox.net/busybox/tree/networking/nc_bloaty.c?h=1_37_0|title=busybox - bloaty nc|website=git.busybox.net}}</ref>

[Solaris](/source/Solaris_(operating_system)) 11 includes netcat implementation based on OpenBSD netcat.<ref>{{Cite web|url=https://docs.oracle.com/cd/E36784_01/html/E37476/gnqeb.html|title= Oracle Solaris 11.2 Information Library - Performing TCP and UDP Administration With the netcat Utility|website=docs.oracle.com}}</ref>

Socat<ref>{{cite web 
| url = http://www.dest-unreach.org/socat/
| title = socat - Multipurpose relay
| date = 2019-04-06
| access-date = 2019-06-05}}</ref> is a more complex variant of ''netcat''. It is larger and more flexible and has more options that must be configured for a given task.  On February 1, 2016, [Santiago Zanella-Beguelin](/source/Santiago_Zanella-Beguelin) and [Microsoft Vulnerability Research](/source/Microsoft_Vulnerability_Research) issued a security advisory regarding a [composite](/source/composite_number) [Diffie-Hellman](/source/Diffie-Hellman) parameter which had been [hard-coded](/source/hard-coded) into the [OpenSSL](/source/OpenSSL) implementation of ''socat''.<ref name="socat-secadv7">{{cite web
| url=http://www.dest-unreach.org/socat/contrib/socat-secadv7.html
| title=Socat security advisory 7
| date=2016-02-01
| access-date=2019-06-05}}</ref> The implausibility that a composite might have been unintentionally introduced where a [prime number](/source/prime_number) is required has led to the suspicion of [sabotage](/source/sabotage) to introduce a [backdoor](/source/backdoor_(computing)) [software vulnerability](/source/software_vulnerability).<ref>{{cite web
| url=https://www.theregister.co.uk/2016/02/03/socat_backdoor_fix/
| title=Socat slams backdoor, sparks thrilling whodunit
| first=Richard
| last=Chirgwin
| date=2016-02-03
| publisher=[The Register](/source/The_Register)
| access-date=2019-06-05}}</ref> This socat bug affected version 1.7.3.0 and 2.0.0-b8 it was corrected in following releases from 1.7.3.1 and 2.0.0-b9.<ref name="socat-secadv7"/>

Cryptcat<ref>{{cite web
| url = https://cryptcat.sourceforge.net/
| title = CryptCat Project
| date = 2005-10-18
| access-date = 2019-06-05}}</ref> is a version of ''netcat'' with integrated transport encryption capabilities.

In the middle of 2005, [Nmap](/source/Nmap) announced another netcat incarnation called Ncat.<ref name="ncat">{{cite web
| url = https://nmap.org/ncat/
| title = Ncat - Netcat for the 21st Century
| publisher = [Nmap](/source/Nmap)
| date = 2009-07-08
| access-date = 2019-06-05}}</ref> It features new possibilities such as "Connection Brokering", TCP/UDP Redirection, SOCKS4 client and server support, ability to "Chain" Ncat processes, HTTP CONNECT proxying (and proxy chaining), SSL connect/listen support and IP address/connection filtering. Like [Nmap](/source/Nmap), Ncat is [cross-platform](/source/cross-platform).

On some systems, modified versions or similar netcat utilities go by the command name(s) <code>nc</code>, <code>ncat</code>, <code>pnetcat</code>, <code>socat</code>, <code>sock</code>, <code>socket</code>, <code>sbd</code>.

===ncat===
Ncat is a similar tool to netcat provided by [Nmap](/source/Nmap) suite.<ref name="ncat"/> ''"While Ncat isn't built on any code from the “traditional” Netcat (or any other implementation), Ncat is most definitely based on Netcat in spirit and functionality."''<ref>{{Cite web
| url=https://manpages.debian.org/stretch/nmap/ncat.1.en.html
| title=ncat(1) - Ncat Reference Guide
| date=2016-12-18
| website=manpages.debian.org
| access-date=2019-06-05}}</ref>

Ncat features includes: ability to chain Ncats together, redirect both TCP and UDP ports to other sites, SSL support, and proxy connections via [SOCKS4](/source/SOCKS4) or HTTP (CONNECT method) proxies (with optional proxy authentication as well).<ref>{{Cite web|url=https://nmap.org/ncat/|title = Ncat - Netcat for the 21st Century}}</ref>

==See also==
{{Portal|Free and open-source software}}
* [List of Unix commands](/source/List_of_Unix_commands)
*{{anli|cat (Unix)}}
* [Nmap](/source/Nmap)
* [OpenSSL](/source/OpenSSL)
* [Telnet](/source/Telnet)
* [Plink](/source/Plink)
* [Packet Sender](/source/Packet_Sender)
* [Banner grabbing](/source/Banner_grabbing)

==References==
{{Reflist}}

==External links==
* {{official website|https://nc110.sourceforge.io}}
* {{man|1|nc|die.net}}

{{Unix commands}}

Category:Free network management software
Category:Network analyzers
Category:Port scanners
Category:Unix network-related software
Category:Windows network-related software
Category:Free software programmed in C
Category:Software using the GNU General Public License
Category:Software using the BSD license

---
Adapted from the Wikipedia article [Netcat](https://en.wikipedia.org/wiki/Netcat) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/Netcat?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
