67

I used to use netcat for Windows to help track down network connectivity issues. However these days my anti-virus software (Symantec - but I understand others display similar behaviour) quarantines netcat.exe as malware.

Are there any alternative applications which provide at least the following functionality:

  • can connect to an open TCP socket and send data to it which is typed on the console
  • can open and listen on a TCP socket and print received data to the console

?

I don't need the 'advanced' features (which are possibly the reason for the quarantining) such as port scanning or remote execution.

2
  • 1
    curl.exe comes with windows 10 1803 and above.
    – js2010
    May 23, 2020 at 17:23
  • what about busybox for windows? if in alpine it is solo, it is at least harmony for windows, I carry it with me and use busybox.exe nc tar ash (and vi) on a daily basis
    – Jew
    Feb 21 at 12:59

8 Answers 8

32

ncat seems to be exactly what you're looking for. It's an implementation of netcat available on the official Nmap site with the port scanning feature removed. Doesn't raise any virus alerts either.

From the "Ncat Users' Guide":

Ncat is our modern reinvention of the venerable Netcat (nc) tool released by Hobbit in 1996. While Ncat is similar to Netcat in spirit, they don't share any source code. Instead, Ncat makes use of Nmap's well optimized and tested networking libraries. Compatibility with the original Netcat and some well known variants is maintained where it doesn't conflict with Ncat's enhancements or cause usability problems. Ncat adds many capabilities not found in Hobbit's original nc, including SSL support, proxy connections, IPv6, and connection brokering. The original nc contained a simple port scanner, but we omitted that from Ncat because we have a preferred tool for that function.

3
  • 6
    This got flagged as a virus by my overzealous AV (Windows Defender, I believe). Apr 9, 2021 at 14:11
  • 1
    I also encountered the same...download was blocked as a virus. If you're willing to take a long route, you can install it from Cygwin as the nc and nc6 packages. I then just copied it from the install test machine (which we use/abuse to collect all spurious software packages) to my local machine. Seems to work fine. I only needed the nc.exe and the cygwin1.dll from the install test machine's cygwin
    – RexBarker
    Jun 3, 2021 at 7:25
  • @RexBarker Note that the nc tool which is installed in cygwin is a different implementation than the ncat tool which is installed with nmpap. For example the command nc -v -l xxx xx on cygwin doesn't print the ip of the remote host or when a connection is establish by a remote client. On the contrary the command ncat -v -l xxx xx gives you this important details. This is why I prefer to use ncat instead of nc. Another advantage of ncat is that probably it is not black listed by an AV software as reported by Andrew.
    – Bemipefe
    Oct 14, 2021 at 13:20
22

The quick answer here is to use the built in Telnet program from the CMD command line.

the command is...

telnet hostname.domain.com 80

The above example will connect you to the hostname on port 80. you can use it on just about any port you need to check out. This is extremely handy for troubleshooting SMTP and ESMTP issues.

12
  • 14
    Yes telnet is useful, but only solves half of the problem.
    – heavyd
    Jul 28, 2009 at 15:43
  • 11
    You no longer have telnet on win vista. Jul 28, 2009 at 16:07
  • 5
    But you can install it, according to (for example) adamsdvds.co.uk/tutorials/vista/telnet/telnet.php... Jul 28, 2009 at 16:23
  • 3
    Since the link from Matthew doesn't work anymore, telnet still exists in Vista and 7, it just has to be installed in the Control Panel/Turn windows features on/off. AFAIK it doesn't even require the installation DVD.
    – Cray
    Nov 6, 2012 at 13:49
  • 5
    Telnet can't do UDP testing like netcat can (e.g. for testing VPN connectivity)
    – simpleuser
    Apr 30, 2019 at 0:06
15

http://joncraton.org/blog/netcat-for-windows

This person ran into the exact same problem; read till the end for the version compiled without remote execution. I downloaded and extracted these on two systems running 'Symantec Endpoint Protection'. While the netcat on this page was removed and quarantined when run, the 'rodneybeede' version linked to near the end of the page tried to connect to the desired port, and wasn't quarantined.

4
  • Yes, note that this site has a download with a "non -e" version that apparently is more friendly for virus scanners.
    – rogerdpack
    Jun 10, 2014 at 14:59
  • This netcat is ancient and does not have IPv6 support.
    – Mygod
    Jun 27, 2019 at 10:46
  • and it is also blocked by CrowdStrike as "malicious" :(
    – 62mkv
    Jun 8, 2021 at 12:00
  • Virustotal says Detection ratio: 27/73 so it is the same in this regard as the original... Feb 21, 2022 at 16:03
13

I discovered that MobaXterm for Windows has the nc (netcat) command, as well as many other Unix commands, like ls, ps, and kill.

I wholeheartedly recommend MobaXterm, especially if you are familiar with both Unix and DOS. For me, there was nothing to install; it's just one executable that opens a terminal window in Windows that accepts many Unix commands. Since I frequently use both Unix and DOS and often use one to connect to the other, MobaXterm for Windows is an extremely useful tool for me.

(Sorry if this sounds like an advertisement; I don't work for nor am I affiliated with MobaXterm. A friend recently introduced it to me and it made certain tasks so much easier for me.)

1
  • I believe this is just the "cygwin" netcat, and installed to a temp folder, so not accessible outside "MobaXterm" [however, it does work from inside its shell].
    – rogerdpack
    Jun 10, 2014 at 15:03
4

Even if it seems otherwise, Wireshark is easy to use. You can setup it easily to listen to a specific port.

wireshark

Another tool is nmap which again, I find easy to use. It will tell you much about open ports on a remote machine, so you can use it troubleshoot connectivity issues. Just nmap www.google.com from command line, or from included gui interface.

nmap

nmap

Just give them a try.

7
  • 2
    Will these tools let me 'open and listen on a TCP socket and print received data to the console' (the second bullet point)? Jul 28, 2009 at 16:17
  • 2
    I've updated the answer with a screenshot of tcp capture from Wireshark. In 9 minutes i've downloaded it, installed it, started a capture, and gave it a screenshot. Jul 28, 2009 at 16:28
  • 2
    But isn't Wireshark capturing data sent between two already executing networked processes? I really want to be able to start up the application to listen on a port as a server (as I could with netcat) so that I can debug client applications. Jul 28, 2009 at 16:48
  • 7
    Wireshark will not allow you to communicate with the server you are connected to, nor will it listen on socket for incoming connnection. It is a packet capture tool, not quite what the OP is looking for.
    – heavyd
    Jul 28, 2009 at 17:19
  • 1
    Will WireShark let me capture data between two processes running on the same machine? Jul 31, 2009 at 8:35
4

If you need netcat, you can whitelist netcat.exe in your anti-virus program.

You may also want to download a current version, which is called ncat and can be found in the nmap distribution.

1
  • unfortunately "ncat" (the command line executable provided by the nmap distro) doesn't seem to be a drop in replacement for the unix "nc" command [different command line parameters] <sigh>...you have to get a true "netcat" somewhere else [or use cygwin]
    – rogerdpack
    Jun 10, 2014 at 15:13
4

You can download Ncat - Netcat for the 21st Century. It seems to be a modern version of NCat, it is actively supported, and, most important, it had a 0/48 detection ratio at VirusTotal.

Portable version or from NMap Windows installer - disable anything else from the install wizard:

enter image description here

1
1

There is now also separate 'ncat' static build available at http://nmap.org/dist/ncat-portable-5.59BETA1.zip

Not the answer you're looking for? Browse other questions tagged .