# realaskaer/attackmachine architecture

> Architecture diagram of the GitHub repository realaskaer/attackmachine, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/realaskaer/attackmachine
- Repository: https://github.com/realaskaer/attackmachine

## Overview

##### Project Type and Purpose
- This is a powerful, fully automated Python tool designed for managing and executing financial operations (swaps, bridges, deposit/withdrawal tasks, NFT minting, etc.) across multiple blockchain networks.
- Its purpose is to automate routing “attacks” (or operations) over a large number of cryptocurrency accounts, handling tasks such as fund transfers, liquidity management, and interfacing with both centralized exchanges (CEXs) and decentralized bridges/exchanges.
- The project is structured to load account data (from Excel and JSON), apply a complex set of configuration rules (in settings.py and config.py), and execute a series of modular operations (as defined in the “modules” subfolders).

##### Analyzing the File Structure
- Top-Level Files and Configurations:
- main.py: Acts as the primary entry point for launching the automated workflow.
- config.py, general_settings.py, settings.py: Handle configuration options like API keys, network settings, and module-specific parameters.
- version.py: Likely used to track software versioning.
- Data Directory:
- data/accounts_data.xlsx and various JSON files provide input data and service configurations.
- data/logs folder indicates that logging is organized by date, hinting at a runtime monitoring/logging component.
- Modules Directory:
- Contains subfolders for different areas: blockchains, bridges, centralized exchanges (cexs), landings, onmichain operations, and other specialized modules (swaps, miscellaneous utilities, and transactional checks).
- Each subdirectory has an __init__.py and various Python files for specific functionalities (e.g., “evm.py” for blockchain operations, “across.py” and “bungee.py” under bridges, and multiple swap modules).
- This structure suggests the use of a plugin or modular interface design, where each module can be independently developed and executed.
- Utils Directory:
- Includes specialized tools such as route generators, network configurations, and signature utilities.
- The presence of functions.py, modules_runner.py, and an assortment of additional helper scripts points to a layered architecture that separates core workflow control from domain-specific modules.

a. Main Components:
- Core Engine:
- Represented by main.py, which orchestrates the entire operation.
- Includes components for asynchronous task execution (as indicated by “Асинхронный ООП код” in the README).
- Configuration/Settings Manager:
- Encompasses settings.py, config.py, and general_settings.py.
- Responsible for reading parameters, API keys, network configurations, and module behaviors.
- Data Input and Logging:
- Data ingestion from Excel and JSON files in the data/ folder, including account details and service configuration.
- Logging system using daily logs stored under data/logs.
- Module Plugins:
- Interfaces in the modules folder; divide these into submodules such as:
– Blockchains (modules/blockchains)
– Bridges (modules/bridges)
– CEX Handling (modules/cexs)
– Swaps (modules/swaps)
– NFT/misc. operations (modules/landings, modules/onmichain, modules/others)
– Transaction Checkers (modules/txchecker.py)
- Each module performs a specific financial operation or API call as per the settings provided.
- Utilities:
- Supportive utility functions (network configuration, signature creation, route generation) from the utils folder.
- External Service Integration:
- Interaction with Google Sheets (for route generation and progress updates as described) and possibly other external APIs.
- Google Cloud API and proxy checks as noted in the README.

b. Relationships and Interactions:
- The Core Engine (main.py) interacts with the Configuration Manager at startup to load all settings.
- It then reads account data from the data directory to prepare the workflow.
- Using a module runner (from utils/modules_runner.py), the engine sequentially or in parallel invokes the different modules (bridges, swaps, etc.) based on the provided configuration.
- Data flows from input (Excel/JSON files) into the modules, with output and progress being logged into files and optionally sent as Telegram notifications.
- Utilities (in utils/) support modules by providing network routes, generating transaction documents, and handling cryptographic tasks.

c. Architectural Patterns and Design Principles:
- Modular/Plugin Architecture: Each major asset (bridges, CEX operations, swaps, NFT minting) is encapsulated in its own Python module. This encourages separation of concerns and facilitates easy updates or extension of functionalities.
- Asynchronous Execution: Noted in the README (“Асинхронный ООП код”), suggesting that parallel task handling is a key design element (supported via the ACCOUNTS_IN_STREAM setting).

d. Relevant Technologies, Frameworks, and Libraries:
- Python 3.10.11 is the required version.
- Usage of asynchronous programming (possibly with asyncio) for parallel execution.
- Excel file handling for account data, likely through a library like openpyxl or pandas.
- JSON handling for configurations.
- Libraries used for networking, HTTP requests, and possibly cryptographic operations (e.g., in utils/stark_signature).

##### Instructing the Principal Software Engineer
- Component Labels: Clearly mark each major module/component (Core Engine, Configuration Manager, Data Loader, each plugin category, Utilities, Logging System, and External Integrations).
- Detail each interaction: Describe relationships such as how account data moves from input files to the modules, and how modules feed back progress/status to the logging system.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Startup & Configuration"
        CM["Configuration Manager"]:::config
        DI["Data I/O & Logging"]:::data
        ES["External Services Integration"]:::external
        CE["Core Engine"]:::core
    end

    subgraph "Utilities & Module Runner"
        MR["Module Runner Utility"]:::utility
        AU["Additional Utilities"]:::utility
    end

    subgraph "Operational Modules"
        BM["Blockchain Module"]:::module
        BR["Bridges Module"]:::module
        CX["CEX Module"]:::module
        NM["NFT/Misc Module"]:::module
        SM["Swaps Module"]:::module
        TC["Transaction Checker"]:::module
    end

    %% Relationships in Startup & Configuration
    CM -->|"loads"| CE
    DI -->|"supplies data"| CE
    CE -->|"initiates"| MR

    %% Relationships in Utilities Layer
    MR -->|"utilizes"| AU

    %% Relationships from Module Runner to Modules
    MR -->|"executes"| BM
    MR -->|"executes"| BR
    MR -->|"executes"| CX
    MR -->|"executes"| NM
    MR -->|"executes"| SM
    MR -->|"executes"| TC

    %% Logging and External Updates from Module Runner
    MR -->|"logs progress"| DI
    MR -->|"sends updates"| ES

    %% Styles
    classDef core fill:#ffcccb,stroke:#333,stroke-width:2px;
    classDef config fill:#ADD8E6,stroke:#333,stroke-width:2px;
    classDef data fill:#C1FFC1,stroke:#333,stroke-width:2px;
    classDef module fill:#FFFF99,stroke:#333,stroke-width:2px;
    classDef utility fill:#DDA0DD,stroke:#333,stroke-width:2px;
    classDef external fill:#FFA500,stroke:#333,stroke-width:2px;

    %% Click Events
    click CE "https://github.com/realaskaer/attackmachine/blob/main/main.py"
    click CM "https://github.com/realaskaer/attackmachine/blob/main/config.py"
    click DI "https://github.com/realaskaer/attackmachine/tree/main/data/"
    click BM "https://github.com/realaskaer/attackmachine/tree/main/modules/blockchains/"
    click BR "https://github.com/realaskaer/attackmachine/tree/main/modules/bridges/"
    click CX "https://github.com/realaskaer/attackmachine/tree/main/modules/cexs/"
    click NM "https://github.com/realaskaer/attackmachine/tree/main/modules/landings/"
    click SM "https://github.com/realaskaer/attackmachine/tree/main/modules/swaps/"
    click TC "https://github.com/realaskaer/attackmachine/blob/main/modules/txchecker.py"
    click MR "https://github.com/realaskaer/attackmachine/blob/main/utils/modules_runner.py"
    click AU "https://github.com/realaskaer/attackmachine/tree/main/utils/"
    click ES "https://github.com/realaskaer/attackmachine/tree/main/data/services/"
```
