Nmap Tutorial

 Nmap: A Powerful Tool for Network Scanning

  



Nmap (Network Mapper) is a powerful tool used for network scanning, connectivity testing, and security auditing. It is widely used to analyze network activity, detect open ports, and gather information about network devices. Nmap is one of the most popular tools in cybersecurity and ethical hacking.  

## **Definition of Nmap**  

Nmap is an **open-source tool** used for **network discovery** and **security auditing**. It is available for **Linux, Windows, macOS**, and even mobile platforms. Key uses include:  

- **Port scanning** (detecting open ports)  

- **Service detection** (identifying running services)  

- **OS fingerprinting** (determining the operating system)  

- **Vulnerability detection** (finding security weaknesses)  


---


## **Top 5 Nmap Scripts (NSE - Nmap Scripting Engine)**  

NSE (Nmap Scripting Engine) extends Nmap's capabilities for deeper scanning. There are **1000+ scripts** available:  


1. **`vuln`** – Detects vulnerabilities  

   ```bash

   nmap --script vuln <target>

   ```

2. **`http-enum`** – Scans webservers and directories  

   ```bash

   nmap --script http-enum <target>

   ```

3. **`dns-brute`** – Brute-forces DNS subdomains  

   ```bash

   nmap --script dns-brute <target>

   ```

4. **`smb-vuln-ms17-010`** – Checks for EternalBlue exploit  

   ```bash

   nmap --script smb-vuln-ms17-010 <target>

   ```

5. **`ssh-brute`** – Performs brute-force attacks on SSH  

   ```bash

   nmap --script ssh-brute <target>

   ```

---

## **Top 10 Nmap Commands**  

1. **Basic Scan**  

   ```bash

   nmap <target>

   ```

2. **Scan All Ports (1-65535)**  

   ```bash

   nmap -p- <target>

   ```

3. **Fast Scan (Top 100 Ports)**  

   ```bash

   nmap -F <target>

   ```

4. **OS & Service Detection**  

   ```bash

   nmap -A <target>

   ```

5. **Ping Sweep (Network Discovery)**  

   ```bash

   nmap -sn 192.168.1.0/24

   ```

6. **UDP Port Scan**  

   ```bash

   nmap -sU <target>

   ```

7. **Aggressive Scan (Intense Mode)**  

   ```bash

   nmap -T4 -A -v <target>

   ```

8. **Save Output to a File**  

   ```bash

   nmap -oN output.txt <target>

   ```

9. **Stealth Scan (SYN Scan)**  

   ```bash

   nmap -sS <target>

   ```

10. **Detect Firewall Rules**  

    ```bash

    nmap -sA <target>

    ```

---

## **Nmap Command-Line Interface (CLI)**  

Nmap operates via the **command-line** (Terminal). Key options include:  

-  -sS  → SYN scan (stealth)  

-  -sT  → TCP connect scan  

-  -O  → OS detection  

-  -sV  → Service version detection  

-  -Pn  → Skip host discovery (treat all hosts as online)  


**Example:**  

```bash

nmap -sS -sV -O -T4 192.168.1.1

```

---


## **Understanding Ports & Their Importance**  

Ports are like **"doors"** in a network, allowing traffic to pass through. **Common ports include:**  

- **Port 80** → HTTP (Web)  

- **Port 443** → HTTPS (Secure Web)  

- **Port 22** → SSH (Secure Shell)  

- **Port 21** → FTP (File Transfer)  

- **Port 3389** → RDP (Remote Desktop)  


**Why Ports Matter:**  

- **Security:** Open ports can be **security risks**.  

- **Service Management:** They indicate **running services**.  

- **Network Troubleshooting:** Helps in **diagnosing issues**.  

---


## **Additional Nmap Features**  

- **Zenmap** → GUI version of Nmap (for Windows/Linux).  

- **Nmap Scripting Engine (NSE)** → Allows **custom scripts**.  

- **Nmap Output Formats** ( -oN ,  -oX ,  -oG ) → Save scan results.  

- **Nmap Timing & Performance** ( -T0  to  -T5 ) → Adjust scan speed.  

### **Conclusion**  

Nmap is an **essential tool** for cybersecurity professionals, ethical hackers, and network admins. Learning how to **scan your network** helps protect against **hackers and cyber-attacks**.  


**If you want to master Nmap, explore cybersecurity courses and ethical hacking tutorials!** 🚀 

---

**Prepared by:** {Black Zaak /zakiiroy.blogspot.com}

Post a Comment

0 Comments