# unspecific/nmap-tools architecture

> Architecture diagram of the GitHub repository unspecific/nmap-tools, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/unspecific/nmap-tools
- Repository: https://github.com/unspecific/nmap-tools

## Overview

This repository is a small toolkit of standalone Perl command-line utilities built around `nmap` scan output. The architecture is not a single application but a set of loosely coupled scripts that each operate on scan results and text logs.

At the center is the `nmap-wrapper` script. Its role is to invoke `nmap`, manage scanning of target IPs, and produce output in a form that the other tools can consume. In practice, this is the acquisition layer for the whole toolkit.

`nmap-diff` is the change-detection layer. It compares scan results over time and reports newly opened ports, making it the main “delta” analysis component. This is useful for spotting exposure changes between scans rather than inspecting raw results manually.

`nmap-report` is the aggregation/reporting layer. It generates lists of hosts with a specific port open, or groups of hosts by port or by all open ports. Its outputs are meant to be machine- or human-readable lists that can be piped into other command-line tools.

`nmap-search` is the query layer for historical scan logs. It searches log data for matches, acting as a text-oriented retrieval tool over the stored nmap results rather than re-running scans.

`nmap-graph` is the visualization-oriented component. Based on its name and placement in the toolkit, it likely transforms scan data into a graphable representation, complementing the reporting and search tools with a relationship-oriented view of hosts and ports.

The repository also includes `nmap-oG-output.txt`, which appears to be an example or sample output file in nmap’s grepable/output-oriented format. This suggests the tools are designed around plain-text parsing rather than a database or service backend.

The main data flow is linear and file-based: `nmap-wrapper` produces scan output, which is then fed into `nmap-diff`, `nmap-search`, `nmap-report`, and `nmap-graph` depending on the task. There is no indication of a central server, persistent application state, or API layer.

The primary architectural boundary is between raw network scanning and post-processing. `nmap` performs the active discovery, while the repo’s scripts consume text output and turn it into reports, comparisons, searches, or graphable data.

The runtime dependency is Perl, plus the external `nmap` binary. Because these are CLI tools, they are intended to be composed in shell pipelines and batch jobs rather than called as in-process modules.

Operationally, this toolkit is suited to scheduled or repeated scanning workflows. That makes scan history and output format consistency important, because the downstream tools depend on stable text artifacts rather than live integration with `nmap`.

Overall, the repository is best understood as a command-line analysis pipeline around `nmap`: scan, diff, search, report, and visualize. An architecture diagram should show these as separate utilities connected by files/streams, with `nmap` as the external scanning engine at the front of the pipeline.

Main entry points: [`nmap-wrapper/nmap-wrapper.pl`](https://github.com/unspecific/nmap-tools/blob/master/nmap-wrapper/nmap-wrapper.pl) (nmap-wrapper), [`nmap-oG-output.txt`](https://github.com/unspecific/nmap-tools/blob/master/nmap-oG-output.txt) (oG sample), [`nmap-report/nmap-report.pl`](https://github.com/unspecific/nmap-tools/blob/master/nmap-report/nmap-report.pl) (nmap-report), [`nmap-diff/nmap-diff.pl`](https://github.com/unspecific/nmap-tools/blob/master/nmap-diff/nmap-diff.pl) (nmap-diff)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli_tools["CLI tools"]
  node_nmap_wrapper["nmap-wrapper<br/>scanner<br/>[nmap-wrapper.pl]"]
  node_nmap_diff["nmap-diff<br/>delta analyzer<br/>[nmap-diff.pl]"]
  node_nmap_report["nmap-report<br/>reporter<br/>[nmap-report.pl]"]
  node_nmap_search["nmap-search<br/>log search<br/>[nmap-search.pl]"]
  node_nmap_graph["nmap-graph<br/>visualizer<br/>[nmap-graph.pl]"]
end

subgraph group_data["Text data"]
  node_sample_output["oG sample<br/>grepable output<br/>[nmap-oG-output.txt]"]
end

subgraph group_external["External engine"]
  node_nmap_engine["nmap<br/>external scanner"]
end

node_nmap_engine -->|"scan results"| node_nmap_wrapper
node_nmap_wrapper -->|"writes"| node_sample_output
node_sample_output -->|"compare"| node_nmap_diff
node_sample_output -->|"summarize"| node_nmap_report
node_sample_output -->|"search"| node_nmap_search
node_sample_output -->|"visualize"| node_nmap_graph
node_nmap_wrapper -.->|"feeds"| node_nmap_diff
node_nmap_wrapper -.->|"feeds"| node_nmap_report
node_nmap_wrapper -.->|"feeds"| node_nmap_search
node_nmap_wrapper -.->|"feeds"| node_nmap_graph
node_nmap_diff -.->|"changes"| node_nmap_report
node_nmap_search -.->|"matches"| node_nmap_report

click node_nmap_wrapper "https://github.com/unspecific/nmap-tools/blob/master/nmap-wrapper/nmap-wrapper.pl"
click node_nmap_diff "https://github.com/unspecific/nmap-tools/blob/master/nmap-diff/nmap-diff.pl"
click node_nmap_report "https://github.com/unspecific/nmap-tools/blob/master/nmap-report/nmap-report.pl"
click node_nmap_search "https://github.com/unspecific/nmap-tools/blob/master/nmap-search/nmap-search.pl"
click node_nmap_graph "https://github.com/unspecific/nmap-tools/blob/master/nmap-graph/nmap-graph.pl"
click node_sample_output "https://github.com/unspecific/nmap-tools/blob/master/nmap-oG-output.txt"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_nmap_wrapper,node_nmap_diff,node_nmap_report,node_nmap_search,node_nmap_graph toneBlue
class node_sample_output toneAmber
class node_nmap_engine toneMint
```

## Components

### CLI tools

Standalone Perl utilities for scanning and post-processing

- [nmap-wrapper](https://github.com/unspecific/nmap-tools/blob/master/nmap-wrapper/nmap-wrapper.pl): scanner · Invokes nmap and produces reusable scan output · `nmap-wrapper/nmap-wrapper.pl`
- [nmap-diff](https://github.com/unspecific/nmap-tools/blob/master/nmap-diff/nmap-diff.pl): delta analyzer · Compares scans and reports newly opened ports · `nmap-diff/nmap-diff.pl`
- [nmap-report](https://github.com/unspecific/nmap-tools/blob/master/nmap-report/nmap-report.pl): reporter · Aggregates hosts and ports into lists and groups · `nmap-report/nmap-report.pl`
- [nmap-search](https://github.com/unspecific/nmap-tools/blob/master/nmap-search/nmap-search.pl): log search · Queries historical scan logs for text matches · `nmap-search/nmap-search.pl`
- [nmap-graph](https://github.com/unspecific/nmap-tools/blob/master/nmap-graph/nmap-graph.pl): visualizer · Transforms scan data into graph-oriented output · `nmap-graph/nmap-graph.pl`

### Text data

Scan outputs and sample artifacts consumed by the tools

- [oG sample](https://github.com/unspecific/nmap-tools/blob/master/nmap-oG-output.txt): grepable output · Example nmap text output used as a parsing reference · `nmap-oG-output.txt`

### External engine

Non-repo runtime dependency

- **nmap**: external scanner · External network scanning binary used by the wrapper

## Connections

- nmap → nmap-wrapper: scan results · Wrapper runs the external scanner and captures its output
- nmap-wrapper → oG sample: writes · Produces text artifacts in a format the other tools can consume
- oG sample → nmap-diff: compare · Diff consumes saved scan output to detect changes over time
- oG sample → nmap-report: summarize · Report reads scan output to build host and port listings
- oG sample → nmap-search: search · Search queries historical scan logs and text artifacts
- oG sample → nmap-graph: visualize · Graph transforms scan data into relationship-oriented views
- nmap-wrapper → nmap-diff: feeds · New scans become inputs to delta analysis
- nmap-wrapper → nmap-report: feeds · Fresh scan output can be summarized directly
- nmap-wrapper → nmap-search: feeds · Generated logs are searchable by downstream tools
- nmap-wrapper → nmap-graph: feeds · Scan output can be converted into graphable data
- nmap-diff → nmap-report: changes · Reported port deltas can be incorporated into summaries
- nmap-search → nmap-report: matches · Search results can be piped into report-style workflows
