📱 Mobile Security Tips
Sarah Chen — iOS Security Specialist
What is Nmap?
Nmap (Network Mapper) is an open-source tool used for network discovery and security auditing. It allows users to discover hosts, services, operating systems, and security vulnerabilities in their networks.
Installation
Nmap can be installed on various platforms. Here’s how:
- Linux: Use the package manager, e.g., for Ubuntu:
sudo apt install nmap - Windows: Download from the official website and follow the installation instructions.
- macOS: Use Homebrew:
brew install nmap
Basic Syntax
The basic syntax of Nmap is:
nmap [options] [targets]
Discovery
Host Discovery
nmap -sn [target]
This scans a specified target for live hosts without performing port scanning.
Service Discovery
nmap -sV [target]
This command detects the version of services running on open ports.
Scanning
TCP Syn Scan (Stealth Scan)
nmap -sS [target]
This performs a TCP SYN scan to identify open ports stealthily.
Full TCP Connect Scan
nmap -sT [target]
This command initiates a full TCP connection to the target ports.
Exploitation
Scriptable Interaction with Nmap
nmap --script [script] [target]
This allows you to run various scripts for vulnerability scanning, for example:
nmap --script vuln [target]
Analysis
OS Detection
nmap -O [target]
Use this option to determine the operating system of the target host.
Evasion
Change Source Port
nmap --source-port [port] [target]
Change the source port to bypass firewall rules.
Reporting
Output Formats
nmap -oN [filename] [target]
Save the output in a normal readable format.
Quick Reference Table
| Flag | Description |
|---|---|
| -sS | SYN scan |
| -sV | Service version detection |
| -O | OS detection |
| -A | Aggressive scan |
| –script | Run a specified Nmap script |
| -oN | Output in normal format |
Pro Tips
- Use the -Pn flag to skip host discovery if you know the host is up:
nmap -Pn [target] - Combine scans: For an efficient scan, combine service version and OS detection:
nmap -sV -O [target]
Real-World Examples
Full Scan: To perform a full scan on a target:
nmap -A -T4 [target]
This performs an aggressive scan with timing set to 4 for faster results.
Stealth Scan with Specific Ports:.
nmap -sS -p 22,80,443 [target]
This stealth scans specific commonly used ports.