📱 Mobile Security Tips

Nina Kovacs — Consumer Security Analyst

{
“title”: “Comprehensive Cheatsheet for Nmap: Your Go-To Security Tool”,
“content”: “

What is Nmap?

Nmap (Network Mapper) is a powerful open-source tool for network exploration and security auditing. It is widely used for tasks such as network discovery, security monitoring, and vulnerability assessment among penetration testers and cybersecurity professionals.

Installation

Nmap can be installed on various operating systems, including Windows, Linux, and macOS. Here are the installation commands for popular platforms:

# For Ubuntu/Debian environments\nsudo apt-get install nmap\n\n# For CentOS/RHEL\nsudo yum install nmap\n\n# For Windows, download the installer from the official website:\nhttps://nmap.org/download.html

Basic Syntax

The basic syntax for using Nmap is:

nmap [options] {target}

Discovery

Nmap can be used to discover hosts and services on a network. Here are some common commands:

# Discover live hosts on a subnet\nnmap -sn 192.168.1.0/24\n\n# Scan a specific host for open ports\nnmap 192.168.1.1

Scanning

Once you discover devices, you can conduct different types of scans:

# TCP SYN scan (default scan)\nnmap -sS 192.168.1.1\n\n# TCP Connect scan\nnmap -sT 192.168.1.1\n\n# Service/version detection\nnmap -sV 192.168.1.1\n\n# OS detection\nnmap -O 192.168.1.1\n\n# Aggressive scan (combines various tests)\nnmap -A 192.168.1.1

Exploitation

Nmap is primarily a discovery and scanning tool, but it provides useful information for exploitation:

# Scan for specific ports\nnmap -p 22,80,443 192.168.1.1\n\n# List all scripts available with Nmap\nnmap --script-help\n\n# Run specific script (e.g., http-enum)\nnmap --script http-enum 192.168.1.1

Analysis

Output analysis is critical for understanding scan results:

# Save output to a file for further analysis\nnmap -oN output.txt 192.168.1.1\n\n# Output in XML format (for parsing)\nnmap -oX output.xml 192.168.1.1

Evasion

When scanning networks, evasion techniques can help avoid detection:

# Fragment packets to evade packet filters\nnmap -f 192.168.1.1\n\n# Slow down the scan to avoid detection\nnmap --scan-delay 1s 192.168.1.1

Reporting

Generating reports from Nmap scans can be done for professional presentation:

# Generate a simple HTML report\nnmap -oX report.xml 192.168.1.1 && xsltproc report.xml -o report.html\n\n# Create a grepable output\nnmap -oG output.gnmap 192.168.1.1

Quick Reference Table

Flag Description
-sS TCP SYN scan
-sT TCP connect scan
-O OS detection
-A Aggressive scan
-oN Normal output
-oX XML output
–script Run Nmap scripts
-f Fragment packets