Information Gatheringnetworkingtcpudpport-scanningshellbackdoor

netcat

Netcat-traditional is a simple Unix utility that reads and writes data across TCP or UDP network connections. It serves as a reliable back-end tool for scripts and a feature-rich network debugging and exploration utility.

Description

Netcat-traditional, the classic version written by Hobbit, is a TCP/IP swiss army knife designed for creating connections and performing network tasks. It lacks many features found in netcat-openbsd but provides core functionality for reading and writing data across network connections using TCP or UDP protocols. This tool is ideal as a back-end for other programs and scripts, enabling reliable data transfer and network interactions.

Use cases include network debugging, exploration, port scanning, and creating connections for file transfers or shells. It supports inbound listening and outbound connections, with capabilities like broadcasting, source-routing, and executing programs after connect. The tool is feature-rich for almost any connection type needed in penetration testing or networking tasks.

Installed size is 139 KB with dependency on libc6. It includes the nc.traditional binary for command-line usage.

How It Works

Netcat-traditional operates by establishing TCP or UDP connections to read and write data streams. It can connect to a hostname and port(s) or listen on a specified port for inbound connections. Built-in capabilities include delay intervals for line sending or port scanning, keepalive options, source-routing via gateways, broadcasting, and executing shell commands or programs post-connection using /bin/sh or specified filenames. Port specifications support individuals or ranges (lo-hi inclusive), with backslash-escaped hyphens in port names.

Installation

bash
sudo apt install netcat-traditional

Flags

-cshell commands as `-e'; use /bin/sh to exec [dangerous!!]
-efilename program to exec after connect [dangerous!!]
-ballow broadcasts
-ggateway source-routing hop point[s], up to 8
-Gnum source-routing pointer: 4, 8, 12, ...
-hthis cruft
-isecs delay interval for lines sent, ports scanned
-kset keepalive option on socket
-llisten for inbound (used with -p port)
-pport to listen on (used with -l)

Examples

Display help and usage information including connect, listen syntax and options
nc.traditional -h
Connect to a hostname on specified port(s)
nc [-options] hostname port[s] [ports] ...
Listen for inbound connections on specified port
nc -l -p port [-options] [hostname] [port]
Connect and execute shell commands using /bin/sh after connect
nc -c shell commands hostname port
Connect and execute specified program after connect
nc -e filename hostname port
Connect allowing broadcasts
nc -b hostname port
Connect with delay interval for port scanning a range
nc -i secs hostname lo-hi
Updated 2026-04-16kali.org ↗