# chris124567/cfsolve architecture

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

- Interactive diagram: https://gitdiagram.com/chris124567/cfsolve
- Repository: https://github.com/chris124567/cfsolve

## Overview

cfsolve is a Rust library and CLI for obtaining Turnstile tokens or clearing Cloudflare challenge pages without a headless browser. The documented workflow starts with a page and browser profile, then fetches or renders the page, analyzes the challenge, and returns a token or clearance. Separate capture tooling records browser traffic to support profiles. Internal extraction, VM analysis, and stage-two capabilities are shown where the README or source index supports them; unsampled implementations and their wiring are not inferred.

Main entry points: [`src/browser.rs`](https://github.com/chris124567/cfsolve/blob/master/src/browser.rs) (Browser solver API), [`src/challenge/orchestrator.rs`](https://github.com/chris124567/cfsolve/blob/master/src/challenge/orchestrator.rs) (Challenge extraction), [`src/script.rs`](https://github.com/chris124567/cfsolve/blob/master/src/script.rs) (Parsed challenge script), [`src/stage2/registry.rs`](https://github.com/chris124567/cfsolve/blob/master/src/stage2/registry.rs) (Stage-two registry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Solver API"]
  node_browser["Browser solver API<br/>[browser.rs]"]
  node_profile["Browser profile<br/>[fingerprint.rs]"]
  node_result["Token or clearance<br/>[browser.rs]"]
end

subgraph group_analysis["Challenge Analysis"]
  node_challenge["Challenge extraction<br/>[orchestrator.rs]"]
  node_payload["Payload construction<br/>[payload.rs]"]
  node_deobfuscation["Script deobfuscation<br/>[pipeline.rs]"]
  node_script["Parsed challenge script<br/>[script.rs]"]
  node_vm["Challenge VM<br/>[session.rs]"]
  node_stage2["Stage-two registry<br/>[registry.rs]"]
  node_stage2analysis["Probe analysis<br/>[controller.rs]"]
  node_probes["Environment probes<br/>[worker_fetch.rs]"]
end

subgraph group_runtime["Browser Simulation"]
  node_transport["HTTP transport<br/>[client.rs]"]
  node_page["Page preparation<br/>[page.rs]"]
  node_session["Session probes<br/>[probes.rs]"]
  node_interaction["Challenge interaction<br/>[plan.rs]"]
end

subgraph group_capture["Capture Tools"]
  node_proxy["Capture proxy<br/>[proxy.rs]"]
  node_captures["Recorded sessions<br/>[sessions.rs]"]
  node_encoder["Session encoder recovery<br/>[rsa.rs]"]
end

node_caller(("Library or CLI caller"))
node_captureuser(("Browser using proxy"))

node_caller -->|"calls"| node_browser
node_profile -->|"configures"| node_browser
node_browser -->|"fetches pages"| node_transport
node_browser -->|"prepares page"| node_page
node_browser -->|"runs session"| node_session
node_browser -->|"analyzes challenge"| node_challenge
node_challenge -->|"builds payload"| node_payload
node_challenge -.->|"rewrites scripts"| node_deobfuscation
node_challenge -->|"parses scripts"| node_script
node_script -->|"recovers VM"| node_vm
node_browser -->|"uses registry"| node_stage2
node_stage2analysis -->|"queries listings"| node_vm
node_stage2 -.->|"registers probes"| node_probes
node_browser -->|"runs interaction"| node_interaction
node_browser -->|"returns result"| node_result
node_captureuser -->|"routes traffic"| node_proxy
node_proxy -->|"records sessions"| node_captures
node_captures -->|"recovers encoding"| node_encoder

click node_browser "https://github.com/chris124567/cfsolve/blob/master/src/browser.rs"
click node_profile "https://github.com/chris124567/cfsolve/blob/master/src/fingerprint.rs"
click node_transport "https://github.com/chris124567/cfsolve/blob/master/src/http/client.rs"
click node_page "https://github.com/chris124567/cfsolve/blob/master/src/embedding_page/page.rs"
click node_session "https://github.com/chris124567/cfsolve/blob/master/src/session/probes.rs"
click node_challenge "https://github.com/chris124567/cfsolve/blob/master/src/challenge/orchestrator.rs"
click node_payload "https://github.com/chris124567/cfsolve/blob/master/src/challenge/payload.rs"
click node_deobfuscation "https://github.com/chris124567/cfsolve/blob/master/src/deobfuscate/pipeline.rs"
click node_script "https://github.com/chris124567/cfsolve/blob/master/src/script.rs"
click node_vm "https://github.com/chris124567/cfsolve/blob/master/src/vm/session.rs"
click node_stage2 "https://github.com/chris124567/cfsolve/blob/master/src/stage2/registry.rs"
click node_stage2analysis "https://github.com/chris124567/cfsolve/blob/master/src/stage2/analysis/controller.rs"
click node_probes "https://github.com/chris124567/cfsolve/blob/master/src/stage2/probes/worker_fetch.rs"
click node_interaction "https://github.com/chris124567/cfsolve/blob/master/src/stage2/interaction/plan.rs"
click node_result "https://github.com/chris124567/cfsolve/blob/master/src/browser.rs"
click node_proxy "https://github.com/chris124567/cfsolve/blob/master/src/capture/proxy.rs"
click node_captures "https://github.com/chris124567/cfsolve/blob/master/src/capture/sessions.rs"
click node_encoder "https://github.com/chris124567/cfsolve/blob/master/src/capture/rsa.rs"

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_profile,node_result,node_captureuser toneBlue
class node_challenge,node_payload,node_deobfuscation,node_script,node_vm,node_stage2,node_stage2analysis,node_probes toneAmber
class node_transport,node_page,node_session,node_interaction toneMint
class node_proxy,node_captures,node_encoder toneRose
class node_caller toneIndigo
```

## Components

### Solver API

- [Browser solver API](https://github.com/chris124567/cfsolve/blob/master/src/browser.rs): `src/browser.rs`
- [Browser profile](https://github.com/chris124567/cfsolve/blob/master/src/fingerprint.rs): `src/fingerprint.rs`
- [Token or clearance](https://github.com/chris124567/cfsolve/blob/master/src/browser.rs): `src/browser.rs`

### Challenge Analysis

- [Challenge extraction](https://github.com/chris124567/cfsolve/blob/master/src/challenge/orchestrator.rs): `src/challenge/orchestrator.rs`
- [Payload construction](https://github.com/chris124567/cfsolve/blob/master/src/challenge/payload.rs): `src/challenge/payload.rs`
- [Script deobfuscation](https://github.com/chris124567/cfsolve/blob/master/src/deobfuscate/pipeline.rs): `src/deobfuscate/pipeline.rs`
- [Parsed challenge script](https://github.com/chris124567/cfsolve/blob/master/src/script.rs): `src/script.rs`
- [Challenge VM](https://github.com/chris124567/cfsolve/blob/master/src/vm/session.rs): `src/vm/session.rs`
- [Stage-two registry](https://github.com/chris124567/cfsolve/blob/master/src/stage2/registry.rs): `src/stage2/registry.rs`
- [Probe analysis](https://github.com/chris124567/cfsolve/blob/master/src/stage2/analysis/controller.rs): `src/stage2/analysis/controller.rs`
- [Environment probes](https://github.com/chris124567/cfsolve/blob/master/src/stage2/probes/worker_fetch.rs): `src/stage2/probes/worker_fetch.rs`

### Browser Simulation

- [HTTP transport](https://github.com/chris124567/cfsolve/blob/master/src/http/client.rs): `src/http/client.rs`
- [Page preparation](https://github.com/chris124567/cfsolve/blob/master/src/embedding_page/page.rs): `src/embedding_page/page.rs`
- [Session probes](https://github.com/chris124567/cfsolve/blob/master/src/session/probes.rs): `src/session/probes.rs`
- [Challenge interaction](https://github.com/chris124567/cfsolve/blob/master/src/stage2/interaction/plan.rs): `src/stage2/interaction/plan.rs`

### Capture Tools

- [Capture proxy](https://github.com/chris124567/cfsolve/blob/master/src/capture/proxy.rs): `src/capture/proxy.rs`
- [Recorded sessions](https://github.com/chris124567/cfsolve/blob/master/src/capture/sessions.rs): `src/capture/sessions.rs`
- [Session encoder recovery](https://github.com/chris124567/cfsolve/blob/master/src/capture/rsa.rs): `src/capture/rsa.rs`

### Other components

- **Library or CLI caller**
- **Browser using proxy**

## Connections

- Library or CLI caller → Browser solver API: calls (evidence: `README.md`)
- Browser profile → Browser solver API: configures (evidence: `README.md`)
- Browser solver API → HTTP transport: fetches pages (evidence: `src/browser.rs`)
- Browser solver API → Page preparation: prepares page (evidence: `src/browser.rs`)
- Browser solver API → Session probes: runs session (evidence: `src/browser.rs`)
- Browser solver API → Challenge extraction: analyzes challenge (evidence: `src/browser.rs`)
- Challenge extraction → Payload construction: builds payload (evidence: `src/challenge/orchestrator.rs`)
- Challenge extraction → Script deobfuscation: rewrites scripts
- Challenge extraction → Parsed challenge script: parses scripts (evidence: `src/challenge/orchestrator.rs`)
- Parsed challenge script → Challenge VM: recovers VM (evidence: `src/script.rs`)
- Browser solver API → Stage-two registry: uses registry (evidence: `src/browser.rs`)
- Probe analysis → Challenge VM: queries listings (evidence: `src/stage2/analysis/controller.rs`)
- Stage-two registry → Environment probes: registers probes
- Browser solver API → Challenge interaction: runs interaction (evidence: `src/browser.rs`)
- Browser solver API → Token or clearance: returns result (evidence: `README.md`)
- Browser using proxy → Capture proxy: routes traffic (evidence: `README.md`)
- Capture proxy → Recorded sessions: records sessions (evidence: `src/capture/sessions.rs`)
- Recorded sessions → Session encoder recovery: recovers encoding (evidence: `src/capture/sessions.rs`)
