Back to course

Tool: Netcat (The Swiss Army Knife)

Cyber Security Mastery: From Zero to Hero

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

  1. 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]

  2. Simple Port Scanning: Checking if a single port is open. bash nc -z -v target.com 80

  3. 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.