# gyuri1999/netwatch architecture

> Architecture diagram of the GitHub repository gyuri1999/netwatch, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gyuri1999/netwatch
- Repository: https://github.com/gyuri1999/netwatch

## Overview

NetWatch is a network-monitoring and security product: a sensor captures live traffic, detects suspicious activity, and serves a dashboard with alerts, history, and investigation tools. The README also documents active network tests, learning/CTF features, and an Android alert companion. The graph preserves these product branches; edges are limited to relationships shown in excerpts, the SOURCE INDEX, or README. Several feature modules are unsampled, so their internal connections are not inferred.

Main entry points: [`server.py`](https://github.com/gyuri1999/netwatch/blob/main/server.py) (HTTP and SSE server), [`capture.py`](https://github.com/gyuri1999/netwatch/blob/main/capture.py) (Traffic capture), [`android/app/src/main/java/io/github/netwatch/android/AlertWorker.kt`](https://github.com/gyuri1999/netwatch/blob/main/android/app/src/main/java/io/github/netwatch/android/AlertWorker.kt) (Alert polling), [`android/app/src/main/java/io/github/netwatch/android/SetupActivity.kt`](https://github.com/gyuri1999/netwatch/blob/main/android/app/src/main/java/io/github/netwatch/android/SetupActivity.kt) (Agent setup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_sensor["Capture and detection"]
  node_capture["Traffic capture<br/>[capture.py]"]
  node_detect["Detection engine<br/>[detect.py]"]
  node_core["Shared config and helpers<br/>[core.py]"]
  node_storage[("Threat feeds and history<br/>[storage.py]")]
end

subgraph group_web["Dashboard and response"]
  node_server["HTTP and SSE server<br/>[server.py]"]
  node_dashboard["Web dashboard<br/>[sw.js]"]
end

subgraph group_investigate["Network investigation"]
  node_assessment["Security audit<br/>[assess.py]"]
  node_pentest["Pentest toolkit<br/>[pentest.py]"]
  node_reports["Scan reports<br/>[pentest_report.py]"]
  node_networkkit["Network tools<br/>[netkit.py]"]
  node_triage["Network triage<br/>[nettriage.py]"]
  node_operations["Operations tools<br/>[ops.py]"]
  node_hunt["Threat hunting<br/>[hunt.py]"]
  node_docs["Wireshark notes<br/>[netdocs.py]"]
end

subgraph group_learn["Learning and labs"]
  node_ctf["PCAP CTF<br/>[ctf.py]"]
  node_academy["Learning academy<br/>[engine.js]"]
end

subgraph group_clients["Companion clients"]
  node_androidsetup["Agent setup<br/>[SetupActivity.kt]"]
  node_agentclient["Pinned agent client<br/>[AgentClient.kt]"]
  node_androidstore[("Companion settings<br/>[Store.kt]")]
  node_androidworker["Alert polling<br/>[AlertWorker.kt]"]
  node_androidapp["Dashboard WebView<br/>[MainActivity.kt]"]
  node_notifier["Mobile notifications<br/>[Notifier.kt]"]
end

node_user(("Network operator"))
node_agent(("NetWatch agent"))

node_user -->|"uses dashboard"| node_server
node_capture -->|"feeds packets"| node_detect
node_capture -->|"uses history"| node_storage
node_capture -->|"uses helpers"| node_core
node_capture -->|"supports replay labs"| node_ctf
node_server -->|"routes monitoring"| node_capture
node_server -->|"routes audit"| node_assessment
node_server -->|"routes scans"| node_pentest
node_server -->|"routes tools"| node_networkkit
node_server -->|"routes triage"| node_triage
node_server -->|"routes operations"| node_operations
node_server -->|"routes hunting"| node_hunt
node_server -->|"routes CTF"| node_ctf
node_server -.->|"serves interface"| node_dashboard
node_pentest -.->|"exports reports"| node_reports
node_user -->|"studies networking"| node_academy
node_user -->|"configures companion"| node_androidsetup
node_androidsetup -->|"checks fingerprint and status"| node_agentclient
node_androidsetup -->|"saves agent config"| node_androidstore
node_androidapp -->|"reads settings"| node_androidstore
node_androidapp -->|"schedules polling"| node_androidworker
node_androidworker -->|"reads and updates state"| node_androidstore
node_androidworker -->|"fetches status"| node_agentclient
node_androidworker -->|"shows alerts"| node_notifier
node_agentclient -->|"polls status"| node_agent

click node_capture "https://github.com/gyuri1999/netwatch/blob/main/capture.py"
click node_detect "https://github.com/gyuri1999/netwatch/blob/main/detect.py"
click node_core "https://github.com/gyuri1999/netwatch/blob/main/core.py"
click node_storage "https://github.com/gyuri1999/netwatch/blob/main/storage.py"
click node_server "https://github.com/gyuri1999/netwatch/blob/main/server.py"
click node_dashboard "https://github.com/gyuri1999/netwatch/blob/main/sw.js"
click node_assessment "https://github.com/gyuri1999/netwatch/blob/main/assess.py"
click node_pentest "https://github.com/gyuri1999/netwatch/blob/main/pentest.py"
click node_reports "https://github.com/gyuri1999/netwatch/blob/main/pentest_report.py"
click node_networkkit "https://github.com/gyuri1999/netwatch/blob/main/netkit.py"
click node_triage "https://github.com/gyuri1999/netwatch/blob/main/nettriage.py"
click node_operations "https://github.com/gyuri1999/netwatch/blob/main/ops.py"
click node_hunt "https://github.com/gyuri1999/netwatch/blob/main/hunt.py"
click node_docs "https://github.com/gyuri1999/netwatch/blob/main/netdocs.py"
click node_ctf "https://github.com/gyuri1999/netwatch/blob/main/ctf.py"
click node_academy "https://github.com/gyuri1999/netwatch/blob/main/academy/engine.js"
click node_androidsetup "https://github.com/gyuri1999/netwatch/blob/main/android/app/src/main/java/io/github/netwatch/android/SetupActivity.kt"
click node_agentclient "https://github.com/gyuri1999/netwatch/blob/main/android/app/src/main/java/io/github/netwatch/android/AgentClient.kt"
click node_androidstore "https://github.com/gyuri1999/netwatch/blob/main/android/app/src/main/java/io/github/netwatch/android/Store.kt"
click node_androidworker "https://github.com/gyuri1999/netwatch/blob/main/android/app/src/main/java/io/github/netwatch/android/AlertWorker.kt"
click node_androidapp "https://github.com/gyuri1999/netwatch/blob/main/android/app/src/main/java/io/github/netwatch/android/MainActivity.kt"
click node_notifier "https://github.com/gyuri1999/netwatch/blob/main/android/app/src/main/java/io/github/netwatch/android/Notifier.kt"

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_capture,node_detect,node_core,node_storage toneBlue
class node_server,node_dashboard toneAmber
class node_assessment,node_pentest,node_reports,node_networkkit,node_triage,node_operations,node_hunt,node_docs toneMint
class node_ctf,node_academy toneRose
class node_androidsetup,node_agentclient,node_androidstore,node_androidworker,node_androidapp,node_notifier,node_user,node_agent toneIndigo
```

## Components

### Capture and detection

- [Traffic capture](https://github.com/gyuri1999/netwatch/blob/main/capture.py): `capture.py`
- [Detection engine](https://github.com/gyuri1999/netwatch/blob/main/detect.py): `detect.py`
- [Shared config and helpers](https://github.com/gyuri1999/netwatch/blob/main/core.py): `core.py`
- [Threat feeds and history](https://github.com/gyuri1999/netwatch/blob/main/storage.py): `storage.py`

### Dashboard and response

- [HTTP and SSE server](https://github.com/gyuri1999/netwatch/blob/main/server.py): `server.py`
- [Web dashboard](https://github.com/gyuri1999/netwatch/blob/main/sw.js): `sw.js`

### Network investigation

- [Security audit](https://github.com/gyuri1999/netwatch/blob/main/assess.py): `assess.py`
- [Pentest toolkit](https://github.com/gyuri1999/netwatch/blob/main/pentest.py): `pentest.py`
- [Scan reports](https://github.com/gyuri1999/netwatch/blob/main/pentest_report.py): `pentest_report.py`
- [Network tools](https://github.com/gyuri1999/netwatch/blob/main/netkit.py): `netkit.py`
- [Network triage](https://github.com/gyuri1999/netwatch/blob/main/nettriage.py): `nettriage.py`
- [Operations tools](https://github.com/gyuri1999/netwatch/blob/main/ops.py): `ops.py`
- [Threat hunting](https://github.com/gyuri1999/netwatch/blob/main/hunt.py): `hunt.py`
- [Wireshark notes](https://github.com/gyuri1999/netwatch/blob/main/netdocs.py): `netdocs.py`

### Learning and labs

- [PCAP CTF](https://github.com/gyuri1999/netwatch/blob/main/ctf.py): `ctf.py`
- [Learning academy](https://github.com/gyuri1999/netwatch/blob/main/academy/engine.js): `academy/engine.js`

### Companion clients

- [Agent setup](https://github.com/gyuri1999/netwatch/blob/main/android/app/src/main/java/io/github/netwatch/android/SetupActivity.kt): `android/app/src/main/java/io/github/netwatch/android/SetupActivity.kt`
- [Pinned agent client](https://github.com/gyuri1999/netwatch/blob/main/android/app/src/main/java/io/github/netwatch/android/AgentClient.kt): `android/app/src/main/java/io/github/netwatch/android/AgentClient.kt`
- [Companion settings](https://github.com/gyuri1999/netwatch/blob/main/android/app/src/main/java/io/github/netwatch/android/Store.kt): `android/app/src/main/java/io/github/netwatch/android/Store.kt`
- [Alert polling](https://github.com/gyuri1999/netwatch/blob/main/android/app/src/main/java/io/github/netwatch/android/AlertWorker.kt): `android/app/src/main/java/io/github/netwatch/android/AlertWorker.kt`
- [Dashboard WebView](https://github.com/gyuri1999/netwatch/blob/main/android/app/src/main/java/io/github/netwatch/android/MainActivity.kt): `android/app/src/main/java/io/github/netwatch/android/MainActivity.kt`
- [Mobile notifications](https://github.com/gyuri1999/netwatch/blob/main/android/app/src/main/java/io/github/netwatch/android/Notifier.kt): `android/app/src/main/java/io/github/netwatch/android/Notifier.kt`

### Other components

- **Network operator**
- **NetWatch agent**

## Connections

- Network operator → HTTP and SSE server: uses dashboard
- Traffic capture → Detection engine: feeds packets (evidence: `capture.py`)
- Traffic capture → Threat feeds and history: uses history (evidence: `capture.py`)
- Traffic capture → Shared config and helpers: uses helpers (evidence: `capture.py`)
- Traffic capture → PCAP CTF: supports replay labs (evidence: `capture.py`)
- HTTP and SSE server → Traffic capture: routes monitoring (evidence: `server.py`)
- HTTP and SSE server → Security audit: routes audit (evidence: `server.py`)
- HTTP and SSE server → Pentest toolkit: routes scans (evidence: `server.py`)
- HTTP and SSE server → Network tools: routes tools (evidence: `server.py`)
- HTTP and SSE server → Network triage: routes triage (evidence: `server.py`)
- HTTP and SSE server → Operations tools: routes operations (evidence: `server.py`)
- HTTP and SSE server → Threat hunting: routes hunting (evidence: `server.py`)
- HTTP and SSE server → PCAP CTF: routes CTF (evidence: `server.py`)
- HTTP and SSE server → Web dashboard: serves interface
- Pentest toolkit → Scan reports: exports reports
- Network operator → Learning academy: studies networking
- Network operator → Agent setup: configures companion
- Agent setup → Pinned agent client: checks fingerprint and status (evidence: `android/app/src/main/java/io/github/netwatch/android/SetupActivity.kt`)
- Agent setup → Companion settings: saves agent config (evidence: `android/app/src/main/java/io/github/netwatch/android/SetupActivity.kt`)
- Dashboard WebView → Companion settings: reads settings (evidence: `android/app/src/main/java/io/github/netwatch/android/MainActivity.kt`)
- Dashboard WebView → Alert polling: schedules polling (evidence: `android/app/src/main/java/io/github/netwatch/android/MainActivity.kt`)
- Alert polling → Companion settings: reads and updates state (evidence: `android/app/src/main/java/io/github/netwatch/android/AlertWorker.kt`)
- Alert polling → Pinned agent client: fetches status (evidence: `android/app/src/main/java/io/github/netwatch/android/AlertWorker.kt`)
- Alert polling → Mobile notifications: shows alerts (evidence: `android/app/src/main/java/io/github/netwatch/android/AlertWorker.kt`)
- Pinned agent client → NetWatch agent: polls status (evidence: `android/app/src/main/java/io/github/netwatch/android/AgentClient.kt`)
