# andrejsemionov/netaudit architecture

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

- Interactive diagram: https://gitdiagram.com/andrejsemionov/netaudit
- Repository: https://github.com/andrejsemionov/netaudit

## Overview

NetAudit audits networks, websites, and servers through registered checks, available from both CLI and web UI. Users select checks and parameters; the engine dispatches each check, which probes external targets or gathers server evidence over SSH, then returns findings and scores. Reports can be analyzed by AI and saved for history and trends. The map preserves the documented audit domains and major internal layers; several check families are represented by their exact directory because their individual implementations were not sampled.

Main entry points: [`netaudit_pkg/checks/ssh_auth_audit.py`](https://github.com/andrejsemionov/netaudit/blob/main/netaudit_pkg/checks/ssh_auth_audit.py) (SSH log audit), [`web/app.py`](https://github.com/andrejsemionov/netaudit/blob/main/web/app.py) (Web API), [`netaudit_pkg/engine.py`](https://github.com/andrejsemionov/netaudit/blob/main/netaudit_pkg/engine.py) (Check engine), [`netaudit.py`](https://github.com/andrejsemionov/netaudit/blob/main/netaudit.py) (CLI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User interfaces"]
  node_cli["CLI<br/>[netaudit.py]"]
  node_web["Web API<br/>[app.py]"]
end

subgraph group_runtime["Check runtime"]
  node_registry["Check registry<br/>[registry.py]"]
  node_engine["Check engine<br/>[engine.py]"]
  node_ssh["SSH executor<br/>[ssh.py]"]
  node_streaming["Live checks<br/>[streaming.py]"]
end

subgraph group_audits["Audit capabilities"]
  node_plugins["Audit plugins"]
  node_server["Server security<br/>[server_security.py]"]
  node_nginx["Nginx hardening<br/>[nginx_hardening.py]"]
  node_sshlogs["SSH log audit<br/>[ssh_auth_audit.py]"]
  node_logdiscover["Log discovery<br/>[log_discovery.py]"]
  node_authparse["Auth parser<br/>[ssh_auth_parser.py]"]
  node_authdetect["Auth detection"]
end

subgraph group_analysis["Findings and analysis"]
  node_findings["Finding model<br/>[findings.py]"]
  node_scoring["Hardening scores<br/>[scoring.py]"]
  node_redaction["Report redaction<br/>[redaction.py]"]
  node_ai["AI analysis"]
end

subgraph group_state["History and state"]
  node_storage[("SQLite storage<br/>[storage.py]")]
  node_history["Report history<br/>[history.py]"]
  node_trends["Trend analysis<br/>[trends.py]"]
end

node_operator(("Operator"))
node_anthropic{{"Anthropic API"}}

node_operator -->|"runs checks"| node_cli
node_operator -->|"selects checks"| node_web
node_cli -->|"runs checks"| node_engine
node_web -->|"runs checks"| node_engine
node_engine -->|"looks up checks"| node_registry
node_plugins -->|"register checks"| node_registry
node_engine -->|"dispatches checks"| node_plugins
node_server -->|"connects over SSH"| node_ssh
node_nginx -->|"uses SSH session"| node_ssh
node_sshlogs -->|"connects over SSH"| node_ssh
node_sshlogs -->|"probes log sources"| node_logdiscover
node_sshlogs -->|"parses collected logs"| node_authparse
node_authdetect -->|"consumes parsed events"| node_authparse
node_sshlogs -->|"detects log signals"| node_authdetect
node_sshlogs -->|"builds findings"| node_findings
node_server -.->|"reports findings"| node_findings
node_nginx -->|"uses scoring"| node_scoring
node_engine -->|"redacts report"| node_redaction
node_web -->|"saves reports"| node_storage
node_storage -->|"redacts before save"| node_redaction
node_cli -->|"shows history"| node_history
node_history -->|"reads and writes"| node_storage
node_cli -->|"requests trends"| node_trends
node_web -->|"requests trends"| node_trends
node_trends -->|"reads saved reports"| node_storage
node_web -->|"streams checks"| node_streaming
node_operator -->|"requests analysis"| node_ai
node_ai -->|"sends report"| node_anthropic

click node_cli "https://github.com/andrejsemionov/netaudit/blob/main/netaudit.py"
click node_web "https://github.com/andrejsemionov/netaudit/blob/main/web/app.py"
click node_registry "https://github.com/andrejsemionov/netaudit/blob/main/netaudit_pkg/registry.py"
click node_engine "https://github.com/andrejsemionov/netaudit/blob/main/netaudit_pkg/engine.py"
click node_plugins "https://github.com/andrejsemionov/netaudit/tree/main/netaudit_pkg/checks"
click node_server "https://github.com/andrejsemionov/netaudit/blob/main/netaudit_pkg/checks/server_security.py"
click node_nginx "https://github.com/andrejsemionov/netaudit/blob/main/netaudit_pkg/checks/nginx_hardening.py"
click node_sshlogs "https://github.com/andrejsemionov/netaudit/blob/main/netaudit_pkg/checks/ssh_auth_audit.py"
click node_logdiscover "https://github.com/andrejsemionov/netaudit/blob/main/netaudit_pkg/log_discovery.py"
click node_ssh "https://github.com/andrejsemionov/netaudit/blob/main/netaudit_pkg/ssh.py"
click node_authparse "https://github.com/andrejsemionov/netaudit/blob/main/netaudit_pkg/ssh_auth_parser.py"
click node_authdetect "https://github.com/andrejsemionov/netaudit/blob/main/netaudit_pkg/ssh_auth_detection.py"
click node_findings "https://github.com/andrejsemionov/netaudit/blob/main/netaudit_pkg/findings.py"
click node_scoring "https://github.com/andrejsemionov/netaudit/blob/main/netaudit_pkg/scoring.py"
click node_redaction "https://github.com/andrejsemionov/netaudit/blob/main/netaudit_pkg/redaction.py"
click node_storage "https://github.com/andrejsemionov/netaudit/blob/main/netaudit_pkg/storage.py"
click node_history "https://github.com/andrejsemionov/netaudit/blob/main/netaudit_pkg/history.py"
click node_trends "https://github.com/andrejsemionov/netaudit/blob/main/netaudit_pkg/trends.py"
click node_streaming "https://github.com/andrejsemionov/netaudit/blob/main/netaudit_pkg/streaming.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_web toneBlue
class node_registry,node_engine,node_ssh,node_streaming toneAmber
class node_plugins,node_server,node_nginx,node_sshlogs,node_logdiscover,node_authparse,node_authdetect,node_anthropic toneMint
class node_findings,node_scoring,node_redaction,node_ai toneRose
class node_storage,node_history,node_trends,node_operator toneIndigo
```

## Components

### User interfaces

- [CLI](https://github.com/andrejsemionov/netaudit/blob/main/netaudit.py): `netaudit.py`
- [Web API](https://github.com/andrejsemionov/netaudit/blob/main/web/app.py): `web/app.py`

### Check runtime

- [Check registry](https://github.com/andrejsemionov/netaudit/blob/main/netaudit_pkg/registry.py): `netaudit_pkg/registry.py`
- [Check engine](https://github.com/andrejsemionov/netaudit/blob/main/netaudit_pkg/engine.py): `netaudit_pkg/engine.py`
- [SSH executor](https://github.com/andrejsemionov/netaudit/blob/main/netaudit_pkg/ssh.py): `netaudit_pkg/ssh.py`
- [Live checks](https://github.com/andrejsemionov/netaudit/blob/main/netaudit_pkg/streaming.py): `netaudit_pkg/streaming.py`

### Audit capabilities

- [Audit plugins](https://github.com/andrejsemionov/netaudit/tree/main/netaudit_pkg/checks): `netaudit_pkg/checks`
- [Server security](https://github.com/andrejsemionov/netaudit/blob/main/netaudit_pkg/checks/server_security.py): `netaudit_pkg/checks/server_security.py`
- [Nginx hardening](https://github.com/andrejsemionov/netaudit/blob/main/netaudit_pkg/checks/nginx_hardening.py): `netaudit_pkg/checks/nginx_hardening.py`
- [SSH log audit](https://github.com/andrejsemionov/netaudit/blob/main/netaudit_pkg/checks/ssh_auth_audit.py): `netaudit_pkg/checks/ssh_auth_audit.py`
- [Log discovery](https://github.com/andrejsemionov/netaudit/blob/main/netaudit_pkg/log_discovery.py): `netaudit_pkg/log_discovery.py`
- [Auth parser](https://github.com/andrejsemionov/netaudit/blob/main/netaudit_pkg/ssh_auth_parser.py): `netaudit_pkg/ssh_auth_parser.py`
- [Auth detection](https://github.com/andrejsemionov/netaudit/blob/main/netaudit_pkg/ssh_auth_detection.py): `netaudit_pkg/ssh_auth_detection.py`

### Findings and analysis

- [Finding model](https://github.com/andrejsemionov/netaudit/blob/main/netaudit_pkg/findings.py): `netaudit_pkg/findings.py`
- [Hardening scores](https://github.com/andrejsemionov/netaudit/blob/main/netaudit_pkg/scoring.py): `netaudit_pkg/scoring.py`
- [Report redaction](https://github.com/andrejsemionov/netaudit/blob/main/netaudit_pkg/redaction.py): `netaudit_pkg/redaction.py`
- **AI analysis**

### History and state

- [SQLite storage](https://github.com/andrejsemionov/netaudit/blob/main/netaudit_pkg/storage.py): `netaudit_pkg/storage.py`
- [Report history](https://github.com/andrejsemionov/netaudit/blob/main/netaudit_pkg/history.py): `netaudit_pkg/history.py`
- [Trend analysis](https://github.com/andrejsemionov/netaudit/blob/main/netaudit_pkg/trends.py): `netaudit_pkg/trends.py`

### Other components

- **Operator**
- **Anthropic API**

## Connections

- Operator → CLI: runs checks (evidence: `README.md`)
- Operator → Web API: selects checks (evidence: `README.md`)
- CLI → Check engine: runs checks (evidence: `netaudit.py`)
- Web API → Check engine: runs checks (evidence: `web/app.py`)
- Check engine → Check registry: looks up checks (evidence: `netaudit_pkg/engine.py`)
- Audit plugins → Check registry: register checks (evidence: `netaudit_pkg/checks/__init__.py`)
- Check engine → Audit plugins: dispatches checks (evidence: `netaudit_pkg/engine.py`)
- Server security → SSH executor: connects over SSH (evidence: `netaudit_pkg/checks/server_security.py`)
- Nginx hardening → SSH executor: uses SSH session (evidence: `netaudit_pkg/checks/nginx_hardening.py`)
- SSH log audit → SSH executor: connects over SSH (evidence: `netaudit_pkg/checks/ssh_auth_audit.py`)
- SSH log audit → Log discovery: probes log sources (evidence: `netaudit_pkg/checks/ssh_auth_audit.py`)
- SSH log audit → Auth parser: parses collected logs (evidence: `netaudit_pkg/checks/ssh_auth_audit.py`)
- Auth detection → Auth parser: consumes parsed events (evidence: `netaudit_pkg/ssh_auth_detection.py`)
- SSH log audit → Auth detection: detects log signals (evidence: `netaudit_pkg/checks/ssh_auth_audit.py`)
- SSH log audit → Finding model: builds findings (evidence: `netaudit_pkg/checks/ssh_auth_audit.py`)
- Server security → Finding model: reports findings (evidence: `netaudit_pkg/checks/server_security.py`)
- Nginx hardening → Hardening scores: uses scoring (evidence: `netaudit_pkg/checks/nginx_hardening.py`)
- Check engine → Report redaction: redacts report (evidence: `netaudit_pkg/engine.py`)
- Web API → SQLite storage: saves reports (evidence: `web/app.py`)
- SQLite storage → Report redaction: redacts before save (evidence: `netaudit_pkg/storage.py`)
- CLI → Report history: shows history (evidence: `netaudit.py`)
- Report history → SQLite storage: reads and writes (evidence: `netaudit_pkg/history.py`)
- CLI → Trend analysis: requests trends (evidence: `netaudit.py`)
- Web API → Trend analysis: requests trends (evidence: `web/app.py`)
- Trend analysis → SQLite storage: reads saved reports (evidence: `netaudit_pkg/trends.py`)
- Web API → Live checks: streams checks (evidence: `web/app.py`)
- Operator → AI analysis: requests analysis (evidence: `README.md`)
- AI analysis → Anthropic API: sends report (evidence: `README.md`)
