# lvn11lvn/durakonline-autoreg-and-cheating architecture

> Architecture diagram of the GitHub repository lvn11lvn/durakonline-autoreg-and-cheating, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lvn11lvn/durakonline-autoreg-and-cheating
- Repository: https://github.com/lvn11lvn/durakonline-autoreg-and-cheating

## Overview

##### Project Type and Purpose
- This is a multi‐tool automation suite (CLI application) designed to register accounts and “boost” in-game currency for Durak Online. It also includes reverse-engineered Apple JS authentication, a Gmail API client, and an SMS verification helper. The README confirms it’s a “регер и накрутчик валюты дурак онлайн,” with Apple JS reverse, Gmail API, and SMSHubOrg integrations.

##### File Structure Analysis
- Top-level orchestrators:
- main.py – entry point
- durak_bot.py – core booster logic
- durak_token_checker/ – pipeline for validating tokens
- Modules for external services:
- Apple/ – Python wrappers and “reverse-engineered” JS under utils/apple_auth.js
- GmailWebApi/ – gmail_client.py, models.py, main.py
- SMSHubOrg/ – api.py, properties.py
- DurakOnline/ – socket_api.py, websocket_api.py, utils.py
- Config and local data:
- config.py, proxies.txt, reged_tokens.txt, invalid/valid_tokens.txt
- Utilities:
- utils.py, module-specific tests (apple_auth_test.py)

##### Key Architectural Components
a. CLI Orchestrator
- main.py invokes durak_bot and/or token_checker.
b. Durak Currency Booster
- durak_bot.py uses DurakOnline/socket_api and Apple/Gmail/SMS modules to register or log in, solve captchas via SMSHub, then perform boosting actions via the game API.
c. Token Checking Pipeline
- durak_token_checker/token_checker.py reads tokens, validates them against the DurakOnline API, and writes results to valid_tokens.txt or invalid_tokens.txt.
d. External Service Integrations
- Apple: apple_auth.js + auth_durak_webapi.py/web_api.py
- Gmail: GmailWebApi/gmail_client.py + main.py
- SMSHubOrg: SMSHubOrg/api.py
e. Data Stores
- Flat files for tokens, proxies, configuration

##### Relationships and Data Flows
- The CLI (main.py) is the central orchestrator.
- It delegates:
- To durak_bot.py → calls DurakOnline module, AppleAuth, GmailWebApi, SMSHubOrg
- To token_checker → reads flat files, calls DurakOnline API
- Each external‐service module communicates via HTTP or sockets to its respective endpoint (e.g., Gmail REST, Apple reverse JS endpoints, DurakOnline sockets, SMSHub HTTP).
- Results (new tokens, boosted currency) are written back to the local data store (reged_tokens.txt, proxies.txt).

##### Architectural Patterns and Principles
- Modular separation by external service (single-responsibility modules)
- CLI orchestration layer
- Flat-file persistence (no database)
- Thin adapters for 3rd-party APIs (Gmail, SMSHub, DurakOnline, Apple)

##### Final Checklist
- Clear, descriptive labels on every component
- A title: “Durak Online Booster & Token Manager Architecture”

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Orchestrator
    Main["main.py\nCLI Orchestrator"]:::orchestrator
    click Main "https://github.com/lvn11lvn/durakonline-autoreg-and-cheating/blob/main/main.py"

    %% Branches
    Main -->|invoke booster| DurakBot
    Main -->|invoke token checker| TokenChecker

    %% Durak Currency Booster
    subgraph "Game Booster" 
        DurakBot["durak_bot.py\nDurak Booster"]:::module
        click DurakBot "https://github.com/lvn11lvn/durakonline-autoreg-and-cheating/blob/main/durak_bot.py"
    end

    %% Token Checking Pipeline
    subgraph "Token Validation"
        TokenChecker["token_checker.py\nToken Checker"]:::module
        click TokenChecker "https://github.com/lvn11lvn/durakonline-autoreg-and-cheating/blob/main/durak_token_checker/token_checker.py"
    end

    %% Registration Helpers
    subgraph "Registration Helpers"
        subgraph AppleAuthAdapter
            AuthJS["utils/apple_auth.js\nApple JS"]:::module
            click AuthJS "https://github.com/lvn11lvn/durakonline-autoreg-and-cheating/blob/main/Apple/utils/apple_auth.js"
            AuthDurakWeb["auth_durak_webapi.py\nApple Auth Python"]:::module
            click AuthDurakWeb "https://github.com/lvn11lvn/durakonline-autoreg-and-cheating/blob/main/Apple/auth_durak_webapi.py"
            WebAPI["web_api.py\nApple Web API"]:::module
            click WebAPI "https://github.com/lvn11lvn/durakonline-autoreg-and-cheating/blob/main/Apple/web_api.py"
            ServerJS["server.js\nApple Server"]:::module
            click ServerJS "https://github.com/lvn11lvn/durakonline-autoreg-and-cheating/blob/main/Apple/server.js"
            AppleUtils["utils/utils.py\nApple Utils"]:::module
            click AppleUtils "https://github.com/lvn11lvn/durakonline-autoreg-and-cheating/blob/main/Apple/utils/utils.py"
        end
        subgraph GmailAdapter
            GmailClient["gmail_client.py\nGmail Client"]:::module
            click GmailClient "https://github.com/lvn11lvn/durakonline-autoreg-and-cheating/blob/main/GmailWebApi/gmail_client.py"
            GmailMain["main.py\nGmail Main"]:::module
            click GmailMain "https://github.com/lvn11lvn/durakonline-autoreg-and-cheating/blob/main/GmailWebApi/main.py"
            GmailModels["models.py\nGmail Models"]:::module
            click GmailModels "https://github.com/lvn11lvn/durakonline-autoreg-and-cheating/blob/main/GmailWebApi/models.py"
        end
        subgraph SMSHubAdapter
            SMSAPI["api.py\nSMSHub API"]:::module
            click SMSAPI "https://github.com/lvn11lvn/durakonline-autoreg-and-cheating/blob/main/SMSHubOrg/api.py"
            SMSProps["properties.py\nSMSHub Props"]:::module
            click SMSProps "https://github.com/lvn11lvn/durakonline-autoreg-and-cheating/blob/main/SMSHubOrg/properties.py"
        end
    end

    %% DurakOnline API Adapter
    subgraph "DurakOnline Adapter"
        SocketAPI["socket_api.py\nSocket API"]:::module
        click SocketAPI "https://github.com/lvn11lvn/durakonline-autoreg-and-cheating/blob/main/DurakOnline/socket_api.py"
        WebsocketAPI["websocket_api.py\nWebsocket API"]:::module
        click WebsocketAPI "https://github.com/lvn11lvn/durakonline-autoreg-and-cheating/blob/main/DurakOnline/websocket_api.py"
        DLUtils["utils.py\nDurakOnline Utils"]:::module
        click DLUtils "https://github.com/lvn11lvn/durakonline-autoreg-and-cheating/blob/main/DurakOnline/utils.py"
    end

    %% Persistence
    subgraph "Persistence"
        Config["config.py"]:::datastore
        click Config "https://github.com/lvn11lvn/durakonline-autoreg-and-cheating/blob/main/config.py"
        Proxies["proxies.txt"]:::datastore
        click Proxies "https://github.com/lvn11lvn/durakonline-autoreg-and-cheating/blob/main/proxies.txt"
        RegedTokens["reged_tokens.txt"]:::datastore
        click RegedTokens "https://github.com/lvn11lvn/durakonline-autoreg-and-cheating/blob/main/reged_tokens.txt"
        SharedUtils["utils.py\nShared Utils"]:::datastore
        click SharedUtils "https://github.com/lvn11lvn/durakonline-autoreg-and-cheating/blob/main/utils.py"

        subgraph "Token Checker Stores"
            ToCheck["to_check_tokens.txt"]:::datastore
            click ToCheck "https://github.com/lvn11lvn/durakonline-autoreg-and-cheating/blob/main/durak_token_checker/to_check_tokens.txt"
            ValidTokens["valid_tokens.txt"]:::datastore
            click ValidTokens "https://github.com/lvn11lvn/durakonline-autoreg-and-cheating/blob/main/durak_token_checker/valid_tokens.txt"
            InvalidTokens["invalid_tokens.txt"]:::datastore
            click InvalidTokens "https://github.com/lvn11lvn/durakonline-autoreg-and-cheating/blob/main/durak_token_checker/invalid_tokens.txt"
        end
    end

    %% External Services
    DurakOnlineServer[("DurakOnline Server")]:::external
    AppleCloud(("Apple Endpoints")):::external
    GmailCloud(("Gmail REST API")):::external
    SMSCloud(("SMSHubOrg API")):::external

    %% Flows for Booster
    DurakBot -->|calls| SocketAPI
    DurakBot -->|calls| WebsocketAPI
    DurakBot -->|uses| DLUtils
    DurakBot -->|calls| AuthJS
    DurakBot -->|calls| AuthDurakWeb
    DurakBot -->|calls| WebAPI
    DurakBot -->|starts| ServerJS
    DurakBot -->|uses| AppleUtils
    DurakBot -->|calls| GmailClient
    DurakBot -->|calls| GmailMain
    DurakBot -->|uses| GmailModels
    DurakBot -->|calls| SMSAPI
    DurakBot -->|uses| SMSProps

    %% Persistence flows booster
    DurakBot -->|read/write| Config
    DurakBot -->|read/write| Proxies
    DurakBot -->|write| RegedTokens
    DurakBot -->|uses| SharedUtils

    %% DurakOnline Adapter to external
    SocketAPI -->|socket.emit| DurakOnlineServer
    WebsocketAPI -->|socket.on| DurakOnlineServer
    DLUtils -->|HTTP POST| DurakOnlineServer

    %% Registration Helpers to external
    AuthJS -->|HTTP POST| AppleCloud
    AuthDurakWeb -->|HTTP POST| AppleCloud
    WebAPI -->|HTTP POST| AppleCloud
    ServerJS -->|HTTP POST| AppleCloud
    GmailClient -->|REST| GmailCloud
    GmailMain -->|REST| GmailCloud
    SMSAPI -->|HTTP POST| SMSCloud
    SMSProps -->|HTTP GET| SMSCloud

    %% Token Checker flows
    TokenChecker -->|reads| ToCheck
    TokenChecker -->|writes| ValidTokens
    TokenChecker -->|writes| InvalidTokens
    TokenChecker -->|uses| Config
    TokenChecker -->|uses| Proxies
    TokenChecker -->|uses| SharedUtils
    TokenChecker -->|calls| SocketAPI
    TokenChecker -->|calls| WebsocketAPI
    TokenChecker -->|uses| DLUtils

    %% Legend through classes
    classDef orchestrator fill:#ADD8E6,stroke:#333,stroke-width:1px;
    classDef module fill:#90EE90,stroke:#333,stroke-width:1px;
    classDef datastore fill:#FFA500,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5;
    classDef external fill:#D3D3D3,stroke:#333,stroke-width:1px;
```
