# bagpotato/secnet-auditor architecture

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

- Interactive diagram: https://gitdiagram.com/bagpotato/secnet-auditor
- Repository: https://github.com/bagpotato/secnet-auditor

## Overview

SecNet-Auditor is a local Flask dashboard for read-only Ubuntu/Debian security audits, defensive log monitoring and—when enabled—admin-approved guided fixes. The main workflow is browser → dashboard/API → network, service and hardening checks, with SSH brute-force analysis also reported; users can separately search allow-listed logs or preview, apply and undo supported fixes. Fixes are backed up and audited. The excerpts establish the API/authentication and several module relationships; some audit routes and fix internals are unsampled, so those connections rely on the README or SOURCE INDEX rather than claims of direct calls.

Main entry points: [`app.py`](https://github.com/bagpotato/secnet-auditor/blob/main/app.py) (Flask API), [`modules/log_viewer.py`](https://github.com/bagpotato/secnet-auditor/blob/main/modules/log_viewer.py) (Log parsing & filtering), [`modules/network_check.py`](https://github.com/bagpotato/secnet-auditor/blob/main/modules/network_check.py) (Network checks), [`modules/services.py`](https://github.com/bagpotato/secnet-auditor/blob/main/modules/services.py) (Service checks)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Dashboard &amp; access"]
  node_browser["Dashboard UI<br/>[index.html]"]
  node_server["Flask API<br/>[app.py]"]
  node_auth["Login &amp; CSRF<br/>[auth.py]"]
  node_settings["Audit settings<br/>[config.json]"]
end

subgraph group_audits["Security audits"]
  node_network["Network checks<br/>[network_check.py]"]
  node_services["Service checks<br/>[services.py]"]
  node_hardening["Hardening checks<br/>[hardening.py]"]
end

subgraph group_fixes["Guided fixes"]
  node_fix_engine["Fix catalogue &amp; execution<br/>[fixes.py]"]
  node_history[("Backups &amp; fix records<br/>[fix_history.py]")]
end

subgraph group_logs["Log monitoring"]
  node_auth_log["SSH attempt analysis<br/>[log_monitor.py]"]
  node_log_viewer["Log parsing &amp; filtering<br/>[log_viewer.py]"]
end

node_operator(("Administrator / user"))
node_system{{"Ubuntu/Debian host"}}
node_log_sources["System log sources"]

node_operator -->|"uses"| node_browser
node_browser -->|"requests"| node_server
node_server -->|"checks access"| node_auth
node_server -->|"runs audit"| node_network
node_server -->|"audits services"| node_services
node_server -->|"audits hardening"| node_hardening
node_server -->|"runs analysis"| node_auth_log
node_server -->|"queries logs"| node_log_viewer
node_server -->|"plans and runs"| node_fix_engine
node_server -->|"loads settings"| node_settings
node_fix_engine -->|"backs up and records"| node_history
node_services -->|"uses command runner"| node_network
node_log_viewer -->|"runs journal queries"| node_network
node_network -->|"checks network state"| node_system
node_services -->|"checks services"| node_system
node_hardening -->|"checks host security"| node_system
node_auth_log -->|"reads auth log"| node_log_sources
node_log_viewer -->|"reads selected sources"| node_log_sources
node_fix_engine -->|"applies or restores changes"| node_system
node_log_viewer -.->|"parses fix audit entries"| node_history

click node_browser "https://github.com/bagpotato/secnet-auditor/blob/main/templates/index.html"
click node_server "https://github.com/bagpotato/secnet-auditor/blob/main/app.py"
click node_auth "https://github.com/bagpotato/secnet-auditor/blob/main/modules/auth.py"
click node_settings "https://github.com/bagpotato/secnet-auditor/blob/main/config.json"
click node_network "https://github.com/bagpotato/secnet-auditor/blob/main/modules/network_check.py"
click node_services "https://github.com/bagpotato/secnet-auditor/blob/main/modules/services.py"
click node_hardening "https://github.com/bagpotato/secnet-auditor/blob/main/modules/hardening.py"
click node_fix_engine "https://github.com/bagpotato/secnet-auditor/blob/main/modules/fixes.py"
click node_history "https://github.com/bagpotato/secnet-auditor/blob/main/modules/fix_history.py"
click node_auth_log "https://github.com/bagpotato/secnet-auditor/blob/main/modules/log_monitor.py"
click node_log_viewer "https://github.com/bagpotato/secnet-auditor/blob/main/modules/log_viewer.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_browser,node_server,node_auth,node_settings,node_operator toneBlue
class node_network,node_services,node_hardening toneAmber
class node_fix_engine,node_history toneMint
class node_auth_log,node_log_viewer toneRose
class node_system,node_log_sources toneIndigo
```

## Components

### Dashboard & access

- [Dashboard UI](https://github.com/bagpotato/secnet-auditor/blob/main/templates/index.html): `templates/index.html`
- [Flask API](https://github.com/bagpotato/secnet-auditor/blob/main/app.py): `app.py`
- [Login & CSRF](https://github.com/bagpotato/secnet-auditor/blob/main/modules/auth.py): `modules/auth.py`
- [Audit settings](https://github.com/bagpotato/secnet-auditor/blob/main/config.json): `config.json`

### Security audits

- [Network checks](https://github.com/bagpotato/secnet-auditor/blob/main/modules/network_check.py): `modules/network_check.py`
- [Service checks](https://github.com/bagpotato/secnet-auditor/blob/main/modules/services.py): `modules/services.py`
- [Hardening checks](https://github.com/bagpotato/secnet-auditor/blob/main/modules/hardening.py): `modules/hardening.py`

### Guided fixes

- [Fix catalogue & execution](https://github.com/bagpotato/secnet-auditor/blob/main/modules/fixes.py): `modules/fixes.py`
- [Backups & fix records](https://github.com/bagpotato/secnet-auditor/blob/main/modules/fix_history.py): `modules/fix_history.py`

### Log monitoring

- [SSH attempt analysis](https://github.com/bagpotato/secnet-auditor/blob/main/modules/log_monitor.py): `modules/log_monitor.py`
- [Log parsing & filtering](https://github.com/bagpotato/secnet-auditor/blob/main/modules/log_viewer.py): `modules/log_viewer.py`

### Other components

- **Administrator / user**
- **Ubuntu/Debian host**
- **System log sources**

## Connections

- Administrator / user → Dashboard UI: uses (evidence: `README.md`)
- Dashboard UI → Flask API: requests (evidence: `README.md`)
- Flask API → Login & CSRF: checks access (evidence: `app.py`)
- Flask API → Network checks: runs audit (evidence: `app.py`)
- Flask API → Service checks: audits services (evidence: `README.md`)
- Flask API → Hardening checks: audits hardening (evidence: `README.md`)
- Flask API → SSH attempt analysis: runs analysis (evidence: `README.md`)
- Flask API → Log parsing & filtering: queries logs (evidence: `app.py`)
- Flask API → Fix catalogue & execution: plans and runs (evidence: `app.py`)
- Flask API → Audit settings: loads settings (evidence: `app.py`)
- Fix catalogue & execution → Backups & fix records: backs up and records (evidence: `modules/fixes.py`)
- Service checks → Network checks: uses command runner (evidence: `modules/services.py`)
- Log parsing & filtering → Network checks: runs journal queries (evidence: `modules/log_viewer.py`)
- Network checks → Ubuntu/Debian host: checks network state (evidence: `modules/network_check.py`)
- Service checks → Ubuntu/Debian host: checks services (evidence: `modules/services.py`)
- Hardening checks → Ubuntu/Debian host: checks host security (evidence: `modules/hardening.py`)
- SSH attempt analysis → System log sources: reads auth log (evidence: `modules/log_monitor.py`)
- Log parsing & filtering → System log sources: reads selected sources (evidence: `README.md`)
- Fix catalogue & execution → Ubuntu/Debian host: applies or restores changes (evidence: `README.md`)
- Log parsing & filtering → Backups & fix records: parses fix audit entries
