# valakchigo-arch/scanner-cis architecture

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

- Interactive diagram: https://gitdiagram.com/valakchigo-arch/scanner-cis
- Repository: https://github.com/valakchigo-arch/scanner-cis

## Overview

Clear Scanner audits endpoint hardening through two distinct Windows paths—a YAML rule engine and a target-local checklist—and a Linux Lynis path. Findings are evaluated or parsed, then packaged and sent to the n8n webhook; failed deliveries can be spooled for later retry. The graph preserves documented baseline, scoring, and optional Windows scanner capabilities. Some subsystem links rely on README statements or SOURCE INDEX references because their full implementations were not sampled.

Main entry points: [`scanner/common/beacon_contract.py`](https://github.com/valakchigo-arch/scanner-cis/blob/main/scanner/common/beacon_contract.py) (Payload and Transport), [`scanner/core/executor.py`](https://github.com/valakchigo-arch/scanner-cis/blob/main/scanner/core/executor.py) (Rule Executor), [`scanner/windows/cis_scanner_windows.py`](https://github.com/valakchigo-arch/scanner-cis/blob/main/scanner/windows/cis_scanner_windows.py) (Windows Checklist), [`scanner/windows/rule_scanner_windows.py`](https://github.com/valakchigo-arch/scanner-cis/blob/main/scanner/windows/rule_scanner_windows.py) (Windows Rule Scanner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_rules["Windows Rule Engine"]
  node_rule_runner["Rule Baseline Runner<br/>[run_rules_live.py]"]
end

subgraph group_endpoint["Endpoint Scanners"]
  node_windows_local["Windows Checklist"]
  node_windows_rules["Windows Rule Scanner"]
  node_thor_scanner["THOR Scanner<br/>[thor_scanner.py]"]
  node_linux_scanner["Linux Lynis Scanner"]
end

subgraph group_delivery["Beacon Delivery"]
  node_beacon_contract["Payload and Transport<br/>[beacon_contract.py]"]
  node_windows_beacon["Windows Beacon<br/>[beacon.py]"]
  node_linux_beacon["Linux Beacon<br/>[beacon.py]"]
  node_spool[("Retry Spool<br/>[spool.py]")]
end

subgraph group_core["Rule Engine Internals"]
  node_rule_loader["Rule Loader<br/>[rule_loader.py]"]
  node_executor["Rule Executor<br/>[executor.py]"]
  node_probe_registry["Probe Registry<br/>[probe_registry.py]"]
  node_ps_probe["PowerShell Probe"]
  node_registry_probe["Registry Probe"]
  node_ps_runtime["PowerShell Runtime<br/>[_powershell.py]"]
  node_evaluator["Condition Evaluator<br/>[evaluator.py]"]
  node_finding_emitter["Finding Emitter<br/>[finding_emitter.py]"]
  node_scoring["Risk Scoring<br/>[scoring.py]"]
  node_contract_adapter["Contract Adapter"]
end

node_operator(("Scanner Operator"))
node_n8n["n8n Webhook"]

node_operator -->|"runs baseline"| node_rule_runner
node_operator -->|"runs scan"| node_windows_local
node_operator -->|"runs scan"| node_windows_rules
node_operator -->|"runs scan"| node_linux_scanner
node_operator -.->|"runs scan"| node_thor_scanner
node_rule_runner -->|"executes rules"| node_executor
node_rule_runner -.->|"loads rules"| node_rule_loader
node_executor -->|"dispatches probes"| node_probe_registry
node_executor -->|"evaluates conditions"| node_evaluator
node_executor -->|"emits findings"| node_finding_emitter
node_probe_registry -->|"registers provider"| node_ps_probe
node_probe_registry -->|"registers provider"| node_registry_probe
node_registry_probe -->|"runs fallback"| node_ps_runtime
node_ps_probe -->|"runs commands"| node_ps_runtime
node_windows_rules -->|"runs rule engine"| node_executor
node_windows_rules -->|"adapts results"| node_contract_adapter
node_windows_rules -->|"scores findings"| node_scoring
node_windows_local -->|"builds payload"| node_beacon_contract
node_windows_local -->|"sends result"| node_windows_beacon
node_windows_local -->|"stores failed send"| node_spool
node_linux_scanner -->|"builds payload"| node_beacon_contract
node_linux_scanner -->|"sends result"| node_linux_beacon
node_linux_scanner -->|"stores failed send"| node_spool
node_thor_scanner -->|"builds payload"| node_beacon_contract
node_thor_scanner -->|"stores failed send"| node_spool
node_windows_beacon -->|"sends payload"| node_beacon_contract
node_linux_beacon -->|"sends payload"| node_beacon_contract
node_beacon_contract -->|"posts findings"| node_n8n
node_spool -->|"retries payload"| node_beacon_contract

click node_rule_runner "https://github.com/valakchigo-arch/scanner-cis/blob/main/run_rules_live.py"
click node_rule_loader "https://github.com/valakchigo-arch/scanner-cis/blob/main/scanner/core/rule_loader.py"
click node_executor "https://github.com/valakchigo-arch/scanner-cis/blob/main/scanner/core/executor.py"
click node_probe_registry "https://github.com/valakchigo-arch/scanner-cis/blob/main/scanner/core/probe_registry.py"
click node_ps_probe "https://github.com/valakchigo-arch/scanner-cis/blob/main/scanner/core/probes/windows_powershell.py"
click node_registry_probe "https://github.com/valakchigo-arch/scanner-cis/blob/main/scanner/core/probes/windows_registry.py"
click node_ps_runtime "https://github.com/valakchigo-arch/scanner-cis/blob/main/scanner/core/probes/_powershell.py"
click node_evaluator "https://github.com/valakchigo-arch/scanner-cis/blob/main/scanner/core/evaluator.py"
click node_finding_emitter "https://github.com/valakchigo-arch/scanner-cis/blob/main/scanner/core/finding_emitter.py"
click node_scoring "https://github.com/valakchigo-arch/scanner-cis/blob/main/scanner/core/scoring.py"
click node_contract_adapter "https://github.com/valakchigo-arch/scanner-cis/blob/main/scanner/core/contract_adapter.py"
click node_windows_local "https://github.com/valakchigo-arch/scanner-cis/blob/main/scanner/windows/cis_scanner_windows.py"
click node_windows_rules "https://github.com/valakchigo-arch/scanner-cis/blob/main/scanner/windows/rule_scanner_windows.py"
click node_thor_scanner "https://github.com/valakchigo-arch/scanner-cis/blob/main/scanner/windows/thor_scanner.py"
click node_linux_scanner "https://github.com/valakchigo-arch/scanner-cis/blob/main/scanner/linux/cis_scanner_linux.py"
click node_beacon_contract "https://github.com/valakchigo-arch/scanner-cis/blob/main/scanner/common/beacon_contract.py"
click node_windows_beacon "https://github.com/valakchigo-arch/scanner-cis/blob/main/scanner/windows/beacon.py"
click node_linux_beacon "https://github.com/valakchigo-arch/scanner-cis/blob/main/scanner/linux/beacon.py"
click node_spool "https://github.com/valakchigo-arch/scanner-cis/blob/main/scanner/common/spool.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_rule_runner toneBlue
class node_windows_local,node_windows_rules,node_thor_scanner,node_linux_scanner toneAmber
class node_beacon_contract,node_windows_beacon,node_linux_beacon,node_spool,node_n8n toneMint
class node_rule_loader,node_executor,node_probe_registry,node_ps_probe,node_registry_probe,node_ps_runtime,node_evaluator,node_finding_emitter,node_scoring,node_contract_adapter toneRose
class node_operator toneIndigo
```

## Components

### Windows Rule Engine

- [Rule Baseline Runner](https://github.com/valakchigo-arch/scanner-cis/blob/main/run_rules_live.py): `run_rules_live.py`

### Endpoint Scanners

- [Windows Checklist](https://github.com/valakchigo-arch/scanner-cis/blob/main/scanner/windows/cis_scanner_windows.py): `scanner/windows/cis_scanner_windows.py`
- [Windows Rule Scanner](https://github.com/valakchigo-arch/scanner-cis/blob/main/scanner/windows/rule_scanner_windows.py): `scanner/windows/rule_scanner_windows.py`
- [THOR Scanner](https://github.com/valakchigo-arch/scanner-cis/blob/main/scanner/windows/thor_scanner.py): `scanner/windows/thor_scanner.py`
- [Linux Lynis Scanner](https://github.com/valakchigo-arch/scanner-cis/blob/main/scanner/linux/cis_scanner_linux.py): `scanner/linux/cis_scanner_linux.py`

### Beacon Delivery

- [Payload and Transport](https://github.com/valakchigo-arch/scanner-cis/blob/main/scanner/common/beacon_contract.py): `scanner/common/beacon_contract.py`
- [Windows Beacon](https://github.com/valakchigo-arch/scanner-cis/blob/main/scanner/windows/beacon.py): `scanner/windows/beacon.py`
- [Linux Beacon](https://github.com/valakchigo-arch/scanner-cis/blob/main/scanner/linux/beacon.py): `scanner/linux/beacon.py`
- [Retry Spool](https://github.com/valakchigo-arch/scanner-cis/blob/main/scanner/common/spool.py): `scanner/common/spool.py`

### Rule Engine Internals

- [Rule Loader](https://github.com/valakchigo-arch/scanner-cis/blob/main/scanner/core/rule_loader.py): `scanner/core/rule_loader.py`
- [Rule Executor](https://github.com/valakchigo-arch/scanner-cis/blob/main/scanner/core/executor.py): `scanner/core/executor.py`
- [Probe Registry](https://github.com/valakchigo-arch/scanner-cis/blob/main/scanner/core/probe_registry.py): `scanner/core/probe_registry.py`
- [PowerShell Probe](https://github.com/valakchigo-arch/scanner-cis/blob/main/scanner/core/probes/windows_powershell.py): `scanner/core/probes/windows_powershell.py`
- [Registry Probe](https://github.com/valakchigo-arch/scanner-cis/blob/main/scanner/core/probes/windows_registry.py): `scanner/core/probes/windows_registry.py`
- [PowerShell Runtime](https://github.com/valakchigo-arch/scanner-cis/blob/main/scanner/core/probes/_powershell.py): `scanner/core/probes/_powershell.py`
- [Condition Evaluator](https://github.com/valakchigo-arch/scanner-cis/blob/main/scanner/core/evaluator.py): `scanner/core/evaluator.py`
- [Finding Emitter](https://github.com/valakchigo-arch/scanner-cis/blob/main/scanner/core/finding_emitter.py): `scanner/core/finding_emitter.py`
- [Risk Scoring](https://github.com/valakchigo-arch/scanner-cis/blob/main/scanner/core/scoring.py): `scanner/core/scoring.py`
- [Contract Adapter](https://github.com/valakchigo-arch/scanner-cis/blob/main/scanner/core/contract_adapter.py): `scanner/core/contract_adapter.py`

### Other components

- **Scanner Operator**
- **n8n Webhook**

## Connections

- Scanner Operator → Rule Baseline Runner: runs baseline
- Scanner Operator → Windows Checklist: runs scan
- Scanner Operator → Windows Rule Scanner: runs scan
- Scanner Operator → Linux Lynis Scanner: runs scan
- Scanner Operator → THOR Scanner: runs scan
- Rule Baseline Runner → Rule Executor: executes rules
- Rule Baseline Runner → Rule Loader: loads rules
- Rule Executor → Probe Registry: dispatches probes (evidence: `scanner/core/executor.py`)
- Rule Executor → Condition Evaluator: evaluates conditions (evidence: `scanner/core/executor.py`)
- Rule Executor → Finding Emitter: emits findings (evidence: `scanner/core/executor.py`)
- Probe Registry → PowerShell Probe: registers provider (evidence: `scanner/core/__init__.py`)
- Probe Registry → Registry Probe: registers provider (evidence: `scanner/core/__init__.py`)
- Registry Probe → PowerShell Runtime: runs fallback (evidence: `scanner/core/probes/windows_registry.py`)
- PowerShell Probe → PowerShell Runtime: runs commands (evidence: `scanner/core/probes/windows_powershell.py`)
- Windows Rule Scanner → Rule Executor: runs rule engine (evidence: `scanner/windows/rule_scanner_windows.py`)
- Windows Rule Scanner → Contract Adapter: adapts results (evidence: `scanner/windows/rule_scanner_windows.py`)
- Windows Rule Scanner → Risk Scoring: scores findings (evidence: `scanner/windows/rule_scanner_windows.py`)
- Windows Checklist → Payload and Transport: builds payload (evidence: `scanner/windows/cis_scanner_windows.py`)
- Windows Checklist → Windows Beacon: sends result (evidence: `scanner/windows/cis_scanner_windows.py`)
- Windows Checklist → Retry Spool: stores failed send (evidence: `scanner/windows/cis_scanner_windows.py`)
- Linux Lynis Scanner → Payload and Transport: builds payload (evidence: `scanner/linux/cis_scanner_linux.py`)
- Linux Lynis Scanner → Linux Beacon: sends result (evidence: `scanner/linux/cis_scanner_linux.py`)
- Linux Lynis Scanner → Retry Spool: stores failed send (evidence: `scanner/linux/cis_scanner_linux.py`)
- THOR Scanner → Payload and Transport: builds payload (evidence: `scanner/windows/thor_scanner.py`)
- THOR Scanner → Retry Spool: stores failed send (evidence: `scanner/windows/thor_scanner.py`)
- Windows Beacon → Payload and Transport: sends payload (evidence: `scanner/windows/beacon.py`)
- Linux Beacon → Payload and Transport: sends payload (evidence: `scanner/linux/beacon.py`)
- Payload and Transport → n8n Webhook: posts findings
- Retry Spool → Payload and Transport: retries payload
