π± Mobile Security Tips
Sarah Chen — iOS Security Specialist
What is Nmap?
Nmap (Network Mapper) is an open-source tool for network exploration and security auditing. It’s used for discovering hosts and services on a computer network by sending packets and analyzing the responses. Nmap is a crucial tool in the toolkit of any security analyst or penetration tester.
Installation
To install Nmap, you can use the following commands based on your operating system:
sudo apt install nmap(Debian/Ubuntu)brew install nmap(macOS)choco install nmap(Windows)
Basic Syntax
The basic syntax for running Nmap is:
nmap [options] [target]
Discovery
Scan a Single Host
nmap 192.168.1.1
Scan a Range of IPs
nmap 192.168.1.1-50
Scan a Subnet
nmap 192.168.1.0/24
Scanning
TCP Connect Scan
nmap -sT 192.168.1.1
Stealth SYN Scan
nmap -sS 192.168.1.1
Service Version Detection
nmap -sV 192.168.1.1
OS Detection
nmap -O 192.168.1.1
Exploitation
Scan for Vulnerabilities
nmap --script=vuln 192.168.1.1
Analysis
Output Results to a File
nmap -oN output.txt 192.168.1.1
XML Output
nmap -oX output.xml 192.168.1.1
Evasion
Changing the Source Port
nmap -g 53 192.168.1.1
Using a Randomized Target Scan
nmap -r 192.168.1.0/24
Reporting
Create a Summary of the Scan
nmap -A -T4 192.168.1.1
Verbose Output
nmap -v 192.168.1.1
Quick Reference Table
| Flag | Description |
|---|---|
| -sS | SYN scan (stealth) |
| -sT | TCP connect scan |
| -O | Enable OS detection |
| -sV | Service version detection |
| -oN | Normal output to a file |
| –script=vuln | Scan for vulnerabilities |
Pro Tips
- Use Timing Templates: Adjust Nmap’s speed to avoid detection:
-T0 to -T5. - Exclude Hosts: To focus on specific targets, exclude IPs using
--exclude.
Real-World Examples
When you need to quickly detect operating systems in a subnet:
nmap -O 192.168.1.0/24
When assessing service versions across multiple hosts:
nmap -sV -oN services.txt 192.168.1.1-50