π€ AI Prompts Cheatsheet
Priya Nair — Prompt Engineering Expert
What is Nmap?
Nmap (Network Mapper) is a powerful open-source tool designed for network discovery and security auditing. It allows security professionals to discover hosts and services on a computer network, thus creating a ‘map’ of the network. Nmap is widely used for tasks such as network inventory, managing service upgrade schedules, and monitoring host or service uptime.
Installation
Nmap can be easily installed on various operating systems. Hereβs how:
- Windows: Download the installer from the Nmap website and follow the prompts.
- Linux: Use your package manager. For example,
sudo apt install nmapfor Debian-based systems orsudo dnf install nmapfor Fedora. - MacOS: Use Homebrew with
brew install nmap.
Basic Syntax
nmap [options] {target}
Example: nmap -sS 192.168.1.1
Network Discovery
Ping Scan
Check which hosts are up.
nmap -sn 192.168.1.0/24
OS Detection
Identify the operating system of remote devices.
nmap -O 192.168.1.1
Scanning
Service Version Detection
Determine service versions running on open ports.
nmap -sV 192.168.1.1
TCP Scan
Perform a full TCP connect scan.
nmap -sT 192.168.1.1
Exploitation
Script Scan
Run Nmap scripts for more detailed scan results.
nmap -sC 192.168.1.1
Analysis
Output Formats
Save results in different formats for analysis (XML, grepable, etc.).
nmap -oX output.xml 192.168.1.1
Evasion
Decoy Scan
Use decoy scans to obscure source IP.
nmap -D RND:6 192.168.1.1
Reporting
Human-Readable Output
Create easy-to-read scan reports.
nmap -oN report.txt 192.168.1.1
Quick Reference Table
| Flag | Description |
|---|---|
| -sS | SYN scan (stealth scan) |
| -sT | Connect scan |
| -O | OS detection |
| -p | Scan specific ports |
| -oN | Normal output |
| -oX | XML output |
Pro Tips
- Use the
-Pnflag to skip host discovery if you know the host is up. - Combine multiple options like
nmap -sV -O -p 1-65535 192.168.1.1for comprehensive scans. - Use the
--scriptoption to specify custom scripts for specific types of vulnerabilities.
Real-World Examples
Performing a Targeted Scan
nmap -sS -sV -O -p 80,443 192.168.1.1
Scanning a Subnet
nmap -sP 192.168.1.0/24
Running a Stealth Scan
Run a stealth scan without being easily detected:
nmap -sS -D RND:6 192.168.1.1