PSNetMap
Generating accurate network diagrams from Nmap scans instead of guesswork
The Problem
Network documentation ages like milk. The Visio diagram from six months ago? It's fiction now.
- Manual diagrams become stale within weeks of creation
- Commercial tools (SolarWinds, Auvik) have licensing costs that don't fit every budget
- Lansweeper had device inventory but no visual topology
- Traceroute alone couldn't map L2 topology or switch interconnects
- Output needed to match existing draw.io documentation standards
Documentation debt accumulated until infrastructure changes became invisible. New engineers had to rediscover the network every time.
Solution Architecture
Multi-Source Discovery
Combines Nmap scanning, SNMP CDP/LLDP neighbor walking, ARP table parsing, and ICMP sweeps. Each method fills gaps the others miss.
Hierarchical Layout
Automatic core/distribution/access/endpoint layer positioning. Y-coordinate from hop distance, X-coordinate from VLAN grouping.
Edge Deduplication
Normalizes source/target pairs to prevent A→B and B→A duplicates. Schema supports confidence levels per edge for future verification workflows.
draw.io Export
Generates valid mxGraph XML that opens cleanly. Color-coded by role, labeled with hostname and IP, editable for manual refinement.
Discovery Pipeline
Module Architecture
Key Features
Role Inference from Ports
Identifies device types from open ports: SSH + SNMP = network gear, RDP/WinRM = Windows server, HTTP/HTTPS = web server or appliance. Assigns network layer for hierarchical layout.
Manual Review Support
Web UI for manual entry of devices that can't be discovered: air-gapped systems, firewalled hosts, infrastructure not yet deployed. Schema tracks confidence levels per device.
CMDB-Ready JSON Export
Structured output with node inventory, edge list with confidence scores, subnet metadata, and discovery timestamps. Import directly into asset management systems.
Results
| Metric | Before | After |
|---|---|---|
| Documentation freshness | Months old | Generated on-demand |
| Time to create topology | 4-8 hours manual | 30 minutes |
| Accuracy | ~70% (missed changes) | ~95% (verified discovery) |
| Format compatibility | Locked in Visio | Open draw.io format |
Technologies
Lessons Learned
Start with what you have
Importing Lansweeper data gave 80% coverage before any active scanning. Don't reinvent existing inventory.
SNMP beats traceroute
CDP/LLDP neighbor tables are authoritative for L2 topology. Traceroute only shows L3 paths.
70% now beats 100% never
A diagram that needs manual cleanup is infinitely more useful than waiting for perfect automation.
mxGraph XML is simple
Draw.io's format is straightforward once you understand geometry positioning. Don't overthink it.