# 0xshun/network-scanner architecture

> Architecture diagram of the GitHub repository 0xshun/network-scanner, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/0xshun/network-scanner
- Repository: https://github.com/0xshun/network-scanner

## Overview

Network Scanner is a command-line host and network assessment tool. Its documented workflow parses a target and scan options, validates input, dispatches selected ICMP, TCP, and ARP scans, then formats the returned results. The scanner also performs packet-level work and returns per-scan status or discovered host data. A separate older root-level script implements ARP discovery. The graph reflects the excerpts and README; the older script’s banner invocation does not match the banner module’s defined capitalization, so that connection is not asserted.

Main entry points: [`src/scanner.py`](https://github.com/0xshun/network-scanner/blob/main/src/scanner.py) (Scan dispatcher), [`src/main.py`](https://github.com/0xshun/network-scanner/blob/main/src/main.py) (CLI and output), [`main.py`](https://github.com/0xshun/network-scanner/blob/main/main.py) (Legacy ARP script)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["Command line"]
  node_cli["CLI and output<br/>[main.py]"]
  node_input["Input parsing<br/>[main.py]"]
end

subgraph group_scan["Scan orchestration"]
  node_scanner["Scan dispatcher<br/>[scanner.py]"]
end

subgraph group_probes["Network probes"]
  node_icmp["ICMP probe<br/>[scanner.py]"]
  node_tcp["TCP port probe<br/>[scanner.py]"]
  node_arp["ARP discovery<br/>[scanner.py]"]
end

subgraph group_legacy["Legacy ARP tool"]
  node_legacy_entry["Legacy ARP script<br/>[main.py]"]
  node_banner["Banner display<br/>[banner.py]"]
end

node_operator(("Operator"))
node_network(("Target network"))

node_operator -->|"provides options"| node_cli
node_cli -->|"parses options"| node_input
node_cli -->|"starts scan"| node_scanner
node_scanner -->|"dispatches scan"| node_icmp
node_scanner -->|"dispatches scan"| node_tcp
node_scanner -->|"dispatches scan"| node_arp
node_icmp -->|"sends ICMP"| node_network
node_tcp -->|"sends TCP"| node_network
node_arp -->|"sends ARP"| node_network
node_scanner -->|"returns results"| node_cli
node_cli -->|"prints results"| node_operator
node_operator -.->|"runs legacy script"| node_legacy_entry
node_legacy_entry -->|"sends ARP"| node_network

click node_cli "https://github.com/0xshun/network-scanner/blob/main/src/main.py"
click node_input "https://github.com/0xshun/network-scanner/blob/main/src/main.py"
click node_scanner "https://github.com/0xshun/network-scanner/blob/main/src/scanner.py"
click node_icmp "https://github.com/0xshun/network-scanner/blob/main/src/scanner.py"
click node_tcp "https://github.com/0xshun/network-scanner/blob/main/src/scanner.py"
click node_arp "https://github.com/0xshun/network-scanner/blob/main/src/scanner.py"
click node_legacy_entry "https://github.com/0xshun/network-scanner/blob/main/main.py"
click node_banner "https://github.com/0xshun/network-scanner/blob/main/_imports_/banner.py"

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_cli,node_input toneBlue
class node_scanner toneAmber
class node_icmp,node_tcp,node_arp toneMint
class node_legacy_entry,node_banner toneRose
class node_operator,node_network toneIndigo
```

## Components

### Command line

- [CLI and output](https://github.com/0xshun/network-scanner/blob/main/src/main.py): `src/main.py`
- [Input parsing](https://github.com/0xshun/network-scanner/blob/main/src/main.py): `src/main.py`

### Scan orchestration

- [Scan dispatcher](https://github.com/0xshun/network-scanner/blob/main/src/scanner.py): `src/scanner.py`

### Network probes

- [ICMP probe](https://github.com/0xshun/network-scanner/blob/main/src/scanner.py): `src/scanner.py`
- [TCP port probe](https://github.com/0xshun/network-scanner/blob/main/src/scanner.py): `src/scanner.py`
- [ARP discovery](https://github.com/0xshun/network-scanner/blob/main/src/scanner.py): `src/scanner.py`

### Legacy ARP tool

- [Legacy ARP script](https://github.com/0xshun/network-scanner/blob/main/main.py): `main.py`
- [Banner display](https://github.com/0xshun/network-scanner/blob/main/_imports_/banner.py): `_imports_/banner.py`

### Other components

- **Operator**
- **Target network**

## Connections

- Operator → CLI and output: provides options (evidence: `README.md`)
- CLI and output → Input parsing: parses options (evidence: `src/main.py`)
- CLI and output → Scan dispatcher: starts scan (evidence: `src/main.py`)
- Scan dispatcher → ICMP probe: dispatches scan (evidence: `src/scanner.py`)
- Scan dispatcher → TCP port probe: dispatches scan (evidence: `src/scanner.py`)
- Scan dispatcher → ARP discovery: dispatches scan (evidence: `src/scanner.py`)
- ICMP probe → Target network: sends ICMP (evidence: `src/scanner.py`)
- TCP port probe → Target network: sends TCP (evidence: `src/scanner.py`)
- ARP discovery → Target network: sends ARP (evidence: `src/scanner.py`)
- Scan dispatcher → CLI and output: returns results (evidence: `src/main.py`)
- CLI and output → Operator: prints results (evidence: `src/main.py`)
- Operator → Legacy ARP script: runs legacy script (evidence: `main.py`)
- Legacy ARP script → Target network: sends ARP (evidence: `main.py`)
