Ncat - Network Utility Tool Examples
Ncat Command Examples
Ncat is a versatile networking utility that can be used for a wide range of tasks, from simple network connections to complex file transfers and proxying. Below are common examples of how to use Ncat effectively.
Basic Network Connection and Listening
Ncat can act as both a client (connecting to a host) and a server (listening for connections). The default port is 31337.
# Connect mode (ncat is client) | default port is 31337
ncat <host> [<port>]
# Listen mode (ncat is server) | default port is 31337
ncat -l [<host>] [<port>]
File Transfer with Ncat
Ncat is excellent for transferring files over a network. You can send a file to a listening Ncat instance or receive a file from a connected client.
# Transfer file (closes after one transfer)
ncat -l [<host>] [<port>] < file
# Transfer file (stays open for multiple transfers)
ncat -l --keep-open [<host>] [<port>] < file
# Receive file
ncat [<host>] [<port>] > file
Advanced Ncat Features
Ncat supports advanced features like brokering for multiple clients, SSL encryption, access control, and proxying.
# Brokering | allows for multiple clients to connect
ncat -l --broker [<host>] [<port>]
# Listen with SSL | many options, use ncat --help for full list
ncat -l --ssl [<host>] [<port>]
# Access control
ncat -l --allow <ip>
ncat -l --deny <ip>
# Proxying
ncat --proxy <proxyhost>[:<proxyport>] --proxy-type {http | socks4} <host>[<port>]
# Chat server | can use brokering for multi-user chat
ncat -l --chat [<host>] [<port>]
Understanding Ncat's Capabilities
Ncat, often referred to as "the netcat successor," is a powerful command-line tool for network debugging and data transfer. It's an essential utility for network administrators and security professionals. Its ability to read and write data across networks makes it incredibly flexible. For more in-depth information and advanced options, consult the official Ncat documentation.