nc_openbsd
Send and receive data over network connections
SYNOPSIS
nc [options] hostname port[s]
nc -l -p port [options] [hostname] [port]
PARAMETERS
-4
Force IPv4 resolution only.
-6
Force IPv6 resolution only.
-d
Detach from stdin after first read.
-e program
Execute program after connection.
-g gateway
Source-route hop point; require -r.
-G num
Source-route pointer; default 4, max 127.
-h
Display help text and exit.
-i interval
Set a delay interval for lines sent, ports scanned.
-k
Keep listening after client disconnect.
-l
Listen mode, for inbound connections.
-n
Numeric-only IP addresses, no DNS.
-o file
Hex dump traffic.
-p port
Specify local port for connection.
-r
Randomize ports for scanning
-s source_ip_address
Local source IP address.
-t
Answer TELNET negotiation.
-T keyword
Set IPsec policy, using keyword.
-u
UDP mode.
-v
Verbose output.
-w timeout
Timeout for connects and receives.
-x proxy_address[:port]
Use HTTP or SOCKS4 proxy.
-X protocol
Proxy protocol: "connect" (default), "socks4", or "http".
-z
Zero-I/O mode (used for scanning).
DESCRIPTION
Netcat is a versatile networking tool used for reading from and writing to network connections using TCP or UDP.
It's often described as a "network swiss army knife" because it can be used for a wide array of tasks, including port scanning, data transfer, and network debugging.
The OpenBSD version (`nc_openbsd`, often shortened to `nc`) offers enhanced security and is the default Netcat implementation on OpenBSD systems. Its core function is to establish connections or listen on specified ports to send or receive data. It supports various options to customize connection behavior, such as setting timeouts, specifying source ports, and enabling verbose output.
Netcat is valuable for system administrators, security professionals, and developers alike.
CAVEATS
The `-e` option should be used with caution as it may pose security risks. Avoid using it with untrusted data sources.
PORT SCANNING
Netcat's `-z` option is commonly used to perform port scanning. By specifying a range of ports, it can quickly determine which ports are open on a target host. For example: `nc -vz target.example.com 20-25`.
DATA TRANSFER
Netcat can be used to transfer files between two machines. On the receiving end, use `nc -l -p port > file`. On the sending end, use `nc receiver_ip port < file`.
HISTORY
The original Netcat was written by Hobbit in 1995. The OpenBSD version, often referred to as `nc`, has undergone significant development to enhance security and features, making it a widely trusted and used implementation. The OpenBSD `nc` is typically included in many Linux distributions as a replacement or alternative to other netcat implementations due to its focus on security.