# niranjan20061907/winhardener architecture

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

- Interactive diagram: https://gitdiagram.com/niranjan20061907/winhardener
- Repository: https://github.com/niranjan20061907/winhardener

## Overview

WinHardener is a local Flask application for auditing Windows 11 against CIS controls and applying operator-selected remediations. The principal workflow is sign-in, scan and score policies, review results, then optionally apply or reset controls; users can also inspect activity logs and export a PDF report. The graph preserves the documented password, lockout, local-policy, and service audit domains. The excerpts show routing and execution behavior only partially; documented reporting and storage capabilities are included where described, without inferring unshown call paths.

Main entry points: [`app.py`](https://github.com/niranjan20061907/winhardener/blob/main/app.py) (Flask routes and access control), [`policies.py`](https://github.com/niranjan20061907/winhardener/blob/main/policies.py) (CIS control definitions), [`templates`](https://github.com/niranjan20061907/winhardener/tree/main/templates) (HTML pages), [`policy_executor.py`](https://github.com/niranjan20061907/winhardener/blob/main/policy_executor.py) (Scan and compliance scoring)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_views["HTML pages"]
  node_dashboard_js["Dashboard interactions<br/>[dashboard.js]"]
  node_styles["Dashboard styling<br/>[style.css]"]
  node_activity["Activity log views<br/>[logs.html]"]
end

subgraph group_app["Application workflow"]
  node_flask["Flask routes and access control<br/>[app.py]"]
  node_auth["Role-based sign-in<br/>[app.py]"]
  node_state[("Saved scans, values, and logs<br/>[app.py]")]
  node_report["PDF compliance report<br/>[app.py]"]
end

subgraph group_policy["CIS policy engine"]
  node_policy_schema["CIS control definitions<br/>[policies.py]"]
  node_scan["Scan and compliance scoring<br/>[policy_executor.py]"]
  node_password["Password controls<br/>[policies.py]"]
  node_lockout["Account lockout controls<br/>[policies.py]"]
  node_local["Local policy controls<br/>[policies.py]"]
  node_services["Windows service controls<br/>[policies.py]"]
  node_remediation["Validate and apply or reset<br/>[policy_executor.py]"]
end

subgraph group_platform["Windows endpoint"]
  node_windows["Windows policy interfaces"]
end

node_operator(("Admin or guest"))
node_browser(("Web browser"))

node_operator -->|"uses"| node_browser
node_browser -->|"requests pages"| node_flask
node_flask -->|"handles sign-in"| node_auth
node_flask -->|"renders"| node_views
node_views -->|"loads"| node_dashboard_js
node_views -->|"loads"| node_styles
node_flask -->|"runs audit"| node_scan
node_scan -->|"uses definitions"| node_policy_schema
node_policy_schema -->|"defines"| node_password
node_policy_schema -->|"defines"| node_lockout
node_policy_schema -->|"defines"| node_local
node_policy_schema -->|"defines"| node_services
node_scan -->|"reads settings"| node_windows
node_flask -->|"dispatches changes"| node_remediation
node_remediation -->|"uses definitions"| node_policy_schema
node_remediation -->|"writes settings"| node_windows
node_flask -->|"reads and writes"| node_state
node_flask -->|"serves export"| node_report
node_report -->|"reads saved scan"| node_state
node_flask -->|"renders logs"| node_activity

click node_flask "https://github.com/niranjan20061907/winhardener/blob/main/app.py"
click node_auth "https://github.com/niranjan20061907/winhardener/blob/main/app.py"
click node_policy_schema "https://github.com/niranjan20061907/winhardener/blob/main/policies.py"
click node_scan "https://github.com/niranjan20061907/winhardener/blob/main/policy_executor.py"
click node_password "https://github.com/niranjan20061907/winhardener/blob/main/policies.py"
click node_lockout "https://github.com/niranjan20061907/winhardener/blob/main/policies.py"
click node_local "https://github.com/niranjan20061907/winhardener/blob/main/policies.py"
click node_services "https://github.com/niranjan20061907/winhardener/blob/main/policies.py"
click node_remediation "https://github.com/niranjan20061907/winhardener/blob/main/policy_executor.py"
click node_state "https://github.com/niranjan20061907/winhardener/blob/main/app.py"
click node_views "https://github.com/niranjan20061907/winhardener/tree/main/templates"
click node_dashboard_js "https://github.com/niranjan20061907/winhardener/blob/main/static/dashboard.js"
click node_styles "https://github.com/niranjan20061907/winhardener/blob/main/static/style.css"
click node_report "https://github.com/niranjan20061907/winhardener/blob/main/app.py"
click node_activity "https://github.com/niranjan20061907/winhardener/blob/main/templates/logs.html"

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_views,node_dashboard_js,node_styles,node_activity,node_browser toneBlue
class node_flask,node_auth,node_state,node_report toneAmber
class node_policy_schema,node_scan,node_password,node_lockout,node_local,node_services,node_remediation toneMint
class node_windows toneRose
class node_operator toneIndigo
```

## Components

### Web interface

- [HTML pages](https://github.com/niranjan20061907/winhardener/tree/main/templates): `templates`
- [Dashboard interactions](https://github.com/niranjan20061907/winhardener/blob/main/static/dashboard.js): `static/dashboard.js`
- [Dashboard styling](https://github.com/niranjan20061907/winhardener/blob/main/static/style.css): `static/style.css`
- [Activity log views](https://github.com/niranjan20061907/winhardener/blob/main/templates/logs.html): `templates/logs.html`

### Application workflow

- [Flask routes and access control](https://github.com/niranjan20061907/winhardener/blob/main/app.py): `app.py`
- [Role-based sign-in](https://github.com/niranjan20061907/winhardener/blob/main/app.py): `app.py`
- [Saved scans, values, and logs](https://github.com/niranjan20061907/winhardener/blob/main/app.py): `app.py`
- [PDF compliance report](https://github.com/niranjan20061907/winhardener/blob/main/app.py): `app.py`

### CIS policy engine

- [CIS control definitions](https://github.com/niranjan20061907/winhardener/blob/main/policies.py): `policies.py`
- [Scan and compliance scoring](https://github.com/niranjan20061907/winhardener/blob/main/policy_executor.py): `policy_executor.py`
- [Password controls](https://github.com/niranjan20061907/winhardener/blob/main/policies.py): `policies.py`
- [Account lockout controls](https://github.com/niranjan20061907/winhardener/blob/main/policies.py): `policies.py`
- [Local policy controls](https://github.com/niranjan20061907/winhardener/blob/main/policies.py): `policies.py`
- [Windows service controls](https://github.com/niranjan20061907/winhardener/blob/main/policies.py): `policies.py`
- [Validate and apply or reset](https://github.com/niranjan20061907/winhardener/blob/main/policy_executor.py): `policy_executor.py`

### Windows endpoint

- **Windows policy interfaces**

### Other components

- **Admin or guest**
- **Web browser**

## Connections

- Admin or guest → Web browser: uses
- Web browser → Flask routes and access control: requests pages
- Flask routes and access control → Role-based sign-in: handles sign-in
- Flask routes and access control → HTML pages: renders
- HTML pages → Dashboard interactions: loads
- HTML pages → Dashboard styling: loads
- Flask routes and access control → Scan and compliance scoring: runs audit
- Scan and compliance scoring → CIS control definitions: uses definitions
- CIS control definitions → Password controls: defines
- CIS control definitions → Account lockout controls: defines
- CIS control definitions → Local policy controls: defines
- CIS control definitions → Windows service controls: defines
- Scan and compliance scoring → Windows policy interfaces: reads settings
- Flask routes and access control → Validate and apply or reset: dispatches changes
- Validate and apply or reset → CIS control definitions: uses definitions
- Validate and apply or reset → Windows policy interfaces: writes settings
- Flask routes and access control → Saved scans, values, and logs: reads and writes
- Flask routes and access control → PDF compliance report: serves export
- PDF compliance report → Saved scans, values, and logs: reads saved scan
- Flask routes and access control → Activity log views: renders logs
