# alfiecg24/trigon architecture

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

- Interactive diagram: https://gitdiagram.com/alfiecg24/trigon
- Repository: https://github.com/alfiecg24/trigon

## Overview

##### Main Components
- iOS User Interface Layer:
- Includes AppDelegate, ViewController, Main.storyboard, and LaunchScreen.storyboard.
- This layer is responsible for initializing the application, handling UI events, and managing the control flow.
- Exploit Module:
- Located in the “Exploit” directory (files like exploit.c, patchfinder.c, memory.c, etc.).
- This module implements the CVE-based kernel exploit logic to create arbitrary physical address mapping and read/write primitives, following a non-standard code path in the kernel.
- iOS System Environment:
- Boundary between userland and the kernel. Although not part of the project code, this external environment is critical since the exploit interacts with the iOS kernel.
- Xcode Project & Configuration Files:
- Includes project files (Trigon.xcodeproj) and configuration files (Info.plist, Assets.xcassets, LICENSE, etc.), which help in the build and deployment process.

##### Relationships and Interactions
- The UI layer calls into the exploit module (likely via bridged Objective-C to C function calls) when a user action or internal trigger initiates exploitation.
- The exploit module, in turn, interfaces with the iOS kernel, executing specific code paths to utilize the vulnerability to gain read/write access.
- Configuration files and project settings govern how the app is built and deployed, ensuring the proper security credentials and runtime behaviors are configured.
- The overarching flow involves user-level triggers resulting in the execution of low-level exploit code that interacts with hardware or the kernel, encapsulated in the exploit primitives.

##### Architectural Patterns and Design Principles
- Separation of Concerns is visible:
– UI and high-level application logic are kept separate from low-level exploitation code.
– The exploit module is self-contained in its own directory.
- Layered Architecture:
– User Interface Layer (presentation) → Exploit Layer (business/logic) → iOS Kernel (system level).
- Use of mixed languages (C and Objective-C) emphasizes bridging and interfacing between higher-level management and lower-level hardware interaction.

##### Final Assembly
– Start with “User Trigger (UI Layer)” at one end, pointing to the “Exploit Module.”

## Diagram (Mermaid)

```mermaid
graph TD
    %% iOS Application (UI Layer)
    subgraph "iOS Application (UI Layer)"
        A1("AppDelegate.h"):::ui
        A2("AppDelegate.m"):::ui
        V1("ViewController.h"):::ui
        V2("ViewController.m"):::ui
        S1("Main.storyboard"):::ui
        S2("LaunchScreen.storyboard"):::ui
    end

    %% Exploit Module
    subgraph "Exploit Module"
        E("C Exploit Module"):::exploit
    end

    %% Project Configuration
    subgraph "Project Configuration"
        X("Xcode Project"):::config
        I("Info.plist"):::config
        L("LICENSE.md"):::config
        R("README.md"):::config
    end

    %% iOS Kernel / System Environment
    K("iOS Kernel / System Environment"):::kernel

    %% Connections
    V2 -->|"invoke_exploit"| E
    E -->|"kernel_rw_operation"| K
    X -->|"build"| A2
    I -->|"configure"| V2

    %% Styles
    classDef ui fill:#bbdefb,stroke:#0d47a1,stroke-width:2px;
    classDef exploit fill:#ffcdd2,stroke:#b71c1c,stroke-width:2px;
    classDef config fill:#c8e6c9,stroke:#2e7d32,stroke-width:2px;
    classDef kernel fill:#e0e0e0,stroke:#424242,stroke-width:2px;

    %% Click Events for iOS User Interface Layer
    click A1 "https://github.com/alfiecg24/trigon/blob/main/Trigon/AppDelegate.h"
    click A2 "https://github.com/alfiecg24/trigon/blob/main/Trigon/AppDelegate.m"
    click V1 "https://github.com/alfiecg24/trigon/blob/main/Trigon/ViewController.h"
    click V2 "https://github.com/alfiecg24/trigon/blob/main/Trigon/ViewController.m"
    click S1 "https://github.com/alfiecg24/trigon/blob/main/Trigon/Base.lproj/Main.storyboard"
    click S2 "https://github.com/alfiecg24/trigon/blob/main/Trigon/Base.lproj/LaunchScreen.storyboard"

    %% Click Event for Exploit Module
    click E "https://github.com/alfiecg24/trigon/tree/main/Trigon/Exploit"

    %% Click Events for Project Configuration
    click X "https://github.com/alfiecg24/trigon/blob/main/Trigon.xcodeproj"
    click I "https://github.com/alfiecg24/trigon/blob/main/Trigon/Info.plist"
    click L "https://github.com/alfiecg24/trigon/blob/main/LICENSE.md"
    click R "https://github.com/alfiecg24/trigon/blob/main/README.md"
```
