Questions tagged [netcat]

Netcat is a simple but powerful utility program that reads and writes data across network connections, using TCP or UDP protocol, IPv4 or IPv6, with a variety of functions.

Netcat (or nc, as the executable is traditionally named) is a simple but powerful utility program that reads and writes data across network connections, using TCP or UDP protocol, IPv4 or IPv6, functioning as a client or a server.  It is designed to be a reliable “back-end” tool that can be easily driven by other programs and scripts, but is also well suited to interactive (command-line) usage.  It is so versatile that it is called the “TCP/IP Swiss Army Knife”.

Netcat can be used as a test tool, to exercise network components (e.g., products), but it can also be a building block in a simple prototype system.  It is conceptually a network-enabled version of the Unix cat program, reading data from one place and writing somewhere else.  Like cat, it can handle textual or binary data.  Initially developed for Unix, Netcat is now also available for Windows.  The Unix versions can operate on Unix domain sockets as well as network sockets.  GNU Netcat is distributed freely under the GNU General Public License (GPL).

References: https://en.wikipedia.org/wiki/Netcat, http://nc110.sourceforge.net/index.html, http://netcat.sourceforge.net/index.php (GNU Netcat), and http://www.openbsd.org/cgi-bin/man.cgi?query=nc (a man page).

217 questions
92
votes
5 answers

Can the telnet or netcat clients communicate over SSL?

I would like to test client connections with IMAP over SSL, HTTPS, and other secure text-based Internet protocols over SSL/TLS, the same way I would using telnet or netcat if they were not tunneled over a secure protocol. Is there a way to get…
user553702
  • 1,451
58
votes
7 answers

Sending file via netcat

I'm using something like this to send file from one computer to another: To serve file (on computer A): cat something.zip | nc -l -p 1234 To receive file (on computer B): netcat server.ip.here. 1234 > something.zip My question is... can I do the…
Phil
  • 1,551
56
votes
5 answers

Netcat on Mac OS X

Is anybody else not able to get nc -lp 8888 working on Mac OS X? Is there another way to get this to work?
kzh
  • 4,473
52
votes
1 answer

How can I force netcat to send my input immediately, not just on newlines?

How can I force netcat to send my input immediately, not just on newlines? I want to test an HTTP parser manually and check how it behaves when header lines are spread across multiple packets.
thejh
  • 1,457
43
votes
9 answers

How can I pipe commands to a netcat that will stay alive?

echo command | netcat host port This results in the command being sent to the remote host and some data being read back. But after a few seconds, the connection closes. The -w parameter did not change anything. I am using netcat v1.10 on SuSE…
Chris
  • 561
42
votes
1 answer

What is the difference between telnet and netcat?

I am looking for an explanation where I can find the difference between telnet and netcat. In which cases should I use telnet and netcat? What a telnet can do that netcat can not do and vice versa? I tried to get the answer from the Internet but it…
rbashish
  • 546
36
votes
3 answers

netcat - keep listening for connection in Debian

There's -k option in OS X (BSD) version of netcat to keep listening after current connection is completed. However in Debian (GNU?) version this option is missing. There's -q -1 option to listen forever after EOF appears on stdin but this doesn't do…
35
votes
7 answers

How can I verify that a 1TB file transferred correctly?

I frequently transfer VM images from hypervisors to an archive server for long term storage. I transfer using netcat since it is faster than scp, rsync, ect.. hypervisor$ cat foo.box | nc 1234 archive$ nc -l -p 1234 > foo.box When…
tbenz9
  • 7,175
28
votes
3 answers

How do I interactively type \r\n-terminated query in netcat?

$ nc example.com 80 GET / HTTP/1.1 Host: example.com HTTP/1.1 200 OK ... It works, line separator is just 0A here instead of required 0D0A. How do I type a 0D0A-separated query in netcat? It is easy to do one-time thing with printf manually…
Vi.
  • 17,755
22
votes
1 answer

Why is "nc -l xxxx" not opening a port?

I'm trying to get netcat to listen on port 4444, but it doesn't seem to be working. I am checking to see if the port is open using nmap, but it doesn't pick it up and I can't figure out why. I have tried various ports with no joy. Here is a copy of…
Grezzo
  • 982
19
votes
3 answers

Netcat/socat behavior with piping and UDP?

I guess this is close to linux - Netcat stops listening for UDP traffic - Super User, but I thought I'd better ask anyways As far as versions of netcat I'm using Ubuntu 11.04 and the default netcat on it, which I'm guessing is the openbsd one: $…
sdaau
  • 6,008
18
votes
2 answers

Why is the '-e' option missing from netcat-openbsd?

Why is the -e option missing from the netcat-openbsd package? There is a netcat-traditional package but it has many features from the OpenBSD package missing. I am running Linux Mint 16. Does anyone know why this is missing? It removes quite a big…
p1xel
  • 520
  • 2
  • 5
  • 11
18
votes
7 answers

Linux built-in or open source program to join multicast group?

I'm using tcpdump to capture multicast packets and had to code up a custom program to join multicast feeds so tcpdump will "see" the packets. Just wondering if netcat or any other applications can perform this function instead?
chriskirk
  • 393
18
votes
3 answers

What is the Windows equivalent of the command "nc [server_name] [port]"?

On linux, one can connect to a server by typing nc pwnable.kr 9000 on a terminal. On windows, this does not work in Powershell nor cmd, and also Putty when using Telnet looks at first like it connected, and then whenever I enter something it exits,…
Emolga
  • 282
16
votes
3 answers

netcat as a multithread server

I use netcat to run a simple server like this: while true; do nc -l -p 2468 -e ./my_exe; done This way, anyone is able to connect to my host on port 2468 and talk with "my_exe". Unfortunately, if someone else wants to connect during an open session,…
etuardu
  • 867
1
2 3
14 15