📱 Mobile Security Tips

Sarah Chen — iOS Security Specialist

{
“title”: “Nmap Security Tool Cheatsheet”,
“content”: “

What is Nmap?

Nmap (Network Mapper) is a powerful open-source tool used for network discovery and security auditing. It is widely used by security analysts and penetration testers to identify live hosts, open ports, and services on a network, as well as to detect vulnerabilities.

Installation

Nmap is available on multiple platforms including Windows, Linux, and macOS. You can download it from the official Nmap website or install it using package managers.

  • On Debian/Ubuntu: sudo apt install nmap
  • On Red Hat/Fedora: sudo dnf install nmap
  • On macOS: brew install nmap

Basic Syntax

The basic syntax of Nmap is:

nmap [options] [target]

Network Discovery

Identify Live Hosts

nmap -sn 192.168.1.0/24

This command performs a simple ping scan to identify live hosts in the 192.168.1.0 subnet. The flag -sn tells Nmap to skip port scanning and only discover hosts.

Service Version Detection

nmap -sV 192.168.1.1

This command detects service versions running on open ports of the target 192.168.1.1. The -sV flag enables version detection.

Scanning

Port Scanning

nmap -p 1-65535 192.168.1.1

This command scans all TCP ports on the host 192.168.1.1. The -p flag specifies the range of ports to scan.

TCP SYN Scan

nmap -sS 192.168.1.1

This initiates a SYN scan, which is stealthier than a full TCP connect scan. The -sS flag stands for SYN scan.

Exploitation

OS Detection

nmap -O 192.168.1.1

This command attempts to determine the operating system and version running on the target. The -O flag enables OS detection.

Analysis

Output Formats

nmap -oN output.txt 192.168.1.1

This command saves the scan results in a normal text file. The -oN flag specifies the output format.

XML Output

nmap -oX output.xml 192.168.1.1

This saves the results in XML format, enabling easier integration with other tools. Use -oX for XML output.

Evasion

Decoy Scan

nmap -D RND:10 192.168.1.1

This command uses random decoys to obfuscate the real source of the scan. The -D flag is used for decoy scanning.

Timing Templates

nmap -T4 192.168.1.1

Using timing templates can speed up scans. -T4 is a faster scan compared to default (which is -T3).

Reporting

Combined Output

nmap -oA output 192.168.1.1

This command saves the scan results in all available formats (normal, XML, and grepable). The -oA flag is used to specify combined output file base.

Quick Reference Table

Flag Description
-sn Ping scan to discover hosts
-sV Version detection
-p Target port range
-sS SYN scan
-O OS detection
-oN Normal output
-oX XML output
-D Decoy scanning
-T Timing template
-oA All outputs

Pro Tips

  • Use the -p- option to scan all ports quickly.
  • Combine -T5 with -p- for fast scans on known networks, but beware of overwhelming targets.
  • Profile your scans for large networks by saving them to a specific output file for later analysis.

Real-World Examples

Complete Network Inventory

nmap -sP 192.168.1.0/24 -oN network_inventory.txt

This command provides a complete inventory of all hosts on a local subnet, saving the results to a text file.

Vulnerability Assessment Scan

nmap -sS -sV -O -p- target.com

This command executes a comprehensive vulnerability assessment scan to discover open ports, service versions, and operating system type on target.com.

“,
“keywords”: [“Nmap”, “network security