> For the complete documentation index, see [llms.txt](https://riteshs4hu.gitbook.io/infosec-notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://riteshs4hu.gitbook.io/infosec-notes/reconnaissance/active-reconnaissance-approach/nmap/output-formats.md).

# Output Formats

**Nmap Output Formats and Options**

Nmap provides output in various formats to accommodate different use cases, making it easier for network administrators and security analysts to interpret scan results. The output can be customized to display specific details, and Nmap supports multiple formats, including plain text, XML, and HTML.

#### **1. Output Options**

Nmap allows users to save scan results in different formats using specific options:

| Option | Format Type   | Description                                                       |
| ------ | ------------- | ----------------------------------------------------------------- |
| `-oN`  | Normal        | Human-readable output format                                      |
| `-oX`  | XML           | Machine-readable format suitable for automated processing         |
| `-oS`  | Script Kiddie | A stylized variation of normal format                             |
| `-oG`  | Grepable      | Designed for easy parsing with Unix tools like `grep` and `awk`   |
| `-oA`  | Aggregate     | Saves results in Normal, XML, and Grepable formats simultaneously |

#### Common Output Options

**1. Normal Output (`-oN`)**

The `-oN` option saves the results in normal format, which is human-readable and easy to understand.

**Example Commands:**

```bash
nmap --top-ports 100 192.168.1.1/24 -oN scan-results.txt
```

```bash
nmap --top-ports 100 example.com -oN scan-results.txt
```

```bash
nmap -sn -PU 192.168.1.1/24 -oN scan-results.txt
```

```bash
nmap -v -p0–65535 192.168.1.1 -oN scan-results.txt
```

```bash
nmap -v -p T:80,443,U:53,111 192.168.1.1 -oN scan-results.txt
```

**2. XML Output (`-oX`)**

The `-oX` option saves the results in XML format, which is machine-readable and can be easily processed by other tools.

**Example Commands:**

```bash
nmap --top-ports 100 192.168.1.1/24 -oX scan-results.xml
```

```bash
nmap --top-ports 100 example.com -oX scan-results.xml
```

```bash
nmap -sn -PU 192.168.1.1/24 -oX scan-results.xml
```

```bash
nmap -v -p0–65535 192.168.1.1 -oX scan-results.xml
```

```bash
nmap -v -p T:80,443,U:53,111 192.168.1.1 -oX scan-results.xml
```

**3. Script Kiddie Output (`-oS`)**

The `-oS` option saves the results in `s|<rIpt kIddi3` format, which is similar to the normal format but designed to be easily parsed by scripts.

**Example Commands:**

```bash
nmap --top-ports 100 192.168.1.1/24 -oS scan-results.txt
```

```bash
nmap --top-ports 100 example.com -oS scan-results.txt
```

```bash
nmap -sn -PU 192.168.1.1/24 -oS scan-results.txt
```

```bash
nmap -v -p0–65535 192.168.1.1 -oS scan-results.txt
```

```bash
nmap -v -p T:80,443,U:53,111 192.168.1.1 -oS scan-results.txt
```

**4. Grepable Output (`-oG`)**

The `-oG` option saves the results in Grepable format, which is designed to be easily parsed by Unix tools like `grep` and `awk`.

**Example Commands:**

```bash
nmap --top-ports 100 192.168.1.1/24 -oG scan-results.txt
```

```bash
nmap --top-ports 100 example.com -oG scan-results.txt
```

```bash
nmap -sn -PU 192.168.1.1/24 -oG scan-results.txt
```

```bash
nmap -v -p0–65535 192.168.1.1 -oG scan-results.txt
```

```bash
nmap -v -p T:80,443,U:53,111 192.168.1.1 -oG scan-results.txt
```

#### Combined Output Formats

**`-oA <basename>`**

The `-oA` option saves the results in all three major formats (normal, XML, and Grepable) at once. This is useful for maintaining multiple copies of the results in different formats or comparing them.

**Example Commands:**

```bash
nmap --top-ports 100 192.168.1.1/24 -oA scan-results
```

```bash
nmap --top-ports 100 example.com -oA scan-results
```

```bash
nmap -sn -PU 192.168.1.1/24 -oA scan-results
```

```bash
nmap -v -p0–65535 192.168.1.1 -oA scan-results
```

```bash
nmap -v -p T:80,443,U:53,111 192.168.1.1 -oA scan-results
```
