When it comes to the OSCP exam you need to be efficient and quick with your enumeration, but your technique must be accurate too. You don't want to miss any port. That's where Nmap shines, and using it right from the start can make or break your success in pwning a box.
In this post I'll walk you through a solid two-step Nmap technique that I personally used during my OSCP exam, and still use on THM or HTB boxes. No need for rustscan or autorecon. Just nmap. That's it. Nothing more. And it works every time. Plus you don't have to install anything, nmap comes installed with Kali.
Before you dive into service enumeration or exploit searches, you need a clear view of what ports are open. I always start with this:
Flag breakdown: sudo is required for SYN scans. -p- scans all 65,535 TCP ports. -Pn skips host discovery and assumes the host is up. --open only shows open ports. -vvv is verbose, so you see what's happening in real time. -oG openPorts outputs in grepable format for quick parsing.
Now that we know what's open, we narrow our focus to exactly those ports, and only those:
Flag breakdown: -p 22,80 focuses only on the known open ports. -sC runs Nmap's default scripts. -sV grabs service versions, which is super useful for CVE hunting.
I always start by scanning for open ports only, no version detection, no scripts, no banners. Why? Because it keeps the scan quick and light. You get results faster, and more importantly, you send less traffic over the wire.
When you're on the OffSec VPN, which can sometimes be a bit "fragile," minimizing network usage is key. The less bandwidth you use, the less likely you are to get false negatives or cause a VPN disconnection, and that's critical during a timed exam like the OSCP.
Another reason. On a real-world pentest, slamming the client's network with aggressive scans can lead to network instability or even bring services down. That's a fast way to get escorted out of the building, virtually or physically, and lose the contract or even your job.
-A or running heavy default scripts against all 65,535 ports, you're not being smart, you're being loud. And that can cost you time, CPU, and even trust.
I can read your mind. You're probably thinking: what if the initial scan turns up a lot of open ports, do I really have to copy and paste all of them by hand? That's a bit annoying. So I built a small solution based on the Spanish pentester SAvitar. It uses the nmap output from the -oG flag to copy those ports straight to your clipboard, so you can paste them right into the Step 2 command above. The script requires xclip, which can be installed via apt.
Here's the code:
I added it to Kali's /usr/bin with execute permissions so I can run it directly.
Usage is pretty simple. Run the command with your nmap output:
Enumeration is the foundation of every good attack. Mastering tools like Nmap will make you faster, smarter, and more effective, both during the OSCP exam and in real-world pentests. Stick to this two-step method and you'll be ahead of the game.