# roothide/dopamine2-roothide architecture

> Architecture diagram of the GitHub repository roothide/dopamine2-roothide, 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/roothide/dopamine2-roothide
- Repository: https://github.com/roothide/dopamine2-roothide

## Overview

##### Project Type and Purpose
- This repository is a multifaceted jailbreak project. It bundles an iOS application (the “Dopamine” app) with a suite of exploits, kernel hooks, tooling utilities, and package management scripts.
- The README centers on building a “tipa file” via GitHub Actions, but the file tree reveals that the project manages both the app’s UI and the low-level binaries required for jailbreaking.
- Think of the project as having a “frontend” (the iOS application with its UI, settings, and extensions) and a “backend” comprised of several modules (exploits, jailbreak components, helper tools, and packaging utilities).

##### Key Components
A. iOS Application (Frontend):
- Located in the Application/Dopamine directory.
- Subdirectories include:
- App Delegates, UI (with modules like ActionMenu, PkgManagers, Settings, Themes, Update, etc.), Extensions, Assets, and Localization files.
- Jailbreak-related code (in Application/Dopamine/Jailbreak) which likely bridges the user interface with lower-level exploit and jailbreak functionalities.
- Architectural Pattern: Likely follows an iOS MVC (or MVVM) pattern where view controllers (in UI) interact with business logic embedded in the app’s modules.

B. Exploits and Low-level Modules (Backend/System Level):
- Located in Application/Dopamine/Exploits, encompassing several exploits (badRecovery, dmaFail, kfd, multicast_bytecopy, weightBufs, etc).
- These modules interact with kernel-level operations and rely on external libraries and headers (visible in the “Dependencies” folder).
- They are crucial for the jailbreaking process.

C. Base Binaries and Supporting Tools:
- The “BaseBin” directory holds a vast array of executables, libraries, and building scripts that include modules such as boomerang, bootstrapper, forkfix, idownloadd, jbctl, launchdhook, libjailbreak, roothidehooks, rootlesshooks, systemhook, watchdoghook, etc.
- This layer encompasses both kernel exploitation utilities and user-level daemon or helper tools.
- Dependencies from “BaseBin/_external” point toward external libraries used (for example, platforms and kernel-level interfaces).

D. Packaging and Deployment:
- The “Packages” directory (and associated Makefiles) indicates that the project includes scripts for assembling packages, likely to bundle the exploit binaries, libraries, and the app for deployment on jailbroken devices.

E. CI/CD and Build Pipeline:
- The .github/workflows directory holds GitHub Actions workflows (like the “roothide.yml”) used for building the tipa file.
- This component ensures the integration/build process is automated across macOS and other environments.

##### Relationships and Interactions
- The iOS app (Dopamine) provides the user interface and interacts directly with the jailbreak components. For example, buttons in the UI may trigger actions defined in the “Jailbreak” folder (DOJailbreaker, DOExploitManager, etc.) to initiate kernel exploits.
- The exploits (within Application/Dopamine/Exploits) work as the bridge between the UI and the low-level BaseBin binaries. They may be thought of as “plugins” that encapsulate different attack vectors.
- BaseBin hosts most of the kernel-level or system-level operations, which may be called upon by both the app and the standalone command-line tools (such as idownloadd, jbctl, etc.).
- The packaging (in Packages) ties together the final binaries/libraries and assets so that a deployable package (tipa file, in this case) can be downloaded via the CI/CD pipeline.
- The CI/CD (GitHub Actions) triggers the build process, which packages and assembles the necessary files from the above components.

##### Architectural Patterns and Design Principles
- Separation of Concerns: The UI and user interaction code (in Application/Dopamine/UI and Extensions) are clearly separated from the core exploit logic and system interaction (Exploits, Jailbreak, BaseBin).
- Modular Design: Each exploit and tool exists as an independent module, making it easier to update or replace one without affecting the entire system.
- Use of External Dependencies: References to external libraries (e.g., in BaseBin/_external) indicate that the project leverages platform-specific interfaces and standard frameworks (such as iOS frameworks and kernel libraries) for its functionality.

##### Elements
- “iOS App (Dopamine)” with its submodules (UI, Extensions, Jailbreak Bridge).
- “Exploits Module” – listing the various exploit folders.
- “Packaging & Distribution” – referencing the Packages directory.
- “CI/CD Pipeline” – GitHub Actions workflows.
- The iOS App and the Exploits/Jailbreak modules.
- The call flow from App → Jailbreak Code → Base Binaries.
- The integration of build scripts (CI/CD) that package all necessary modules.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Client Side (iOS Application)
    subgraph "Client Side (iOS Application)"
        App["iOS App (Dopamine)"]:::frontend
        UI["UI & Submodules"]:::frontend
        JB["Jailbreak Bridge"]:::frontend
    end

    %% System Modules (Low-level Components)
    subgraph "System Modules (Low-level Components)"
        Expl["Exploits Module"]:::backend
        Base["Base Binaries / Tools"]:::backend
    end

    %% Deployment & CI/CD
    subgraph "Deployment & CI/CD"
        Pack["Packaging & Distribution"]:::deployment
        CICD["CI/CD Pipeline"]:::deployment
    end

    %% Connections within Client Side
    App -->|"loads"| UI
    App -->|"includes"| JB
    UI -->|"triggers"| JB

    %% Connections from Client Side to System Modules
    JB -->|"invokes"| Expl
    Expl -->|"utilizes"| Base

    %% Connections to Deployment & CI/CD
    UI -->|"suppliesAssets"| Pack
    Base -->|"providesBinaries"| Pack
    CICD -->|"automatesBuild"| Pack

    %% Click Events
    click App "https://github.com/roothide/dopamine2-roothide/tree/2.x/Application/Dopamine"
    click UI "https://github.com/roothide/dopamine2-roothide/tree/2.x/Application/Dopamine/UI"
    click JB "https://github.com/roothide/dopamine2-roothide/tree/2.x/Application/Dopamine/Jailbreak"
    click Expl "https://github.com/roothide/dopamine2-roothide/tree/2.x/Application/Dopamine/Exploits"
    click Base "https://github.com/roothide/dopamine2-roothide/tree/2.x/BaseBin"
    click Pack "https://github.com/roothide/dopamine2-roothide/tree/2.x/Packages"
    click CICD "https://github.com/roothide/dopamine2-roothide/tree/2.x/.github/workflows"

    %% Styles
    classDef frontend fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef backend fill:#F9E79F,stroke:#B9770E,stroke-width:2px;
    classDef deployment fill:#D5F5E3,stroke:#1E8449,stroke-width:2px;
```
