πΊοΈ 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
| Type | Color | Description |
|---|---|---|
| Gateway | Green | Default gateway/router |
| Router/AP | Orange | Additional routers, access points |
| Switch | Purple | Network switches |
| Host | Blue | Computers, phones, devices |
| Unknown | Gray | Unidentified 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.