Netcat (nc)
Netcat is a featured networking utility that reads and writes data across network connections using TCP or UDP. It is often called the 'Swiss Army Knife' of networking tools.
Key Uses in Security
-
Banner Grabbing: Connecting to a port to read the service banner (version information). bash nc target.com 80
Then type: HEAD / HTTP/1.0 [Enter, Enter]
-
Simple Port Scanning: Checking if a single port is open. bash nc -z -v target.com 80
-
Creating Listeners (Catching Shells): Setting up a listener to catch a reverse shell connection (often used when Metasploit is overkill). bash
Listen Verbose Numerical Port (l: listen, v: verbose, n: numeric IP, p: port)
nc -lvnp 4444
Security Note: Netcat is so useful it is often disabled or removed on hardened production systems.