Infrastructure 2024

PSNetMap

Generating accurate network diagrams from Nmap scans instead of guesswork

87% Time Saved
95% Accuracy
Open Format

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

Diagram: Discovery pipeline from seed inventory through scanning, inference, enrichment, layout, and draw.io export INPUT DISCOVERY PROCESSING OUTPUT Lansweeper CSV Export JSON Manual Entry Web UI HTTP :8080 SNMP CDP/LLDP Neighbors Nmap -sV -O XML Parse ARP Local Subnet Ping CIDR Sweep Inference Role Detection Deduplication Enrichment rDNS Lookup Confidence Layout Y = Layer X = VLAN .drawio .json Console Prioritized: SNMP > Nmap > ARP > Ping

Module Architecture

Diagram: PSNetMap module structure showing public functions, private helpers, and class hierarchy PSNetMap.psm1 CLASSES Network Device .IP .Role .Layer Network Edge .GetKey() Topology .Nodes .Edges PUBLIC Import-...Inventory Get-...Discovery Export-...JSON Export-...DrawIO Start-...WebUI PRIVATE Invoke-NmapDiscovery Invoke-SnmpDiscovery Invoke-ArpDiscovery Invoke-PingDiscovery Parse-NmapXml Get-DeviceRoleFromPorts Get-IPsFromCIDR Get-DrawIOStyle Get-WebUIHtml

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

PowerShell 5.1+ Nmap Net-SNMP draw.io XML JSON HTML/JavaScript

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.