netcat/nc/ncat are utilities that sends and receives data using TCP or UDP.
When talking about 'netcat', it can refer to the following projects. Each implementation has similar functionalities, but the command line options may differ.
netcat(which is symlinked to
ncon some Linux systems, leading to confusion)
ncat(which is also symlinked to nc) with lots of features including SSL support and proxy connections.
Usage[edit | edit source]
For the most part, netcat and ncat are very similar. The older OpenBSD nc has less features.
|Listen on a port||
|Send to a port||
|Send to a port, using a specific source port||
SSL with ncat[edit | edit source]
ncat allows for creating SSL server or client.
|Connect to a server using SSL|
|Verify a server's SSL|
|Listen using SSL (auto generated)|
|Listen using SSL (manual SSL certs)|
If you're trying to reverse proxy for a SSL server, you should look at socat.
Tasks[edit | edit source]
Create a remote shell[edit | edit source]
With ncat, you can use the --exec option to spawn a program on a new connection.
hostA# ncat --exec /bin/sh -l 8888 hostB# ncat hostA 8888 ## Any command you type goes to /bin/sh on hostA
If you want to do this a bit more securely, you can also:
- Enable SSL with
- Restrict access to a specific host with
See also[edit | edit source]
- Socat which can be used to send/receive data through sockets as well as TCP/UDP protocols