Nmap Security Tool Cheatsheet

πŸ“± Mobile Security Tips

Sarah Chen — iOS Security Specialist

What is Nmap?

Nmap (Network Mapper) is an open-source tool for network discovery and security auditing. It is used to discover hosts and services on a computer network by sending packets and analyzing the responses. Nmap can be used to perform network inventory, monitor uptime, and manage service upgrade schedules, as well as for security audits.

Installation

Nmap can be installed on various platforms. Here’s how to install it on some common operating systems:

  • Linux: Use your package manager, for example, on Debian/Ubuntu:
  • sudo apt install nmap
  • Windows: Download the installer from the official Nmap website.
  • MacOS: Use Homebrew:
  • brew install nmap

Basic Syntax

The basic syntax for Nmap commands is as follows:

nmap [options] [target]

Discovery

Use Nmap to identify active devices on a network:

nmap -sn 192.168.1.0/24

Explanation:

Flag Description
-sn Ping scan (no port scan)

Scanning

To perform a standard TCP scan:

nmap 192.168.1.1

For more aggressive scanning with service version detection:

nmap -A 192.168.1.1

Exploitation

Nmap alone does not exploit vulnerabilities, but it can help identify targets for exploitation.

Analysis

Generate detailed scan reports using:

nmap -sV -oN output.txt 192.168.1.1

This command saves the output in a normal text file format.

Evasion

Obfuscate the scan to avoid detection:

nmap -D RND:10 192.168.1.1

Explanation:

The -D flag uses decoy mode, generating fake origins to confuse intrusion detection systems.

Reporting

To output in XML format for automated processing:

nmap -oX report.xml 192.168.1.1

Quick Reference Table

Flag Description
-pn Skip host discovery
-p Specify ports to scan
-T Timing template (0-5)
-sP Ping scan
-sV Service version detection

Pro Tips

  • Combine options for comprehensive scans, e.g., nmap -sS -sV -p 1-65535 -T4 192.168.1.1 for a fast, stealthy full port scan.
  • Use –script to execute Nmap scripts for additional functionality.
  • Explore the Nmap Scripting Engine (NSE) for automation and complex scanning activities.

Real-World Examples

Nmap is widely used by penetration testers to map target networks:

nmap -sS -sV -O -p 80,443 192.168.1.0/24

This command includes OS detection (-O), checking HTTP and HTTPS ports on an entire subnet.