Skip to content

Port Scanning

Quick port discovery (30 seconds)

sudo masscan -p1-65535 10.129.34.145 --rate=500 -oG masscan.txt

Extract ports

ports=$(cat masscan.txt | grep open | cut -d' ' -f5 | cut -d'/' -f1 | sort -u | paste -sd,)

Detailed scan only on open ports

nmap -sV -sC -p$ports 10.129.34.145

Alternative Approaches

Top 1000 ports first

nmap -T4 --top-ports 1000 10.129.34.145

Or specific common ports

nmap -sV -sC -p 21,22,80,443,445,3389,8080 10.129.34.145

Full scan only if needed (overnight)

nmap -p- -T4 --min-rate 1000 10.129.34.145

Scan ranges in parallel

nmap -p1-10000 10.129.34.145 &
nmap -p10001-20000 10.129.34.145 &
nmap -p20001-30000 10.129.34.145 &
# etc