# styayur/wutnet architecture

> Architecture diagram of the GitHub repository styayur/wutnet, 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/styayur/wutnet
- Repository: https://github.com/styayur/wutnet

## Overview

WHUT-Net is a single-file PowerShell authenticator for the WHUT captive portal. Its principal workflow probes connectivity, discovers and validates the portal, establishes a cookie/CSRF session, checks account state, verifies the trusted network profile, submits the DPAPI-protected credential when needed, and verifies recovery. Setup, diagnostics, status, and scheduled automatic login are additional user-facing capabilities. All implementation nodes point to the sole source file; relationships are based on the README’s documented workflow and capabilities because no source excerpts were provided.

Main entry points: [`whut-net.ps1`](https://github.com/styayur/wutnet/blob/main/whut-net.ps1) (Command handling)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_commands["Commands and setup"]
  node_command["Command handling<br/>[whut-net.ps1]"]
  node_setup["Account setup<br/>[whut-net.ps1]"]
  node_config["Local configuration<br/>[whut-net.ps1]"]
end

subgraph group_discovery["Portal discovery"]
  node_probe["Internet probe<br/>[whut-net.ps1]"]
  node_discoveryflow["Portal discovery<br/>[whut-net.ps1]"]
  node_allowlist["Host/path validation<br/>[whut-net.ps1]"]
  node_nasid["nasId extraction<br/>[whut-net.ps1]"]
  node_apibase["API base discovery<br/>[whut-net.ps1]"]
end

subgraph group_authentication["Authentication"]
  node_session["CSRF/cookie session<br/>[whut-net.ps1]"]
  node_account["Account status check<br/>[whut-net.ps1]"]
  node_profile["Trusted profile check<br/>[whut-net.ps1]"]
  node_credential["DPAPI credential<br/>[whut-net.ps1]"]
  node_login["Portal login<br/>[whut-net.ps1]"]
  node_verify["Recovery verification<br/>[whut-net.ps1]"]
end

subgraph group_operations["Automation and operations"]
  node_task["Scheduled task setup<br/>[whut-net.ps1]"]
  node_logging["Bounded local logging<br/>[whut-net.ps1]"]
  node_diagnose["Diagnostics<br/>[whut-net.ps1]"]
  node_cleanup["Uninstall cleanup<br/>[whut-net.ps1]"]
end

node_user(("Windows user"))
node_scheduler["Task Scheduler"]
node_internet["Internet service"]
node_portal["WHUT portal"]

node_user -->|"runs command"| node_command
node_command -->|"dispatches setup"| node_setup
node_setup -->|"saves settings"| node_config
node_setup -->|"protects password"| node_credential
node_command -->|"checks connectivity"| node_probe
node_probe -->|"probes access"| node_internet
node_probe -->|"discovers when captive"| node_discoveryflow
node_discoveryflow -->|"locates portal"| node_portal
node_discoveryflow -->|"validates destination"| node_allowlist
node_allowlist -->|"permits extraction"| node_nasid
node_nasid -->|"enables API discovery"| node_apibase
node_apibase -->|"configures session"| node_session
node_session -->|"checks account"| node_account
node_account -->|"checks offline access"| node_profile
node_profile -->|"allows credential use"| node_credential
node_credential -->|"supplies password"| node_login
node_login -->|"posts authentication"| node_portal
node_login -->|"checks recovery"| node_verify
node_verify -->|"rechecks account"| node_account
node_verify -->|"verifies access"| node_internet
node_command -->|"dispatches diagnostics"| node_diagnose
node_user -->|"requests installation"| node_task
node_task -->|"registers task"| node_scheduler
node_scheduler -->|"invokes auto"| node_command
node_command -->|"writes bounded log"| node_logging
node_user -->|"requests uninstall"| node_cleanup
node_cleanup -->|"removes task"| node_scheduler
node_cleanup -->|"removes local state"| node_config

click node_command "https://github.com/styayur/wutnet/blob/main/whut-net.ps1"
click node_setup "https://github.com/styayur/wutnet/blob/main/whut-net.ps1"
click node_config "https://github.com/styayur/wutnet/blob/main/whut-net.ps1"
click node_probe "https://github.com/styayur/wutnet/blob/main/whut-net.ps1"
click node_discoveryflow "https://github.com/styayur/wutnet/blob/main/whut-net.ps1"
click node_allowlist "https://github.com/styayur/wutnet/blob/main/whut-net.ps1"
click node_nasid "https://github.com/styayur/wutnet/blob/main/whut-net.ps1"
click node_apibase "https://github.com/styayur/wutnet/blob/main/whut-net.ps1"
click node_session "https://github.com/styayur/wutnet/blob/main/whut-net.ps1"
click node_account "https://github.com/styayur/wutnet/blob/main/whut-net.ps1"
click node_profile "https://github.com/styayur/wutnet/blob/main/whut-net.ps1"
click node_credential "https://github.com/styayur/wutnet/blob/main/whut-net.ps1"
click node_login "https://github.com/styayur/wutnet/blob/main/whut-net.ps1"
click node_verify "https://github.com/styayur/wutnet/blob/main/whut-net.ps1"
click node_task "https://github.com/styayur/wutnet/blob/main/whut-net.ps1"
click node_logging "https://github.com/styayur/wutnet/blob/main/whut-net.ps1"
click node_diagnose "https://github.com/styayur/wutnet/blob/main/whut-net.ps1"
click node_cleanup "https://github.com/styayur/wutnet/blob/main/whut-net.ps1"

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_command,node_setup,node_config,node_user toneBlue
class node_probe,node_discoveryflow,node_allowlist,node_nasid,node_apibase toneAmber
class node_session,node_account,node_profile,node_credential,node_login,node_verify toneMint
class node_task,node_logging,node_diagnose,node_cleanup,node_scheduler toneRose
class node_internet,node_portal toneIndigo
```

## Components

### Commands and setup

- [Command handling](https://github.com/styayur/wutnet/blob/main/whut-net.ps1): `whut-net.ps1`
- [Account setup](https://github.com/styayur/wutnet/blob/main/whut-net.ps1): `whut-net.ps1`
- [Local configuration](https://github.com/styayur/wutnet/blob/main/whut-net.ps1): `whut-net.ps1`

### Portal discovery

- [Internet probe](https://github.com/styayur/wutnet/blob/main/whut-net.ps1): `whut-net.ps1`
- [Portal discovery](https://github.com/styayur/wutnet/blob/main/whut-net.ps1): `whut-net.ps1`
- [Host/path validation](https://github.com/styayur/wutnet/blob/main/whut-net.ps1): `whut-net.ps1`
- [nasId extraction](https://github.com/styayur/wutnet/blob/main/whut-net.ps1): `whut-net.ps1`
- [API base discovery](https://github.com/styayur/wutnet/blob/main/whut-net.ps1): `whut-net.ps1`

### Authentication

- [CSRF/cookie session](https://github.com/styayur/wutnet/blob/main/whut-net.ps1): `whut-net.ps1`
- [Account status check](https://github.com/styayur/wutnet/blob/main/whut-net.ps1): `whut-net.ps1`
- [Trusted profile check](https://github.com/styayur/wutnet/blob/main/whut-net.ps1): `whut-net.ps1`
- [DPAPI credential](https://github.com/styayur/wutnet/blob/main/whut-net.ps1): `whut-net.ps1`
- [Portal login](https://github.com/styayur/wutnet/blob/main/whut-net.ps1): `whut-net.ps1`
- [Recovery verification](https://github.com/styayur/wutnet/blob/main/whut-net.ps1): `whut-net.ps1`

### Automation and operations

- [Scheduled task setup](https://github.com/styayur/wutnet/blob/main/whut-net.ps1): `whut-net.ps1`
- [Bounded local logging](https://github.com/styayur/wutnet/blob/main/whut-net.ps1): `whut-net.ps1`
- [Diagnostics](https://github.com/styayur/wutnet/blob/main/whut-net.ps1): `whut-net.ps1`
- [Uninstall cleanup](https://github.com/styayur/wutnet/blob/main/whut-net.ps1): `whut-net.ps1`

### Other components

- **Windows user**
- **Task Scheduler**
- **Internet service**
- **WHUT portal**

## Connections

- Windows user → Command handling: runs command (evidence: `README.md`)
- Command handling → Account setup: dispatches setup (evidence: `README.md`)
- Account setup → Local configuration: saves settings (evidence: `README.md`)
- Account setup → DPAPI credential: protects password (evidence: `README.md`)
- Command handling → Internet probe: checks connectivity (evidence: `README.md`)
- Internet probe → Internet service: probes access (evidence: `README.md`)
- Internet probe → Portal discovery: discovers when captive (evidence: `README.md`)
- Portal discovery → WHUT portal: locates portal (evidence: `README.md`)
- Portal discovery → Host/path validation: validates destination (evidence: `README.md`)
- Host/path validation → nasId extraction: permits extraction (evidence: `README.md`)
- nasId extraction → API base discovery: enables API discovery (evidence: `README.md`)
- API base discovery → CSRF/cookie session: configures session (evidence: `README.md`)
- CSRF/cookie session → Account status check: checks account (evidence: `README.md`)
- Account status check → Trusted profile check: checks offline access (evidence: `README.md`)
- Trusted profile check → DPAPI credential: allows credential use (evidence: `README.md`)
- DPAPI credential → Portal login: supplies password (evidence: `README.md`)
- Portal login → WHUT portal: posts authentication (evidence: `README.md`)
- Portal login → Recovery verification: checks recovery (evidence: `README.md`)
- Recovery verification → Account status check: rechecks account (evidence: `README.md`)
- Recovery verification → Internet service: verifies access (evidence: `README.md`)
- Command handling → Diagnostics: dispatches diagnostics (evidence: `README.md`)
- Windows user → Scheduled task setup: requests installation (evidence: `README.md`)
- Scheduled task setup → Task Scheduler: registers task (evidence: `README.md`)
- Task Scheduler → Command handling: invokes auto (evidence: `README.md`)
- Command handling → Bounded local logging: writes bounded log (evidence: `README.md`)
- Windows user → Uninstall cleanup: requests uninstall (evidence: `README.md`)
- Uninstall cleanup → Task Scheduler: removes task (evidence: `README.md`)
- Uninstall cleanup → Local configuration: removes local state (evidence: `README.md`)
