# luoyesiqiu/dpt-shell architecture

> Architecture diagram of the GitHub repository luoyesiqiu/dpt-shell, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/luoyesiqiu/dpt-shell
- Repository: https://github.com/luoyesiqiu/dpt-shell

## Overview

dpt-shell is a command-line Android APK/AAB protection tool paired with a runtime shell. The main workflow accepts a package and options, transforms its DEX content, then rebuilds the package; the installed shell loads the protected app and reconstructs method code at runtime. The graph includes documented runtime risk checks and the component-factory path. Some native and packaging stages were not sampled in detail, so uncertain links are omitted or marked unverified.

Main entry points: [`dpt/src/main/java/com/luoye/dpt/builder/AndroidPackage.java`](https://github.com/luoyesiqiu/dpt-shell/blob/main/dpt/src/main/java/com/luoye/dpt/builder/AndroidPackage.java) (Package orchestrator), [`shell/src/main/cpp/dpt.cpp`](https://github.com/luoyesiqiu/dpt-shell/blob/main/shell/src/main/cpp/dpt.cpp) (DEX reconstruction), [`dpt/src/main/java/com/luoye/dpt/Dpt.java`](https://github.com/luoyesiqiu/dpt-shell/blob/main/dpt/src/main/java/com/luoye/dpt/Dpt.java) (CLI options), [`dpt/src/main/java/com/luoye/dpt/util/DexUtils.java`](https://github.com/luoyesiqiu/dpt-shell/blob/main/dpt/src/main/java/com/luoye/dpt/util/DexUtils.java) (DEX processing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_processor["Protection processor"]
  node_cli["CLI options<br/>[Dpt.java]"]
  node_config["Protection config<br/>[ShellConfig.java]"]
  node_rules["Class exclusions<br/>[ProtectRules.java]"]
  node_package["Package orchestrator"]
end

subgraph group_dex["DEX transformation"]
  node_dexutils["DEX processing<br/>[DexUtils.java]"]
  node_injector["Initializer injection"]
  node_cipher["String protection"]
  node_code["Code model<br/>[Instruction.java]"]
end

subgraph group_packaging["Package assembly"]
  node_apk["APK builder<br/>[Apk.java]"]
  node_aab["AAB builder<br/>[Aab.java]"]
  node_apkmanifest["APK manifest editor"]
  node_aabmanifest["AAB manifest editor"]
  node_protected["Protected package"]
end

subgraph group_shell["Runtime shell"]
  node_proxyapp["Proxy application"]
  node_factory["Component factory"]
  node_bridge["JNI bridge<br/>[JniBridge.java]"]
  node_shellfiles["Shell file utilities<br/>[FileUtils.java]"]
end

subgraph group_native["Native runtime"]
  node_reconstruct["DEX reconstruction<br/>[dpt.cpp]"]
  node_nativehook["Runtime hooks<br/>[dpt_hook.cpp]"]
  node_risk["Runtime risk checks<br/>[dpt_risk.cpp]"]
  node_dexnative["Native DEX model<br/>[MultiDexCode.cpp]"]
  node_nativeutils["Native utilities<br/>[dpt_util.cpp]"]
end

node_user(("Package operator"))
node_android(("Android runtime"))

node_user -->|"provides package and options"| node_cli
node_cli -->|"starts protection"| node_package
node_cli -.->|"sets options"| node_config
node_package -->|"uses settings"| node_config
node_package -->|"applies exclusions"| node_rules
node_package -->|"processes DEX"| node_dexutils
node_dexutils -->|"injects helpers"| node_injector
node_injector -->|"uses string decrypt builder"| node_cipher
node_dexutils -->|"uses instruction model"| node_code
node_package -->|"selects APK builder"| node_apk
node_package -->|"selects AAB builder"| node_aab
node_apk -->|"edits manifest"| node_apkmanifest
node_aab -->|"edits manifest"| node_aabmanifest
node_apk -.->|"builds output"| node_protected
node_aab -.->|"builds output"| node_protected
node_protected -.->|"installs and runs"| node_android
node_android -.->|"starts shell"| node_proxyapp
node_android -.->|"dispatches components"| node_factory
node_proxyapp -->|"calls native bridge"| node_bridge
node_proxyapp -->|"extracts shell files"| node_shellfiles
node_factory -->|"loads shell library"| node_bridge
node_factory -->|"extracts libraries"| node_shellfiles
node_bridge -.->|"invokes native runtime"| node_reconstruct
node_reconstruct -->|"uses DEX structures"| node_dexnative
node_reconstruct -->|"uses runtime utilities"| node_nativeutils
node_reconstruct -.->|"dispatches hooks"| node_nativehook
node_reconstruct -.->|"runs risk checks"| node_risk

click node_cli "https://github.com/luoyesiqiu/dpt-shell/blob/main/dpt/src/main/java/com/luoye/dpt/Dpt.java"
click node_config "https://github.com/luoyesiqiu/dpt-shell/blob/main/dpt/src/main/java/com/luoye/dpt/config/ShellConfig.java"
click node_rules "https://github.com/luoyesiqiu/dpt-shell/blob/main/dpt/src/main/java/com/luoye/dpt/config/ProtectRules.java"
click node_package "https://github.com/luoyesiqiu/dpt-shell/blob/main/dpt/src/main/java/com/luoye/dpt/builder/AndroidPackage.java"
click node_dexutils "https://github.com/luoyesiqiu/dpt-shell/blob/main/dpt/src/main/java/com/luoye/dpt/util/DexUtils.java"
click node_injector "https://github.com/luoyesiqiu/dpt-shell/blob/main/dpt/src/main/java/com/luoye/dpt/dex/ReflectionClinitInjector.java"
click node_cipher "https://github.com/luoyesiqiu/dpt-shell/blob/main/dpt/src/main/java/com/luoye/dpt/dex/DexStringDecryptBuilder.java"
click node_code "https://github.com/luoyesiqiu/dpt-shell/blob/main/dpt/src/main/java/com/luoye/dpt/model/Instruction.java"
click node_apk "https://github.com/luoyesiqiu/dpt-shell/blob/main/dpt/src/main/java/com/luoye/dpt/builder/Apk.java"
click node_aab "https://github.com/luoyesiqiu/dpt-shell/blob/main/dpt/src/main/java/com/luoye/dpt/builder/Aab.java"
click node_apkmanifest "https://github.com/luoyesiqiu/dpt-shell/blob/main/dpt/src/main/java/com/luoye/dpt/res/ApkManifestEditor.java"
click node_aabmanifest "https://github.com/luoyesiqiu/dpt-shell/blob/main/dpt/src/main/java/com/luoye/dpt/res/AabManifestEditor.java"
click node_proxyapp "https://github.com/luoyesiqiu/dpt-shell/blob/main/shell/src/main/java/com/luoyesiqiu/shell/ProxyApplication.java"
click node_factory "https://github.com/luoyesiqiu/dpt-shell/blob/main/shell/src/main/java/com/luoyesiqiu/shell/ProxyComponentFactory.java"
click node_bridge "https://github.com/luoyesiqiu/dpt-shell/blob/main/shell/src/main/java/com/luoyesiqiu/shell/JniBridge.java"
click node_shellfiles "https://github.com/luoyesiqiu/dpt-shell/blob/main/shell/src/main/java/com/luoyesiqiu/shell/util/FileUtils.java"
click node_reconstruct "https://github.com/luoyesiqiu/dpt-shell/blob/main/shell/src/main/cpp/dpt.cpp"
click node_nativehook "https://github.com/luoyesiqiu/dpt-shell/blob/main/shell/src/main/cpp/dpt_hook.cpp"
click node_risk "https://github.com/luoyesiqiu/dpt-shell/blob/main/shell/src/main/cpp/dpt_risk.cpp"
click node_dexnative "https://github.com/luoyesiqiu/dpt-shell/blob/main/shell/src/main/cpp/dex/MultiDexCode.cpp"
click node_nativeutils "https://github.com/luoyesiqiu/dpt-shell/blob/main/shell/src/main/cpp/dpt_util.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_config,node_rules,node_package toneBlue
class node_dexutils,node_injector,node_cipher,node_code toneAmber
class node_apk,node_aab,node_apkmanifest,node_aabmanifest,node_protected toneMint
class node_proxyapp,node_factory,node_bridge,node_shellfiles toneRose
class node_reconstruct,node_nativehook,node_risk,node_dexnative,node_nativeutils,node_user,node_android toneIndigo
```

## Components

### Protection processor

- [CLI options](https://github.com/luoyesiqiu/dpt-shell/blob/main/dpt/src/main/java/com/luoye/dpt/Dpt.java): `dpt/src/main/java/com/luoye/dpt/Dpt.java`
- [Protection config](https://github.com/luoyesiqiu/dpt-shell/blob/main/dpt/src/main/java/com/luoye/dpt/config/ShellConfig.java): `dpt/src/main/java/com/luoye/dpt/config/ShellConfig.java`
- [Class exclusions](https://github.com/luoyesiqiu/dpt-shell/blob/main/dpt/src/main/java/com/luoye/dpt/config/ProtectRules.java): `dpt/src/main/java/com/luoye/dpt/config/ProtectRules.java`
- [Package orchestrator](https://github.com/luoyesiqiu/dpt-shell/blob/main/dpt/src/main/java/com/luoye/dpt/builder/AndroidPackage.java): `dpt/src/main/java/com/luoye/dpt/builder/AndroidPackage.java`

### DEX transformation

- [DEX processing](https://github.com/luoyesiqiu/dpt-shell/blob/main/dpt/src/main/java/com/luoye/dpt/util/DexUtils.java): `dpt/src/main/java/com/luoye/dpt/util/DexUtils.java`
- [Initializer injection](https://github.com/luoyesiqiu/dpt-shell/blob/main/dpt/src/main/java/com/luoye/dpt/dex/ReflectionClinitInjector.java): `dpt/src/main/java/com/luoye/dpt/dex/ReflectionClinitInjector.java`
- [String protection](https://github.com/luoyesiqiu/dpt-shell/blob/main/dpt/src/main/java/com/luoye/dpt/dex/DexStringDecryptBuilder.java): `dpt/src/main/java/com/luoye/dpt/dex/DexStringDecryptBuilder.java`
- [Code model](https://github.com/luoyesiqiu/dpt-shell/blob/main/dpt/src/main/java/com/luoye/dpt/model/Instruction.java): `dpt/src/main/java/com/luoye/dpt/model/Instruction.java`

### Package assembly

- [APK builder](https://github.com/luoyesiqiu/dpt-shell/blob/main/dpt/src/main/java/com/luoye/dpt/builder/Apk.java): `dpt/src/main/java/com/luoye/dpt/builder/Apk.java`
- [AAB builder](https://github.com/luoyesiqiu/dpt-shell/blob/main/dpt/src/main/java/com/luoye/dpt/builder/Aab.java): `dpt/src/main/java/com/luoye/dpt/builder/Aab.java`
- [APK manifest editor](https://github.com/luoyesiqiu/dpt-shell/blob/main/dpt/src/main/java/com/luoye/dpt/res/ApkManifestEditor.java): `dpt/src/main/java/com/luoye/dpt/res/ApkManifestEditor.java`
- [AAB manifest editor](https://github.com/luoyesiqiu/dpt-shell/blob/main/dpt/src/main/java/com/luoye/dpt/res/AabManifestEditor.java): `dpt/src/main/java/com/luoye/dpt/res/AabManifestEditor.java`
- **Protected package**

### Runtime shell

- [Proxy application](https://github.com/luoyesiqiu/dpt-shell/blob/main/shell/src/main/java/com/luoyesiqiu/shell/ProxyApplication.java): `shell/src/main/java/com/luoyesiqiu/shell/ProxyApplication.java`
- [Component factory](https://github.com/luoyesiqiu/dpt-shell/blob/main/shell/src/main/java/com/luoyesiqiu/shell/ProxyComponentFactory.java): `shell/src/main/java/com/luoyesiqiu/shell/ProxyComponentFactory.java`
- [JNI bridge](https://github.com/luoyesiqiu/dpt-shell/blob/main/shell/src/main/java/com/luoyesiqiu/shell/JniBridge.java): `shell/src/main/java/com/luoyesiqiu/shell/JniBridge.java`
- [Shell file utilities](https://github.com/luoyesiqiu/dpt-shell/blob/main/shell/src/main/java/com/luoyesiqiu/shell/util/FileUtils.java): `shell/src/main/java/com/luoyesiqiu/shell/util/FileUtils.java`

### Native runtime

- [DEX reconstruction](https://github.com/luoyesiqiu/dpt-shell/blob/main/shell/src/main/cpp/dpt.cpp): `shell/src/main/cpp/dpt.cpp`
- [Runtime hooks](https://github.com/luoyesiqiu/dpt-shell/blob/main/shell/src/main/cpp/dpt_hook.cpp): `shell/src/main/cpp/dpt_hook.cpp`
- [Runtime risk checks](https://github.com/luoyesiqiu/dpt-shell/blob/main/shell/src/main/cpp/dpt_risk.cpp): `shell/src/main/cpp/dpt_risk.cpp`
- [Native DEX model](https://github.com/luoyesiqiu/dpt-shell/blob/main/shell/src/main/cpp/dex/MultiDexCode.cpp): `shell/src/main/cpp/dex/MultiDexCode.cpp`
- [Native utilities](https://github.com/luoyesiqiu/dpt-shell/blob/main/shell/src/main/cpp/dpt_util.cpp): `shell/src/main/cpp/dpt_util.cpp`

### Other components

- **Package operator**
- **Android runtime**

## Connections

- Package operator → CLI options: provides package and options (evidence: `README.md`)
- CLI options → Package orchestrator: starts protection (evidence: `dpt/src/main/java/com/luoye/dpt/Dpt.java`)
- CLI options → Protection config: sets options
- Package orchestrator → Protection config: uses settings (evidence: `dpt/src/main/java/com/luoye/dpt/builder/AndroidPackage.java`)
- Package orchestrator → Class exclusions: applies exclusions (evidence: `dpt/src/main/java/com/luoye/dpt/builder/AndroidPackage.java`)
- Package orchestrator → DEX processing: processes DEX (evidence: `dpt/src/main/java/com/luoye/dpt/builder/AndroidPackage.java`)
- DEX processing → Initializer injection: injects helpers (evidence: `dpt/src/main/java/com/luoye/dpt/util/DexUtils.java`)
- Initializer injection → String protection: uses string decrypt builder (evidence: `dpt/src/main/java/com/luoye/dpt/dex/ReflectionClinitInjector.java`)
- DEX processing → Code model: uses instruction model (evidence: `dpt/src/main/java/com/luoye/dpt/util/DexUtils.java`)
- Package orchestrator → APK builder: selects APK builder (evidence: `dpt/src/main/java/com/luoye/dpt/Dpt.java`)
- Package orchestrator → AAB builder: selects AAB builder (evidence: `dpt/src/main/java/com/luoye/dpt/Dpt.java`)
- APK builder → APK manifest editor: edits manifest (evidence: `dpt/src/main/java/com/luoye/dpt/builder/Apk.java`)
- AAB builder → AAB manifest editor: edits manifest (evidence: `dpt/src/main/java/com/luoye/dpt/builder/Aab.java`)
- APK builder → Protected package: builds output
- AAB builder → Protected package: builds output
- Protected package → Android runtime: installs and runs
- Android runtime → Proxy application: starts shell
- Android runtime → Component factory: dispatches components
- Proxy application → JNI bridge: calls native bridge (evidence: `shell/src/main/java/com/luoyesiqiu/shell/ProxyApplication.java`)
- Proxy application → Shell file utilities: extracts shell files (evidence: `shell/src/main/java/com/luoyesiqiu/shell/ProxyApplication.java`)
- Component factory → JNI bridge: loads shell library (evidence: `shell/src/main/java/com/luoyesiqiu/shell/ProxyComponentFactory.java`)
- Component factory → Shell file utilities: extracts libraries (evidence: `shell/src/main/java/com/luoyesiqiu/shell/ProxyComponentFactory.java`)
- JNI bridge → DEX reconstruction: invokes native runtime
- DEX reconstruction → Native DEX model: uses DEX structures (evidence: `shell/src/main/cpp/dpt.cpp`)
- DEX reconstruction → Native utilities: uses runtime utilities (evidence: `shell/src/main/cpp/dpt.cpp`)
- DEX reconstruction → Runtime hooks: dispatches hooks
- DEX reconstruction → Runtime risk checks: runs risk checks
