Skip to content

This Repository is a collection of different ethical hacking tools and malware's for penetration testing and research purpose written in python, ruby, rust, c++, go and c.

Create The Phases of an Nmap Scan.md

Abdul Wahab Junaid75b1e2a8b106
diff --git a/Nmap/Nmap Commands/The Phases of an Nmap Scan.md b/Nmap/Nmap Commands/The Phases of an Nmap Scan.md
new file mode 100644
index 0000000..16ec68a
--- /dev/null
+++ b/Nmap/Nmap Commands/The Phases of an Nmap Scan.md
@@ -0,0 +1,73 @@
+An Nmap scan typically goes through several distinct phases, each of which plays a specific role in discovering and reporting information about the target network or system. Here’s an overview of the primary phases of an Nmap scan:
+
+### 1. **Target Enumeration**
+
+ - **Description**: This is the initial phase where Nmap identifies the target IP addresses or hostnames. It also determines whether it needs to perform DNS resolution (if hostnames are used).
+ - **Key Option**: `-sL` lists the targets without scanning.
+
+### 2. **Host Discovery**
+
+ - **Description**: During this phase, Nmap checks if the target hosts are live (responsive) to avoid wasting time scanning inactive hosts.
+ - **Techniques**:
+ - **Ping Sweep**: Sends ICMP echo requests (similar to `ping`) to check if hosts are up.
+ - **TCP ACK/SYN Probe**: Sends TCP packets to specific ports (like 80) to test response.
+ - **ARP Requests** (on local networks): More effective on local networks as ARP responses confirm live hosts without firewalls blocking the pings.
+ - **Key Options**: `-sn` (Ping scan to discover hosts without scanning ports), `-Pn` (Skip host discovery and assume hosts are up).
+
+### 3. **Port Scanning**
+
+ - **Description**: In this phase, Nmap scans the open, closed, or filtered ports on each live host to identify services running.
+ - **Techniques**:
+ - **TCP SYN Scan** (`-sS`): The most popular scan type, often called a "half-open" scan because it only sends a SYN packet without completing the TCP handshake.
+ - **TCP Connect Scan** (`-sT`): Completes the TCP handshake and is useful when SYN scans aren’t possible.
+ - **UDP Scan** (`-sU`): Scans for open UDP ports but is slower than TCP scanning.
+ - **Key Options**: `-p` (Specify port range), `-F` (Fast scan for fewer ports).
+
+### 4. **Service Version Detection**
+
+ - **Description**: Nmap attempts to determine the version of services running on each open port. Knowing service versions can help in identifying potential vulnerabilities.
+ - **Method**: Sends various probes to open ports and analyzes the responses to match them with known signatures.
+ - **Key Option**: `-sV`
+
+### 5. **Operating System (OS) Detection**
+
+ - **Description**: Nmap tries to determine the operating system and version running on each live host by analyzing network responses.
+ - **Method**: Uses a series of TCP, UDP, and ICMP packets to measure unique characteristics in responses that correspond to specific operating systems.
+ - **Key Option**: `-O`
+
+### 6. **Script Scanning (NSE)**
+
+ - **Description**: Nmap's Scripting Engine (NSE) uses scripts to perform more detailed scans on each service and port, allowing for vulnerability detection, brute-force attacks, and more.
+ - **Method**: Runs pre-written scripts for tasks like detecting vulnerabilities, performing banner grabbing, and checking for misconfigurations.
+ - **Key Options**: `-sC` (Run default scripts), `--script <script-name>` (Specify scripts to run).
+
+### 7. **Traceroute (Optional)**
+
+ - **Description**: If enabled, Nmap will trace the route to the target to map out each hop along the path, providing insight into network topology.
+ - **Method**: Nmap sends a series of packets with varying TTL values to reveal each hop.
+ - **Key Option**: `--traceroute`
+
+### 8. **Output Generation**
+
+ - **Description**: In the final phase, Nmap compiles the gathered data and generates output in the format specified by the user.
+ - **Output Formats**:
+ - **Normal Output**: Standard text output.
+ - **XML Output**: For parsing by other tools.
+ - **Grepable Output**: Simplified format for easy searching and filtering.
+ - **Key Options**: `-oN` (Normal output), `-oX` (XML output), `-oG` (Grepable output).
+
+### Summary of Key Phases and Options
+
+Here's a quick command example that incorporates most of these phases:
+
+```bash
+nmap -sS -p 1-1000 -O -sV -sC --traceroute <target>
+```
+
+- **Explanation**:
+ - **`-sS`**: SYN scan for open ports.
+ - **`-p 1-1000`**: Scan the top 1000 ports.
+ - **`-O`**: OS detection.
+ - **`-sV`**: Service version detection.
+ - **`-sC`**: Run default scripts.
+ - **`--traceroute`**: Include traceroute to map network path.