ncat is a networking utility in the Nmap suite for reading and writing data across networks. It is similar to the traditional cat command in Unix, but with the added capability to handle data transfer over the network. Ncat can listen on a network address and port, and wait for incoming connections. When a connection is established, it can act as a simple echo server to send back any data received. It can also act as a client and connect to a server to send data. Ncat supports a variety of protocols, including TCP, UDP, and SCTP. It is useful for a range of purposes such as testing network connections, transferring files, and more.
ncat Command Examples
1. Listen for input on the specified port and write it to the specified file:
# ncat -l port > path/to/file
2. Accept multiple connections and keep ncat open after they have been closed:
# ncat -lk port
3. Write output of specified file to the specified host on the specified port:
# ncat address port < path/to/file