πŸ—ΊοΈ Network Topology

Visualize your network structure as ASCII art, interactive HTML diagrams, or DOT/Graphviz exports.

New in v2.1.0: Network topology mapping provides visual understanding of your network layout.

Quick Start

Access topology mapping from the interactive menu:

netscan
# Press 'y' for Network Topology

Output Formats

ASCII Art (Terminal)

python3 helpers/topology.py --scan --ascii
======================================================================
  NETWORK TOPOLOGY
======================================================================

                        ☁️  INTERNET
                            β”‚
                            β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚   🌐 GATEWAY  β”‚
                    β”‚ 192.168.1.1   β”‚
                    β”‚ A4:91:B1:XX:XXβ”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
                            β”‚
        ────────────────────┼────────────────────
                      LOCAL NETWORK

  πŸ“‘ ROUTERS/APs:
    β”œβ”€β”€ 192.168.1.2       TP-Link Access Point

  πŸ’» HOSTS:
    β”œβ”€β”€ 192.168.1.10      Apple, Inc.
    β”œβ”€β”€ 192.168.1.15      Dell Inc.
    β”œβ”€β”€ 192.168.1.20      Samsung Electronics
    └── 192.168.1.25      Unknown

======================================================================
  Total devices: 5 | Gateway: 192.168.1.1
======================================================================

Interactive HTML

python3 helpers/topology.py --scan --html --output topology.html

Creates an interactive diagram using vis.js that you can:

  • πŸ–±οΈ Drag nodes to rearrange
  • πŸ” Zoom in/out with scroll
  • ℹ️ Hover for device details
  • πŸ“± Responsive for mobile viewing

DOT/Graphviz

# Generate DOT file
python3 helpers/topology.py --scan --dot --output network.dot

# Render with Graphviz
dot -Tpng network.dot -o network.png
dot -Tsvg network.dot -o network.svg
dot -Tpdf network.dot -o network.pdf

JSON Export

python3 helpers/topology.py --scan --json --output topology.json

CLI Reference

# From existing scan results
python3 helpers/topology.py --input scan.json --ascii

# Fresh network scan
python3 helpers/topology.py --scan --html --output map.html

# All options
python3 helpers/topology.py \
    --input scan.json \    # Use existing scan data
    --scan \               # Or perform fresh scan
    --ascii \              # ASCII art output
    --dot \                # DOT/Graphviz output
    --html \               # Interactive HTML
    --json \               # JSON structure
    --output FILE          # Save to file

Node Types & Colors

TypeColorDescription
GatewayGreenDefault gateway/router
Router/APOrangeAdditional routers, access points
SwitchPurpleNetwork switches
HostBlueComputers, phones, devices
UnknownGrayUnidentified devices

Python API

from helpers.topology import TopologyMapper

# Create mapper
mapper = TopologyMapper()

# Build from device list
devices = [
    {"ip": "192.168.1.1", "mac": "AA:BB:CC:DD:EE:FF", "vendor": "Cisco"},
    {"ip": "192.168.1.10", "mac": "11:22:33:44:55:66", "vendor": "Apple"},
]

topology = mapper.build_topology(devices)

# Render outputs
ascii_art = mapper.render_ascii()
html = mapper.render_html()
dot = mapper.render_dot()

# Access topology data
print(f"Gateway: {topology.gateway.ip}")
print(f"Nodes: {len(topology.nodes)}")
πŸ’‘ Tip: For best results, run a full network scan first to get MAC addresses and vendor information, then generate the topology from those results.