GO BACK TO HOME

Nmap Detailed Guide

1. Installation

Ubuntu/Debian:

sudo apt update

sudo apt install nmap

CentOS/RHEL:

sudo yum install nmap

2. Basic Usage

Scan a Single Target:
nmap 192.168.1.1

Scan Multiple Targets:
nmap 192.168.1.1 192.168.1.2

Scan a Range of IPs:
nmap 192.168.1.1-10

3. Scan Options

Scan Specific Ports:

nmap -p , 

Scan All Ports:

nmap -p- 

Scan for Open Ports Only:

nmap --open 

4. Scan Techniques

SYN Scan (Stealth Scan):

nmap -sS 

TCP Connect Scan:

nmap -sT 

UDP Scan:

nmap -sU 

Ping Scan:

nmap -sn 

5. Service and Version Detection

Detect Services:

nmap -sV 

Detect OS:

nmap -O 

6. Script Scanning

Run Default Scripts:

nmap -sC 

Run Specific Scripts:

nmap --script  

7. Output Options

Save Output to a File:

nmap -oN  

Save Output in XML Format:

nmap -oX  

8. Timing and Performance

Set Timing Template:

nmap -T<0-5> 

Adjust Max Retries:

nmap --max-retries  

9. Firewall/IDS Evasion

Fragment Packets:

nmap -f 

Decoy Scan:

nmap -D ,,ME 

Idle Scan:

nmap -sI  

10. Advanced Scanning Techniques

IPv6 Scan:

nmap -6 

Scan Behind Firewall (using proxies):

nmap --proxies  

Scan with Custom Data Length:

nmap --data-length  

11. NSE (Nmap Scripting Engine)

List Available Scripts:

ls /usr/share/nmap/scripts/

Run Vulnerability Scripts:

nmap --script vuln 

Run Safe Scripts:

nmap --script safe 

12. Comparing Scan Results

Compare Two Nmap Output Files:

ndiff  

Compare Multiple Nmap Output Files:

ndiff   

13. Nmap with Zenmap

Zenmap is a graphical front-end for Nmap that makes it easier to run scans and visualize results.

Install Zenmap:

sudo apt install zenmap

Launch Zenmap:

zenmap

14. Troubleshooting

Check Nmap Version:

nmap --version

Debugging Output:

nmap -d 

Verbose Output:

nmap -v 

15. Community and Resources

Official Nmap Documentation:
Nmap Manual

Nmap Mailing List:
Nmap Development Mailing List

Nmap Scripting Engine (NSE) Documentation:
NSE Documentation