How zhangkai208/grok-register-panel works
Purpose and entry points
This is a Python-based Grok/xAI account registration automation system with a local authenticated control panel. The main operator entry point is webui/monitor.py, serving a localhost panel on port 8787. Registration can also run from CLI batch entry points: run_batch_headless.py, run_until_100.py, and batch_supervisor.py.
Control panel and orchestration
The panel manages registration jobs, worker processes, runtime status, provider configuration, proxy configuration, blacklists, and recovery operations. webui/monitor.py is the HTTP/UI boundary; it delegates process lifecycle work to webui/process_utils.py and registration control to batch_supervisor.py. Authentication and local-runtime security are handled by webui/security_utils.py.
Registration workflow
register_flow.py is the core registration state machine: it coordinates browser-driven signup, email verification, and credential output. Browser abstraction is split between browser_session.py and camoufox_adapter.py, allowing the flow to drive the Camoufox browser runtime rather than directly coupling all registration logic to browser APIs. cloudflare.py and connectivity.py support network/challenge and reachability concerns around this flow.
Batch execution boundary
batch_supervisor.py manages concurrent or repeated registration workers and isolates job execution from the web process. run_batch_headless.py is the primary headless worker launcher, while run_xvfb_smoke.py supports Linux/Xvfb browser execution validation. This separation enables the panel to supervise subprocesses rather than executing browser automation inside its HTTP request lifecycle.
Email-provider subsystem
Email acquisition and verification-code retrieval are provider-pluggable through email_providers/__init__.py and email_providers/common.py. Concrete backends include Cloudflare, DuckMail, Mailnest, MoEmail, and others under email_providers/. The Cloudflare provider (email_providers/cloudflare.py) connects to a separately deployed Cloudflare Worker API backed by Cloudflare Email Routing and D1, so that infrastructure is external to this repository.
Persistent operational state
The panel persists editable operational settings through store modules: webui/email_provider_store.py, webui/email_domain_store.py, webui/proxy_store.py, and webui/blacklist_store.py. These form the boundary between panel-managed configuration/state and worker consumption. Runtime outputs and sensitive artifacts are organized in accounts/, grok2api_auth/, cpa_auth/, and log/; secure_files.py protects sensitive file handling.
Authentication artifact conversion and recovery
After successful account/session acquisition, sso_to_auth_json.py converts SSO/session material into auth JSON artifacts. Recovery paths are exposed through webui/recovery_ops.py, with related registration/SSO logic in register_flow.py. These artifacts are intended for downstream API use rather than being only browser-session state.
Runtime and deployment
The project runs on Python with dependencies in requirements.txt and requires Camoufox browser assets. It supports native Windows and Linux; Linux-specific service deployment is represented by deploy/grok-register-panel.service.example. Production hardening and permission controls are documented/implemented through HARDENING_ROOTS.md, scripts/harden_runtime_permissions.py, and DEPLOYMENT.md. External dependencies include xAI/Grok web endpoints, proxy services, email-provider APIs, and optionally Cloudflare Workers, Email Routing, and D1.
Main entry points: monitor.py Local monitor panel · register_flow.py Registration flow · batch_supervisor.py Batch supervisor · __init__.py Provider interface
Components 22
Local control panel
- Local monitor panel · Authenticated localhost operator panel on port 8787.
webui/monitor.py - Local security
webui/security_utils.py - Process lifecycle
webui/process_utils.py - Recovery operations
webui/recovery_ops.py
Registration execution
- Batch supervisor · Isolates concurrent registration jobs from the web process.
batch_supervisor.py - Headless worker launcher
run_batch_headless.py - Registration flow · Coordinates browser signup, email verification, and credential output.
register_flow.py - Browser session
browser_session.py - Camoufox adapter
camoufox_adapter.py - Network and challenge support
cloudflare.py
Email providers
- Provider interface · Pluggable email acquisition and verification-code retrieval.
email_providers/__init__.py - Provider common logic
email_providers/common.py - Cloudflare email provider
email_providers/cloudflare.py
Operational state and artifacts
- Email provider settings
webui/email_provider_store.py - Email domain settings
webui/email_domain_store.py - Proxy settings
webui/proxy_store.py - Blacklist state
webui/blacklist_store.py - SSO auth converter · Converts acquired SSO/session material to auth JSON.
sso_to_auth_json.py - Account and auth artifacts · Stores account outputs and downstream auth material.
- Sensitive file protection
secure_files.py
Other components
- xAI/Grok endpoints
- Cloudflare Worker email API · Backed by Email Routing and D1 outside this repository.
Connections 29
- Local monitor panel → Local security: authenticates operator
- Local monitor panel → Process lifecycle: manages processes
- Local monitor panel → Batch supervisor: controls jobs
- Local monitor panel → Recovery operations: exposes recovery
- Local monitor panel → Email provider settings: edits
- Local monitor panel → Email domain settings: edits
- Local monitor panel → Proxy settings: edits
- Local monitor panel → Blacklist state: edits
- Process lifecycle → Batch supervisor: starts and stops
- Batch supervisor → Headless worker launcher: launches workers
- Headless worker launcher → Registration flow: runs
- Email provider settings → Batch supervisor: worker configuration
- Email domain settings → Batch supervisor: worker configuration
- Proxy settings → Batch supervisor: worker configuration
- Blacklist state → Batch supervisor: worker constraints
- Recovery operations → Registration flow: reuses registration and SSO logic
- Registration flow → Browser session: drives signup
- Browser session → Camoufox adapter: uses
- Camoufox adapter → xAI/Grok endpoints: automates
- Registration flow → Network and challenge support: uses
- Network and challenge support → xAI/Grok endpoints: supports reachability and challenges
- Registration flow → Provider interface: acquires email and codes
- Provider interface → Provider common logic: uses contract
- Provider interface → Cloudflare email provider: selects backend
- Cloudflare email provider → Cloudflare Worker email API: calls
- Registration flow → SSO auth converter: passes session material
- SSO auth converter → Account and auth artifacts: writes auth output
- Registration flow → Account and auth artifacts: writes account output
- Sensitive file protection → Account and auth artifacts: protects