📱 Mobile Security Tips

Sarah Chen — iOS Security Specialist

{
“title”: “Mastering Nmap: A Comprehensive Usage Cheatsheet”,
“content”: “

What is Nmap?

Nmap (Network Mapper) is a powerful open-source tool for network discovery and security auditing. It is widely used by security professionals to discover hosts and services on a computer network, thus creating a ‘map’ of the network. Nmap can also detect operating systems, versions, and vulnerabilities of devices on the network.

Installation

Nmap can be installed on various platforms:

  • Linux: Use package managers
    sudo apt install nmap (Debian/Ubuntu) or
    sudo yum install nmap (CentOS/Fedora)
  • Windows: Download the installer from the official Nmap website.
  • macOS: Use Homebrew with
    brew install nmap

Basic Syntax

The basic syntax to run Nmap is as follows:

nmap [options] [target]

Discovery

Ping Scan

Quickly determine the availability of hosts in a network.

nmap -sn 192.168.1.0/24

Service Version Detection

Identify the service versions running on discovered ports.

nmap -sV 192.168.1.10

Scanning

TCP Scan

Conduct a TCP connect scan on a target machine.

nmap -sT 192.168.1.10

Stealth Scan

A more discreet scanning method that avoids detection.

nmap -sS 192.168.1.10

Exploitation

Scriptable Scanning

Utilize Nmap’s scripting engine to automate tasks.

nmap --script=banner 192.168.1.10

Analysis

Output Options

Generate output in different formats for further analysis.

Flag Description
-oN Normal output
-oX XML output
-oG Grepable output

Evasion

Fragmentation

Split packets to avoid detection by firewalls.

nmap -f 192.168.1.10

Decoy Scan

Perform a scan that masks your real IP behind several decoy IPs.

nmap -D RND:5 192.168.1.10

Reporting

Combine Output Formats

Combine output formats for detailed reports.

nmap -oA report_name 192.168.1.10

Quick Reference Table

Flag Description
-sn Ping scan
-sV Service version detection
-sT TCP connect scan
-sS Stealth SYN scan
–script Run Nmap scripts
-oN Normal output report
-oX XML output report
-oG Grepable output report
-f Fragment packets
-D Decoy scan
-oA Output in all formats

Pro Tips

  • Use Nmap with a range: Scan multiple hosts using CIDR or a simple range
    nmap 192.168.1.1-50
  • Run Nmap in background: Use & to run processes in the background.
  • Use grep with Nmap: Combine Nmap with grep for quick filtering
    nmap -sS 192.168.1.0/24 | grep open

Real-World Examples

Scanning a web server and service enumeration:

nmap -sS -sV -p 80,443 192.168.1.10

Combining output into different formats for reporting: