# opa334/trollstore architecture

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

- Interactive diagram: https://gitdiagram.com/opa334/trollstore
- Repository: https://github.com/opa334/trollstore

## Overview

##### Main components
- TrollStore (Main Application) – This is the primary user-facing app that allows you to install any IPA and manage updates, uninstalls, etc.
- Exploits/fastPathSign – Contains the exploit code (including templates and core trust bypass code) that leverages the CoreTrust bug to bypass signature verification.
- RootHelper – Provides helper utilities for running operations with elevated (root) privileges. It features functions (such as “spawnRoot” in the Shared module) to execute commands as root.
- Pwnify – Another helper tool or module, likely involved in privilege escalations or adjustments needed for the exploit to work.
- TrollStoreLite – A lightweight version of TrollStore, likely sharing many components but offering a stripped-down interface or different distribution mechanism.
- Shared – Contains common code such as utility functions and core service interfaces that are reused by multiple components.
- Additional elements: “ChOma” (a folder with unspecified role), “Victim” (contains a certificate/make_cert script, suggesting a test or demo target within the ecosystem).

##### Relationships and Interactions
– The main TrollStore app communicates with TrollHelper (the persistence helper) to ensure that once installed, apps are correctly marked as “System” apps and remain launchable.
– When installing an IPA, TrollStore calls into functionality provided by the Exploits (fastPathSign) to bypass signature checks. This module is responsible for “faking” signatures using provided entitlements.
– TrollStore leverages shared utilities (from the Shared folder, e.g. TSUtil which contains spawnRoot) to spawn privileged processes. RootHelper implements many of these functions.
– Pwnify may interact with the Trusted Core and RootHelper to adjust process privileges needed for exploitation, while TrollStoreLite provides an alternate (or simplified) UI and install mechanism.
– The “Victim” folder contains files for testing or simulating certificate creation. These may be used during development or demonstration of the exploit.

##### Architectural Patterns and Design Principles
– Modular / layered Design: Each functional area (UI, exploitation, privilege escalation, shared utilities) is logically separated into its own folder/component.
– Helper and Core Modules: There’s a clear demarcation between the main user interface (TrollStore) and helper modules (TrollHelper, RootHelper, Pwnify) that perform behind-the-scenes tasks.
– Direct exploitation boundaries: The Exploits folder focuses explicitly on bypassing system checks through carefully crafted code and templates.
– Use of Theos build environment: The Makefile structure in each folder indicates that all components are built using a similar toolchain (Theos) for iOS native development.

– Start by placing the main components as distinct, labeled blocks:
o TrollStore (Main App) at the center.
o TrollHelper and TrollStoreLite as adjacent blocks that are tightly coupled to TrollStore (for persistence and alternate distribution).
o Exploits (fastPathSign) as a block used by TrollStore to overcome system limitations.
o RootHelper (and its supporting Shared utilities) as a block that provides privilege escalation functionality.
o Pwnify as a related auxiliary module.
o “Victim” can be depicted as a test environment or certificate management tool.
o TrollStore interacts with TrollHelper (for persistence routines).
o TrollStore calls into Exploits to bypass signature checks.
o TrollStore leverages functions from Shared, which in turn depend on RootHelper.
o Pwnify may communicate with both RootHelper and Shared to manage privileges.
o Core application logic (TrollStore, TrollStoreLite) – for example, use a blue block.
o Exploitation-and-helper modules (TrollHelper, RootHelper, Pwnify, Exploits) – maybe in green.
o Shared utility components – perhaps yellow.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Main UI Layer"
        TS["TrollStore (Main App)"]:::ui
        TSL["TrollStoreLite (Lightweight UI)"]:::ui
    end

    subgraph "Persistence & Exploitation"
        TH["TrollHelper (Persistence)"]:::helper
        FPS["FastPathSign Exploit Module"]:::helper
    end

    subgraph "Privilege Escalation & Shared"
        SU["Shared Utilities"]:::shared
        RH["RootHelper (Privilege Escalation)"]:::helper
        PW["Pwnify (Auxiliary)"]:::helper
    end

    subgraph "Auxiliary & Testing"
        VC["Victim/Test Cert"]:::test
        CO["ChOma (Auxiliary Component)"]:::aux
    end

    %% Connections
    TS -->|"persistence"| TH
    TS -->|"bypassSignature"| FPS
    TS -->|"spawnProcess"| SU
    SU -->|"elevatePrivileges"| RH
    PW -->|"adjustPrivileges"| RH
    PW -->|"utilize"| SU
    TSL -->|"alternateInstall"| TS
    FPS -->|"simulateCert"| VC
    CO -.->|"auxRel"| PW

    %% Click Events
    click TS "https://github.com/opa334/trollstore/tree/main/TrollStore"
    click TH "https://github.com/opa334/trollstore/tree/main/TrollHelper"
    click FPS "https://github.com/opa334/trollstore/tree/main/Exploits/fastPathSign"
    click RH "https://github.com/opa334/trollstore/tree/main/RootHelper"
    click PW "https://github.com/opa334/trollstore/tree/main/Pwnify"
    click TSL "https://github.com/opa334/trollstore/tree/main/TrollStoreLite"
    click SU "https://github.com/opa334/trollstore/tree/main/Shared"
    click CO "https://github.com/opa334/trollstore/tree/main/ChOma"
    click VC "https://github.com/opa334/trollstore/tree/main/Victim"

    %% Styles
    classDef ui fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef helper fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef shared fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef test fill:#f8d7da,stroke:#721c24,stroke-width:2px;
    classDef aux fill:#e2e3e5,stroke:#6c757d,stroke-width:2px;
```
