# sensepost/objection architecture

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

- Interactive diagram: https://gitdiagram.com/sensepost/objection
- Repository: https://github.com/sensepost/objection

## Overview

##### Main Components Identification

The system should be divided into these primary components:

a) Command-Line Interface Layer
- Console/REPL component (objection/console/)
- Command handling system (objection/commands/)
- Help system (objection/console/helpfiles/)

b) Core Runtime Layer
- Agent system (agent/ directory - TypeScript based)
- State management (objection/state/)
- API services (objection/api/)

c) Platform-Specific Components
- iOS modules (agent/src/ios/ & objection/commands/ios/)
- Android modules (agent/src/android/ & objection/commands/android/)
- Generic modules (agent/src/generic/)

d) Plugin System
- Plugin manager (objection/commands/plugin_manager.py)
- Plugin implementations (plugins/ directory)

##### Component Relationships

**[CLI Layer] → [Core Runtime] → [Frida Integration] → [Mobile Device]**
- ↓
- [Platform-Specific Modules]
- ↓
- [Plugin System]

##### Specific Elements

a) Core Functionality Flow:
- Command input → Command parsing → RPC execution → Mobile device interaction
- Agent injection and communication paths
- State management flow

b) Platform-Specific Features:
- iOS-specific capabilities (keychain, binary cookies, bundles)
- Android-specific features (intents, keystore, root detection)
- Common features (memory operations, file system access)

c) Integration Points:
- Frida integration interface
- Plugin system hooks
- API endpoints

##### Important Architectural Patterns to Highlight

- Command Pattern (in commands/ directory)
- Plugin Architecture (plugins/ directory)
- RPC Communication (agent/src/rpc/)
- State Management (objection/state/)

##### Technical Details

- TypeScript agent architecture
- Python-based command processing
- Frida runtime injection
- Cross-platform compatibility layer

##### User Interface Layer (Top)
- CLI interface
- Command processing
- Help system

##### Core Services Layer (Middle)
- State management
- API services
- Runtime coordination

##### Platform Layer (Bottom)
- iOS/Android specific implementations
- Frida integration
- Device communication

- Component types
- Communication paths
- Security boundaries
- Plugin extension points

Keep the abstraction level high enough to show the overall architecture while including enough detail to understand the system's security-focused nature and mobile runtime exploration capabilities.

Remember to emphasize the bidirectional nature of communication between the host system and mobile device, and highlight security-critical paths where sensitive data flows through the system.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef cli fill:#3498db,stroke:#2980b9,color:white
    classDef core fill:#2ecc71,stroke:#27ae60,color:white
    classDef platform fill:#e74c3c,stroke:#c0392b,color:white
    classDef plugin fill:#f1c40f,stroke:#f39c12,color:black
    classDef external fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef security fill:#e74c3c,stroke:#c0392b,color:white

    %% User Interface Layer
    subgraph UI
        CLI["CLI Interface"]:::cli
        REPL["Console/REPL"]:::cli
        CMD["Command Handler"]:::cli
        HELP["Help System"]:::cli
    end

    %% Core Services Layer
    subgraph Core
        STATE["State Manager"]:::core
        API["API Services"]:::core
        RUNTIME["Runtime Coordinator"]:::core
        RPC["RPC Communication"]:::core
        UTILS["Core Utilities"]:::core
    end

    %% Platform Layer
    subgraph Platform
        FRIDA["Frida Integration"]:::external
        
        subgraph Mobile
            IOS["iOS Modules"]:::platform
            ANDROID["Android Modules"]:::platform
            GENERIC["Generic Modules"]:::platform
        end
        
        PATCHER["Platform Patchers"]:::security
    end

    %% Plugin System
    subgraph Plugins
        PLUGIN_MGR["Plugin Manager"]:::plugin
        PLUGIN_IMPL["Plugin Implementations"]:::plugin
    end

    %% Relationships
    CLI --> REPL
    REPL --> CMD
    CMD --> HELP
    CMD --> STATE
    CMD --> API
    API --> RUNTIME
    RUNTIME --> RPC
    RPC --> FRIDA
    FRIDA --> IOS
    FRIDA --> ANDROID
    FRIDA --> GENERIC
    STATE --> UTILS
    UTILS --> PATCHER
    CMD --> PLUGIN_MGR
    PLUGIN_MGR --> PLUGIN_IMPL
    PLUGIN_IMPL --> RUNTIME

    %% Click Events
    click REPL "https://github.com/sensepost/objection/tree/master/objection/console/"
    click CMD "https://github.com/sensepost/objection/tree/master/objection/commands/"
    click HELP "https://github.com/sensepost/objection/tree/master/objection/console/helpfiles/"
    click RPC "https://github.com/sensepost/objection/tree/master/agent/src/rpc/"
    click STATE "https://github.com/sensepost/objection/tree/master/objection/state/"
    click API "https://github.com/sensepost/objection/tree/master/objection/api/"
    click IOS "https://github.com/sensepost/objection/tree/master/agent/src/ios/"
    click ANDROID "https://github.com/sensepost/objection/tree/master/agent/src/android/"
    click GENERIC "https://github.com/sensepost/objection/tree/master/agent/src/generic/"
    click PLUGIN_MGR "https://github.com/sensepost/objection/blob/master/objection/commands/plugin_manager.py"
    click PLUGIN_IMPL "https://github.com/sensepost/objection/tree/master/plugins/"
    click UTILS "https://github.com/sensepost/objection/tree/master/objection/utils/"
    click PATCHER "https://github.com/sensepost/objection/tree/master/objection/utils/patchers/"

    %% Legend
    subgraph Legend
        L1["CLI Components"]:::cli
        L2["Core Services"]:::core
        L3["Platform Specific"]:::platform
        L4["Plugin System"]:::plugin
        L5["External Services"]:::external
        L6["Security Critical"]:::security
    end
```
