Gnmap-Parser turns one or more Nmap greppable (.gnmap) scan files into small,
analysis-friendly host lists, port lists, per-port files, and service matrices.
This repository is a modernized continuation of Michael Wright's original
Gnmap-Parser, whose simple output
layout remains useful in penetration-testing and network-inventory workflows.
The original Gnmap-Parser established a practical workflow: give it Nmap greppable output and receive focused lists that can be passed directly to other command-line tools. That core idea still works well, so this revamp preserves the recognizable command and legacy output filenames instead of replacing the project with a dependency-heavy rewrite.
The original Bash implementation had not been updated since 2013 and carried assumptions that no longer fit many current workflows. In particular, timestamp-prefixed Nmap records could leak into parsed results, matrices could accumulate duplicate rows across runs, input files had to be gathered into the working directory, paths were not safely quoted, sorting assumed IPv4, and recursive discovery errors could silently produce incomplete output.
Gnmap-Parser Revamped addresses those problems while keeping the tool small, auditable, portable, and compatible with existing usage wherever practical. It is intended as a respectful continuation of the original project—not a claim of original authorship.
Nmap has deprecated greppable output in favor of XML. This project remains useful for existing workflows and archives that produce
.gnmapfiles.
- No timestamps or scan metadata are included in generated files.
- Inputs may be files or directories, and directories are searched recursively.
- Paths containing spaces are supported.
- Repeated runs are idempotent; matrices no longer accumulate duplicate rows.
- Legacy port files and matrices deduplicate endpoints even when scans disagree about the detected service; the CSV retains each distinct service result.
- IPv4, IPv6, and hostnames are preserved with deterministic sorting.
- Only exact
openTCP/UDP states are included (open|filteredis excluded). - Existing v3 filenames remain available, with a correctly named
Alive-Hosts-Up.txtadded alongside the legacy ICMP filename. Open-Services.csvadds a header and detected service names.- Gather mode refuses to silently overwrite same-named scans.
- Clear exit codes and non-interactive command-line options make automation easy.
- Bash 3.2 or newer
- Standard Unix tools:
awk,find,sort,cp, andcmp
It works on current macOS and Linux without third-party packages.
Parse every .gnmap file below the current directory:
./Gnmap-Parser.sh --parseParse specific files or directories and choose an output location:
./Gnmap-Parser.sh --parse scans/ office-scan.gnmap --output resultsThe original short parse switch still works:
./Gnmap-Parser.sh -pGather scans into a directory without parsing them:
./Gnmap-Parser.sh --gather archived-scans --output gatheredRun ./Gnmap-Parser.sh --help for all options.
Gnmap-Parser/
├── Host-Lists/
│ ├── Alive-Hosts-Up.txt
│ ├── Alive-Hosts-ICMP.txt # v3 compatibility alias
│ └── Alive-Hosts-Open-Ports.txt
├── Port-Lists/
│ ├── TCP-Ports-List.txt
│ └── UDP-Ports-List.txt
├── Port-Files/
│ └── Port-<port>-<TCP|UDP>.txt
└── Port-Matrix/
├── TCP-Services-Matrix.txt # port,protocol,host
├── UDP-Services-Matrix.txt
└── Open-Services.csv # host,port,protocol,service
Host lists come from Nmap Host: records. Alive-Hosts-Up.txt represents
records containing Status: Up; Nmap may determine that state by means other
than ICMP. The older Alive-Hosts-ICMP.txt name is retained only so existing
scripts do not break.
Each parse replaces the four generated subdirectories in the selected output directory. Keep hand-written files elsewhere.
Scan inputs and generated host, port, and service inventories can identify
client systems. The parser applies umask 077, creating output directories and
files for the invoking user only. Preserve those permissions when copying data,
and never commit real assessment inputs or generated output. The repository
ignores *.gnmap plus the common Gnmap-Parser/, results/, and gathered/
output directories as an additional guard against accidental publication.
./tests/test.shGnmap-Parser was originally created by Michael Wright and published at jasonjfrank/gnmap-parser. The original Git history is retained so its development and authorship remain visible.
This revamped version is distributed under GPL-3.0-or-later, consistent with
the original project. The original copyright notice and complete license are
preserved in COPYING.
Process scan data only when you are authorized to possess and use it. You are responsible for protecting potentially sensitive target information and for complying with applicable laws, contracts, and assessment rules.
This program is provided without warranty, and liability is limited to the fullest extent permitted by applicable law. See sections 15 through 17 of the GNU General Public License v3 for the complete warranty and liability terms. This usage notice does not modify or restrict the license.