π± Mobile Security Tips
Sarah Chen — iOS Security Specialist
{
“title”: “Maximizing Security with Nmap: A Comprehensive Cheatsheet”,
“content”: “
What is Nmap?
Nmap (Network Mapper) is an open-source tool for network exploration and security auditing. It is widely used by security professionals and network administrators for tasks such as network inventory, managing service upgrade schedules, and monitoring host or service uptime.
Installation
Nmap can be installed on various operating systems:
- Windows: Download the installer from the Nmap download page.
- Linux: Most distributions include Nmap in their repositories. Use the following command:
sudo apt-get install nmap
- macOS: Use Homebrew with the command:
brew install nmap
Basic Syntax
The basic syntax of Nmap is as follows:
nmap [options] [target]
Discovery
Basic Host Discovery
nmap -sn 192.168.1.0/24
This command performs a basic ping scan, discovering live hosts in the specified subnet.
Service Version Detection
nmap -sV 192.168.1.1
Use this command to detect versions of services running on an open port.
OS Detection
nmap -O 192.168.1.1
This command attempts to determine the operating system used by the target host.
Scanning
TCP Connect Scan
nmap -sT 192.168.1.1
This command connects to the target using TCP to check for open ports.
Stealth SYN Scan
nmap -sS 192.168.1.1
A stealth TCP scan that sends SYN packets and analyzes the responses, making it less detectable.
UDP Scan
nmap -sU -p 53,67,68 192.168.1.1
This command scans for open UDP ports, often used for services like DNS and DHCP.
Exploitation
Using Nmap Scripts for Vulnerability Scanning
nmap --script=vuln 192.168.1.1
This command runs Nmap’s built-in vulnerability scripts against the target.
Analysis
Output to XML for Further Analysis
nmap -oX scan.xml 192.168.1.1
Outputs the scan results in XML format for further analysis using tools like XML tools or custom scripts.
Generate a Report in HTML
nmap -oH scan.html 192.168.1.1
Creates a human-readable HTML report of the scan results.
Evasion
Fragmenting Packets
nmap -f 192.168.1.1
Unusual requests can evade intrusion detection systems by fragmenting packets.
Using Decoy for Stealth Scans
nmap -D RND:2 192.168.1.1
This command uses decoys to obfuscate the source of the scan.
Reporting
Saving Output in Different Formats
nmap -oN scan.txt 192.168.1.1
This command generates a human-readable output in a plaintext format.
Quick Reference Table
| Flag | Description |
|---|---|
-sS |
SYN scan |
-sV |
Service version detection |
-O |
OS detection |
--script |
Run specified Nmap scripts |
-oN |
Normal output |
-oX |
XML output |
Pro Tips
- Use
-p-to scan all ports (0-65535):nmap -p- 192.168.1.1 - Combine multiple options for thorough scans. For example,