# xkiian/geekedtest architecture

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

- Interactive diagram: https://gitdiagram.com/xkiian/geekedtest
- Repository: https://github.com/xkiian/geekedtest

## Overview

#### Purpose and Entry Points
This is an unofficial Python solver for GeeTest v4 CAPTCHA flows, supporting `slide`, `gobang`, `icon`, and `ai` risk types. The public library entry point is `Geeked`, imported from `geeked/__init__.py` and implemented in `geeked/geeked.py`. `main.py` is a runnable example/application entry point. `geeked/dddd_server.py` appears to expose an alternate service-oriented execution mode.

#### Solver Orchestration
`geeked/geeked.py` coordinates the end-to-end CAPTCHA protocol: initialize from a caller-supplied `captcha_id` and risk type, obtain challenge data, select a risk-specific solver, and return the GeeTest verification fields (`lot_number`, `pass_token`, `gen_time`, `captcha_output`). It is the boundary between consumers and GeeTest’s remote challenge/verification APIs.

#### CAPTCHA-Type Solvers
Risk-specific image interpretation and answer generation are separated by challenge type:
- Slider gap/location solving: `geeked/slide.py`
- Gobang-style visual puzzle solving: `geeked/gobang.py`
- Icon-selection/recognition solving: `geeked/icon.py`

This division lets the orchestrator dispatch based on `risk_type` while keeping image/puzzle logic isolated from signing and transport behavior.

#### AI/Model Assets
The icon/AI path is backed by a packaged ONNX model and charset metadata:
- `geeked/models/geetest_v4_icon.onnx`
- `geeked/models/charsets.json`
- `geeked/icon.py`

The model asset is a material runtime dependency for local inference rather than a remotely hosted recognition service. Python dependencies are defined in `requirements.txt`.

#### Protocol Signing and Browser Emulation
`geeked/sign.py` implements client-side request construction/signing, including mutable reverse-engineered constants noted by the README. It forms a critical compatibility boundary with GeeTest protocol changes: stale mappings, obfuscation constants, or device identifiers can invalidate otherwise correct puzzle answers.

`deobfuscate.py` supports recovering or updating those protocol constants when GeeTest client code changes.

#### Reverse-Engineered JavaScript Reference
The `reverse/` directory contains JavaScript implementations or extracted logic used to understand/reproduce browser-side GeeTest behavior:
- `reverse/encrypt.js`
- `reverse/decode.js`
- `reverse/pow.js`

These files represent the cryptographic/encoding and proof-of-work compatibility layer that informs Python signing behavior, rather than the primary consumer-facing API.

#### External Boundaries
The package depends on GeeTest v4 endpoints for challenge acquisition and final verification; callers must provide a valid `captcha_id` and chosen risk type. It runs primarily as Python, with optional/auxiliary JavaScript reverse-engineering artifacts and local ONNX inference. No persistent datastore, web frontend, or deployment infrastructure is represented in the repository.

Main entry points: [`geeked/geeked.py`](https://github.com/xkiian/geekedtest/blob/main/geeked/geeked.py) (Geeked orchestrator), [`geeked/icon.py`](https://github.com/xkiian/geekedtest/blob/main/geeked/icon.py) (Icon solver), [`geeked/sign.py`](https://github.com/xkiian/geekedtest/blob/main/geeked/sign.py) (Protocol signing), [`geeked/__init__.py`](https://github.com/xkiian/geekedtest/blob/main/geeked/__init__.py) (Geeked export)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_python["Python solver"]
  node_main["Example entry point<br/>Python application<br/>[main.py]"]
  node_dddd["Alternate service mode<br/>Python service<br/>[dddd_server.py]"]
  node_public_api["Geeked export<br/>Python package API<br/>[__init__.py]"]
  node_orchestrator["Geeked orchestrator<br/>Python solver<br/>[geeked.py]"]
  node_sign["Protocol signing<br/>Python signing layer<br/>[sign.py]"]
  node_slide["Slider solver<br/>image puzzle solver<br/>[slide.py]"]
  node_gobang["Gobang solver<br/>visual puzzle solver<br/>[gobang.py]"]
  node_icon["Icon solver<br/>ONNX puzzle solver<br/>[icon.py]"]
end

subgraph group_assets["Local inference"]
  node_model["Icon ONNX model<br/>model asset"]
  node_charsets["Charset metadata<br/>model metadata<br/>[charsets.json]"]
end

subgraph group_reverse["Protocol research"]
  node_deobfuscate["Constant recovery<br/>Python maintenance tool<br/>[deobfuscate.py]"]
  node_reverse_js["JavaScript protocol references<br/>reverse-engineered JS<br/>[encrypt.js]"]
end

node_caller(("Library caller<br/>consumer"))
node_geetest{{"GeeTest v4 APIs<br/>external CAPTCHA service"}}
node_requirements["Python dependencies<br/>dependency manifest<br/>[requirements.txt]"]

node_caller -->|"imports"| node_public_api
node_main -->|"runs"| node_orchestrator
node_dddd -->|"uses"| node_orchestrator
node_public_api -->|"exports"| node_orchestrator
node_orchestrator -->|"constructs requests"| node_sign
node_sign -->|"signed protocol calls"| node_geetest
node_geetest -->|"challenge data"| node_orchestrator
node_orchestrator -->|"dispatches slide"| node_slide
node_orchestrator -->|"dispatches gobang"| node_gobang
node_orchestrator -->|"dispatches icon / AI"| node_icon
node_slide -->|"answer"| node_orchestrator
node_gobang -->|"answer"| node_orchestrator
node_icon -->|"answer"| node_orchestrator
node_icon -->|"loads"| node_model
node_icon -->|"uses"| node_charsets
node_orchestrator -->|"submits verification"| node_geetest
node_reverse_js -.->|"informs protocol behavior"| node_sign
node_deobfuscate -.->|"updates constants"| node_sign
node_requirements -.->|"provides inference runtime"| node_icon

click node_main "https://github.com/xkiian/geekedtest/blob/main/main.py"
click node_dddd "https://github.com/xkiian/geekedtest/blob/main/geeked/dddd_server.py"
click node_public_api "https://github.com/xkiian/geekedtest/blob/main/geeked/__init__.py"
click node_orchestrator "https://github.com/xkiian/geekedtest/blob/main/geeked/geeked.py"
click node_sign "https://github.com/xkiian/geekedtest/blob/main/geeked/sign.py"
click node_slide "https://github.com/xkiian/geekedtest/blob/main/geeked/slide.py"
click node_gobang "https://github.com/xkiian/geekedtest/blob/main/geeked/gobang.py"
click node_icon "https://github.com/xkiian/geekedtest/blob/main/geeked/icon.py"
click node_model "https://github.com/xkiian/geekedtest/blob/main/geeked/models/geetest_v4_icon.onnx"
click node_charsets "https://github.com/xkiian/geekedtest/blob/main/geeked/models/charsets.json"
click node_deobfuscate "https://github.com/xkiian/geekedtest/blob/main/deobfuscate.py"
click node_reverse_js "https://github.com/xkiian/geekedtest/blob/main/reverse/encrypt.js"
click node_requirements "https://github.com/xkiian/geekedtest/blob/main/requirements.txt"

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_main,node_dddd,node_public_api,node_orchestrator,node_sign,node_slide,node_gobang,node_icon toneBlue
class node_model,node_charsets toneAmber
class node_deobfuscate,node_reverse_js toneMint
class node_caller,node_geetest,node_requirements toneNeutral
```

## Components

### Python solver

Public API, protocol flow, and puzzle solvers.

- [Example entry point](https://github.com/xkiian/geekedtest/blob/main/main.py): Python application · `main.py`
- [Alternate service mode](https://github.com/xkiian/geekedtest/blob/main/geeked/dddd_server.py): Python service · `geeked/dddd_server.py`
- [Geeked export](https://github.com/xkiian/geekedtest/blob/main/geeked/__init__.py): Python package API · `geeked/__init__.py`
- [Geeked orchestrator](https://github.com/xkiian/geekedtest/blob/main/geeked/geeked.py): Python solver · Coordinates challenge, solver dispatch, and verification fields. · `geeked/geeked.py`
- [Protocol signing](https://github.com/xkiian/geekedtest/blob/main/geeked/sign.py): Python signing layer · Builds browser-like signed requests using mutable constants. · `geeked/sign.py`
- [Slider solver](https://github.com/xkiian/geekedtest/blob/main/geeked/slide.py): image puzzle solver · `geeked/slide.py`
- [Gobang solver](https://github.com/xkiian/geekedtest/blob/main/geeked/gobang.py): visual puzzle solver · `geeked/gobang.py`
- [Icon solver](https://github.com/xkiian/geekedtest/blob/main/geeked/icon.py): ONNX puzzle solver · `geeked/icon.py`

### Local inference

Packaged assets used for icon recognition.

- [Icon ONNX model](https://github.com/xkiian/geekedtest/blob/main/geeked/models/geetest_v4_icon.onnx): model asset · Local recognition model. · `geeked/models/geetest_v4_icon.onnx`
- [Charset metadata](https://github.com/xkiian/geekedtest/blob/main/geeked/models/charsets.json): model metadata · `geeked/models/charsets.json`

### Protocol research

Reverse-engineered references and constant recovery tools.

- [Constant recovery](https://github.com/xkiian/geekedtest/blob/main/deobfuscate.py): Python maintenance tool · Updates reverse-engineered protocol constants. · `deobfuscate.py`
- [JavaScript protocol references](https://github.com/xkiian/geekedtest/blob/main/reverse/encrypt.js): reverse-engineered JS · Encoding, encryption, and proof-of-work behavior. · `reverse/encrypt.js`

### Other components

- **Library caller**: consumer · Supplies captcha_id and risk type.
- **GeeTest v4 APIs**: external CAPTCHA service · Provides challenges and accepts verification.
- [Python dependencies](https://github.com/xkiian/geekedtest/blob/main/requirements.txt): dependency manifest · Defines runtime packages including inference dependencies. · `requirements.txt`

## Connections

- Library caller → Geeked export: imports
- Example entry point → Geeked orchestrator: runs
- Alternate service mode → Geeked orchestrator: uses
- Geeked export → Geeked orchestrator: exports
- Geeked orchestrator → Protocol signing: constructs requests
- Protocol signing → GeeTest v4 APIs: signed protocol calls
- GeeTest v4 APIs → Geeked orchestrator: challenge data
- Geeked orchestrator → Slider solver: dispatches slide
- Geeked orchestrator → Gobang solver: dispatches gobang
- Geeked orchestrator → Icon solver: dispatches icon / AI
- Slider solver → Geeked orchestrator: answer
- Gobang solver → Geeked orchestrator: answer
- Icon solver → Geeked orchestrator: answer
- Icon solver → Icon ONNX model: loads
- Icon solver → Charset metadata: uses
- Geeked orchestrator → GeeTest v4 APIs: submits verification
- JavaScript protocol references → Protocol signing: informs protocol behavior
- Constant recovery → Protocol signing: updates constants
- Python dependencies → Icon solver: provides inference runtime
