# ko1dyz/obfuscapk architecture

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

- Interactive diagram: https://gitdiagram.com/ko1dyz/obfuscapk
- Repository: https://github.com/ko1dyz/obfuscapk

## Overview

Obfuscapk is a black-box Android application obfuscator. Its principal workflow accepts an APK or, with the documented BundleDecompiler integration, an AAB; decompiles it, applies selected plugins sequentially to shared application state, then rebuilds and signs the output. The plugin set covers code transformation, renaming, encryption, and resource/manifest changes; VirusTotal is an optional integration. The README documents the end-to-end toolchain, while excerpts and the source index support the core orchestration and plugin relationships shown here. Some tool and plugin internals were not sampled, so those links are documented or marked unverified.

Main entry points: [`src/obfuscapk/main.py`](https://github.com/ko1dyz/obfuscapk/blob/master/src/obfuscapk/main.py) (Workflow runner), [`src/obfuscapk/obfuscation.py`](https://github.com/ko1dyz/obfuscapk/blob/master/src/obfuscapk/obfuscation.py) (APK work state), [`src/obfuscapk/tool.py`](https://github.com/ko1dyz/obfuscapk/blob/master/src/obfuscapk/tool.py) (APK toolchain), [`src/obfuscapk/cli.py`](https://github.com/ko1dyz/obfuscapk/blob/master/src/obfuscapk/cli.py) (CLI options)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Application workflow"]
  node_cli["CLI options<br/>[cli.py]"]
  node_runner["Workflow runner<br/>[main.py]"]
  node_state["APK work state<br/>[obfuscation.py]"]
end

subgraph group_plugin_system["Plugin system"]
  node_plugin_manager["Plugin discovery"]
  node_plugin_contract["Plugin contracts"]
end

subgraph group_transformations["Obfuscation techniques"]
  node_code_transforms["Code transforms"]
  node_reflection["Reflection transforms<br/>[reflection.py]"]
  node_advanced_reflection["Advanced reflection"]
  node_rename_transforms["Rename transforms"]
  node_arithmetic_branch["Arithmetic branches"]
  node_call_indirection["Call indirection"]
  node_method_overload["Method overloading<br/>[method_overload.py]"]
  node_encryption_transforms["Encryption transforms"]
  node_const_string["Constant strings"]
  node_resource_strings["Resource strings"]
  node_asset_encryption["Asset encryption"]
  node_library_encryption["Library encryption<br/>[lib_encryption.py]"]
  node_manifest["Manifest changes<br/>[random_manifest.py]"]
end

subgraph group_tooling["Build and integrations"]
  node_apk_tools["APK toolchain<br/>[tool.py]"]
  node_bundle_decompiler["Bundle decompiler"]
  node_virus_total["VirusTotal check<br/>[virus_total.py]"]
end

node_user(("CLI user"))
node_apktool["Apktool"]
node_bundle_service["BundleDecompiler"]
node_signing_tools["Signing and alignment"]
node_output["Obfuscated app"]

node_user -->|"supplies options"| node_cli
node_cli -->|"starts workflow"| node_runner
node_runner -->|"gets plugins"| node_plugin_manager
node_plugin_manager -->|"filters categories"| node_plugin_contract
node_runner -->|"creates state"| node_state
node_runner -->|"uses tools"| node_apk_tools
node_apk_tools -->|"decompiles and rebuilds"| node_apktool
node_runner -->|"supports bundles"| node_bundle_decompiler
node_bundle_decompiler -.->|"invokes"| node_bundle_service
node_runner -.->|"prepares output"| node_signing_tools
node_runner -->|"runs selected plugins"| node_code_transforms
node_runner -->|"dispatches"| node_reflection
node_runner -->|"dispatches"| node_advanced_reflection
node_runner -.->|"dispatches"| node_rename_transforms
node_runner -->|"dispatches"| node_arithmetic_branch
node_runner -->|"dispatches"| node_call_indirection
node_runner -->|"dispatches"| node_method_overload
node_runner -.->|"dispatches"| node_encryption_transforms
node_runner -->|"dispatches"| node_const_string
node_runner -->|"dispatches"| node_resource_strings
node_runner -->|"dispatches"| node_asset_encryption
node_runner -->|"dispatches"| node_library_encryption
node_runner -->|"dispatches"| node_manifest
node_runner -.->|"optionally checks"| node_virus_total
node_code_transforms -.->|"modifies"| node_state
node_reflection -->|"reads and updates"| node_state
node_advanced_reflection -->|"reads and updates"| node_state
node_arithmetic_branch -->|"reads and updates"| node_state
node_call_indirection -->|"reads and updates"| node_state
node_method_overload -->|"reads and updates"| node_state
node_const_string -->|"reads and updates"| node_state
node_resource_strings -->|"reads and updates"| node_state
node_asset_encryption -->|"reads and updates"| node_state
node_library_encryption -->|"reads and updates"| node_state
node_manifest -->|"reads and updates"| node_state
node_apk_tools -.->|"builds app"| node_output
node_signing_tools -.->|"aligns and signs"| node_output

click node_cli "https://github.com/ko1dyz/obfuscapk/blob/master/src/obfuscapk/cli.py"
click node_runner "https://github.com/ko1dyz/obfuscapk/blob/master/src/obfuscapk/main.py"
click node_state "https://github.com/ko1dyz/obfuscapk/blob/master/src/obfuscapk/obfuscation.py"
click node_plugin_manager "https://github.com/ko1dyz/obfuscapk/blob/master/src/obfuscapk/obfuscator_manager.py"
click node_plugin_contract "https://github.com/ko1dyz/obfuscapk/blob/master/src/obfuscapk/obfuscator_category.py"
click node_code_transforms "https://github.com/ko1dyz/obfuscapk/tree/master/src/obfuscapk/obfuscators"
click node_reflection "https://github.com/ko1dyz/obfuscapk/blob/master/src/obfuscapk/obfuscators/reflection/reflection.py"
click node_advanced_reflection "https://github.com/ko1dyz/obfuscapk/blob/master/src/obfuscapk/obfuscators/advanced_reflection/advanced_reflection.py"
click node_rename_transforms "https://github.com/ko1dyz/obfuscapk/tree/master/src/obfuscapk/obfuscators"
click node_arithmetic_branch "https://github.com/ko1dyz/obfuscapk/blob/master/src/obfuscapk/obfuscators/arithmetic_branch/arithmetic_branch.py"
click node_call_indirection "https://github.com/ko1dyz/obfuscapk/blob/master/src/obfuscapk/obfuscators/call_indirection/call_indirection.py"
click node_method_overload "https://github.com/ko1dyz/obfuscapk/blob/master/src/obfuscapk/obfuscators/method_overload/method_overload.py"
click node_encryption_transforms "https://github.com/ko1dyz/obfuscapk/tree/master/src/obfuscapk/obfuscators"
click node_const_string "https://github.com/ko1dyz/obfuscapk/blob/master/src/obfuscapk/obfuscators/const_string_encryption/const_string_encryption.py"
click node_resource_strings "https://github.com/ko1dyz/obfuscapk/blob/master/src/obfuscapk/obfuscators/res_string_encryption/res_string_encryption.py"
click node_asset_encryption "https://github.com/ko1dyz/obfuscapk/blob/master/src/obfuscapk/obfuscators/asset_encryption/asset_encryption.py"
click node_library_encryption "https://github.com/ko1dyz/obfuscapk/blob/master/src/obfuscapk/obfuscators/lib_encryption/lib_encryption.py"
click node_manifest "https://github.com/ko1dyz/obfuscapk/blob/master/src/obfuscapk/obfuscators/random_manifest/random_manifest.py"
click node_apk_tools "https://github.com/ko1dyz/obfuscapk/blob/master/src/obfuscapk/tool.py"
click node_bundle_decompiler "https://github.com/ko1dyz/obfuscapk/blob/master/src/obfuscapk/toolbundledecompiler.py"
click node_virus_total "https://github.com/ko1dyz/obfuscapk/blob/master/src/obfuscapk/obfuscators/virus_total/virus_total.py"

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_runner,node_state,node_user toneBlue
class node_plugin_manager,node_plugin_contract toneAmber
class node_code_transforms,node_reflection,node_advanced_reflection,node_rename_transforms,node_arithmetic_branch,node_call_indirection,node_method_overload,node_encryption_transforms,node_const_string,node_resource_strings,node_asset_encryption,node_library_encryption,node_manifest toneMint
class node_apk_tools,node_bundle_decompiler,node_virus_total toneRose
class node_apktool,node_bundle_service,node_signing_tools,node_output toneIndigo
```

## Components

### Application workflow

- [CLI options](https://github.com/ko1dyz/obfuscapk/blob/master/src/obfuscapk/cli.py): `src/obfuscapk/cli.py`
- [Workflow runner](https://github.com/ko1dyz/obfuscapk/blob/master/src/obfuscapk/main.py): `src/obfuscapk/main.py`
- [APK work state](https://github.com/ko1dyz/obfuscapk/blob/master/src/obfuscapk/obfuscation.py): `src/obfuscapk/obfuscation.py`

### Plugin system

- [Plugin discovery](https://github.com/ko1dyz/obfuscapk/blob/master/src/obfuscapk/obfuscator_manager.py): `src/obfuscapk/obfuscator_manager.py`
- [Plugin contracts](https://github.com/ko1dyz/obfuscapk/blob/master/src/obfuscapk/obfuscator_category.py): `src/obfuscapk/obfuscator_category.py`

### Obfuscation techniques

- [Code transforms](https://github.com/ko1dyz/obfuscapk/tree/master/src/obfuscapk/obfuscators): `src/obfuscapk/obfuscators`
- [Reflection transforms](https://github.com/ko1dyz/obfuscapk/blob/master/src/obfuscapk/obfuscators/reflection/reflection.py): `src/obfuscapk/obfuscators/reflection/reflection.py`
- [Advanced reflection](https://github.com/ko1dyz/obfuscapk/blob/master/src/obfuscapk/obfuscators/advanced_reflection/advanced_reflection.py): `src/obfuscapk/obfuscators/advanced_reflection/advanced_reflection.py`
- [Rename transforms](https://github.com/ko1dyz/obfuscapk/tree/master/src/obfuscapk/obfuscators): `src/obfuscapk/obfuscators`
- [Arithmetic branches](https://github.com/ko1dyz/obfuscapk/blob/master/src/obfuscapk/obfuscators/arithmetic_branch/arithmetic_branch.py): `src/obfuscapk/obfuscators/arithmetic_branch/arithmetic_branch.py`
- [Call indirection](https://github.com/ko1dyz/obfuscapk/blob/master/src/obfuscapk/obfuscators/call_indirection/call_indirection.py): `src/obfuscapk/obfuscators/call_indirection/call_indirection.py`
- [Method overloading](https://github.com/ko1dyz/obfuscapk/blob/master/src/obfuscapk/obfuscators/method_overload/method_overload.py): `src/obfuscapk/obfuscators/method_overload/method_overload.py`
- [Encryption transforms](https://github.com/ko1dyz/obfuscapk/tree/master/src/obfuscapk/obfuscators): `src/obfuscapk/obfuscators`
- [Constant strings](https://github.com/ko1dyz/obfuscapk/blob/master/src/obfuscapk/obfuscators/const_string_encryption/const_string_encryption.py): `src/obfuscapk/obfuscators/const_string_encryption/const_string_encryption.py`
- [Resource strings](https://github.com/ko1dyz/obfuscapk/blob/master/src/obfuscapk/obfuscators/res_string_encryption/res_string_encryption.py): `src/obfuscapk/obfuscators/res_string_encryption/res_string_encryption.py`
- [Asset encryption](https://github.com/ko1dyz/obfuscapk/blob/master/src/obfuscapk/obfuscators/asset_encryption/asset_encryption.py): `src/obfuscapk/obfuscators/asset_encryption/asset_encryption.py`
- [Library encryption](https://github.com/ko1dyz/obfuscapk/blob/master/src/obfuscapk/obfuscators/lib_encryption/lib_encryption.py): `src/obfuscapk/obfuscators/lib_encryption/lib_encryption.py`
- [Manifest changes](https://github.com/ko1dyz/obfuscapk/blob/master/src/obfuscapk/obfuscators/random_manifest/random_manifest.py): `src/obfuscapk/obfuscators/random_manifest/random_manifest.py`

### Build and integrations

- [APK toolchain](https://github.com/ko1dyz/obfuscapk/blob/master/src/obfuscapk/tool.py): `src/obfuscapk/tool.py`
- [Bundle decompiler](https://github.com/ko1dyz/obfuscapk/blob/master/src/obfuscapk/toolbundledecompiler.py): `src/obfuscapk/toolbundledecompiler.py`
- [VirusTotal check](https://github.com/ko1dyz/obfuscapk/blob/master/src/obfuscapk/obfuscators/virus_total/virus_total.py): `src/obfuscapk/obfuscators/virus_total/virus_total.py`

### Other components

- **CLI user**
- **Apktool**
- **BundleDecompiler**
- **Signing and alignment**
- **Obfuscated app**

## Connections

- CLI user → CLI options: supplies options (evidence: `README.md`)
- CLI options → Workflow runner: starts workflow (evidence: `src/obfuscapk/cli.py`)
- Workflow runner → Plugin discovery: gets plugins (evidence: `src/obfuscapk/main.py`)
- Plugin discovery → Plugin contracts: filters categories (evidence: `src/obfuscapk/obfuscator_manager.py`)
- Workflow runner → APK work state: creates state (evidence: `src/obfuscapk/main.py`)
- Workflow runner → APK toolchain: uses tools (evidence: `src/obfuscapk/main.py`)
- APK toolchain → Apktool: decompiles and rebuilds (evidence: `README.md`)
- Workflow runner → Bundle decompiler: supports bundles (evidence: `src/obfuscapk/main.py`)
- Bundle decompiler → BundleDecompiler: invokes (evidence: `README.md`)
- Workflow runner → Signing and alignment: prepares output (evidence: `README.md`)
- Workflow runner → Code transforms: runs selected plugins (evidence: `README.md`)
- Workflow runner → Reflection transforms: dispatches (evidence: `src/obfuscapk/main.py`)
- Workflow runner → Advanced reflection: dispatches (evidence: `src/obfuscapk/main.py`)
- Workflow runner → Rename transforms: dispatches (evidence: `README.md`)
- Workflow runner → Arithmetic branches: dispatches (evidence: `src/obfuscapk/main.py`)
- Workflow runner → Call indirection: dispatches (evidence: `src/obfuscapk/main.py`)
- Workflow runner → Method overloading: dispatches (evidence: `src/obfuscapk/main.py`)
- Workflow runner → Encryption transforms: dispatches (evidence: `README.md`)
- Workflow runner → Constant strings: dispatches (evidence: `src/obfuscapk/main.py`)
- Workflow runner → Resource strings: dispatches (evidence: `src/obfuscapk/main.py`)
- Workflow runner → Asset encryption: dispatches (evidence: `src/obfuscapk/main.py`)
- Workflow runner → Library encryption: dispatches (evidence: `src/obfuscapk/main.py`)
- Workflow runner → Manifest changes: dispatches (evidence: `src/obfuscapk/main.py`)
- Workflow runner → VirusTotal check: optionally checks (evidence: `src/obfuscapk/main.py`)
- Code transforms → APK work state: modifies (evidence: `README.md`)
- Reflection transforms → APK work state: reads and updates (evidence: `src/obfuscapk/obfuscators/reflection/reflection.py`)
- Advanced reflection → APK work state: reads and updates (evidence: `src/obfuscapk/obfuscators/advanced_reflection/advanced_reflection.py`)
- Arithmetic branches → APK work state: reads and updates (evidence: `src/obfuscapk/obfuscators/arithmetic_branch/arithmetic_branch.py`)
- Call indirection → APK work state: reads and updates (evidence: `src/obfuscapk/obfuscators/call_indirection/call_indirection.py`)
- Method overloading → APK work state: reads and updates (evidence: `src/obfuscapk/obfuscators/method_overload/method_overload.py`)
- Constant strings → APK work state: reads and updates (evidence: `src/obfuscapk/obfuscators/const_string_encryption/const_string_encryption.py`)
- Resource strings → APK work state: reads and updates (evidence: `src/obfuscapk/obfuscators/res_string_encryption/res_string_encryption.py`)
- Asset encryption → APK work state: reads and updates (evidence: `src/obfuscapk/obfuscators/asset_encryption/asset_encryption.py`)
- Library encryption → APK work state: reads and updates (evidence: `src/obfuscapk/obfuscators/lib_encryption/lib_encryption.py`)
- Manifest changes → APK work state: reads and updates (evidence: `src/obfuscapk/obfuscators/random_manifest/random_manifest.py`)
- APK toolchain → Obfuscated app: builds app (evidence: `README.md`)
- Signing and alignment → Obfuscated app: aligns and signs (evidence: `README.md`)
