π€ AI Prompts Cheatsheet
Daniel Osei — AI-Assisted Security Engineer
What is Nmap?
Nmap (Network Mapper) is a powerful open-source tool used for network discovery and security auditing. It allows security professionals to discover hosts and services on a network, thus providing a comprehensive view of a target’s surface area.
Installation
Nmap can be installed on various operating systems including Linux, Windows, and macOS. To install on different platforms:
- On Debian/Ubuntu:
sudo apt install nmap - On Fedora:
sudo dnf install nmap - On macOS:
brew install nmap - On Windows: Download the installer from the Nmap official website.
Basic Syntax
The general syntax for Nmap is:
nmap [options] [targets]
Scanning
Host Discovery
Identify active hosts on a network:
nmap -sn 192.168.1.0/24
Service Version Detection
Detect services and their versions running on target hosts:
nmap -sV 192.168.1.1
Operating System Detection
Identify the operating system of a target:
nmap -O 192.168.1.1
Exploitation
TCP Connect Scan
A full TCP connection scan:
nmap -sT 192.168.1.1
Stealth Syn Scan
A stealthier alternative to TCP connect scan:
nmap -sS 192.168.1.1
Analysis
Script Scanning
Using Nmap’s scripting engine to execute scripts:
nmap --script=http-vuln* 192.168.1.1
Reporting
Output Options
Generate output in various formats:
| Flag | Description |
|---|---|
| -oN | Normal output |
| -oX | XML output |
| -oG | Grepable output |
nmap -oN output.txt 192.168.1.1
Pro Tips
- Use -Pn to skip host discovery if you know the target is up, speeding up scans.
- Combine scripts with
--script-argsfor tailored scans. - Save scan profiles for repeated assessments with the
-iLoption.
Real-World Examples
Example 1: Scanning a specific range of IPs for open ports and service versions:
nmap -p 1-65535 -sS -sV 192.168.1.0/24
Example 2: Saving results in XML format for further analysis:
nmap -oX scan_results.xml 192.168.1.10