# abisheikm1/tribunal architecture

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

- Interactive diagram: https://gitdiagram.com/abisheikm1/tribunal
- Repository: https://github.com/abisheikm1/tribunal

## Overview

#### Purpose and Entry Points
Tribunal is an authorized Android APK pentest pipeline. An APK placed under `apk/` is the sole scope boundary; analysis state is isolated by APK SHA-256 under `targets/<hash>/`. The practical entry points are the runbook at `skills/pentest-runbook/SKILL.md`, static inventory script `skills/decompile-threat-review/scripts/inventory.py`, and shared enforcement/runtime helpers in `scripts/harness.py` and `scripts/scope_gate.py`.

#### 1. Scope, Identity, and Per-APK State
The pipeline resolves and rejects APK paths outside `apk/`, computes a content hash, and creates the target workspace. This boundary prevents later stages from accepting arbitrary APK paths. Structured artifacts—inventory, threat model, findings, status, evidence, Frida assets—cross stages through `targets/<apk-sha256>/`, while decompiler output remains available for manual source pivots.
Paths: `scripts/harness.py`, `scripts/scope_gate.py`, `apk/README.md`.

#### 2. Static Decompilation and Inventory
Static review starts by invoking APKTool and JADX, generating manifest/resource and Java-like source trees under the target workspace. Inventory produces the baseline used by agent review and specialist analyses. Vendored tool distributions avoid a separate JADX/APKTool installation, though Java is required.
Paths: `skills/decompile-threat-review/scripts/inventory.py`, `tools/apktool/apktool.jar`, `tools/jadx/bin/jadx`.

#### 3. Threat Modeling and Adversarial Static Review
The `decompile-threat-review` skill is the primary static-analysis control plane. It uses the vulnerability catalog/rubric to build `threat_model.json`, identify candidate findings in `report.json`, map chains, and measure review coverage. The default stage-1 workflow fans out structural and disjoint rubric reviews, then applies skeptical review before candidates advance.
Paths: `skills/decompile-threat-review/SKILL.md`, `.claude/workflows/android-adversarial-review.js`, `docs/vuln-catalog.md`.

#### 4. Specialized Static Audit Skills
Focused skill modules inspect common Android risk surfaces: exported components, deep links, implicit intents, WebViews, local authentication, dynamic code execution, native libraries, dependencies, and API surface. They consume the decompiled target data and support the broader static-review evidence rather than forming separate final-report pipelines.
Paths: `skills/exported-components/scripts/detect_exported.py`, `skills/webview-audit/scripts/scan_webview.py`, `skills/native-audit/scripts/triage_native.py`.

#### 5. Dynamic Verification Boundary
Human-operated emulator, ADB, Burp Suite, and Frida form the dynamic boundary. Preflight checks readiness; the verifier scaffolds evidence and updates finding status after observed validation. Frida pinning bypasses are templates or targeted, source-informed hooks, stored per target. Missing optional tools degrade gracefully rather than being bundled.
Paths: `scripts/preflight_check.py`, `skills/dynamic-verify/scripts/verify_runner.py`, `skills/dynamic-verify/scripts/frida/bypass_template.js`.

#### 6. API Discovery and Server-Side Testing
After traffic capture through Burp, API testing imports Burp XML history, extracts endpoint evidence into `api_findings.json`, and directs assessment of authorization, injection, and business-logic risks. This is a separate server-side testing stage but shares target identity and evidence with static/dynamic stages.
Paths: `skills/api-vuln-test/scripts/extract_endpoints.py`, `skills/api-vuln-test/SKILL.md`, `targets/`.

#### 7. Courtroom Decision and Report Publication
Only findings marked confirmed enter an agent-driven prosecution/defense/judge workflow. Verdict records prevent retrial; guilty findings become Markdown reports organized by application package. Thus `report/` is an output boundary, not a raw scan dump.
Paths: `skills/courtroom-verdict/SKILL.md`, `.claude/workflows/android-courtroom-verdict.js`, `report/README.md`.

#### Runtime and Legacy Boundary
Deterministic scripts require Python 3.10+ and standard library; Java runs vendored decompilers. Dynamic work additionally depends on Android Studio emulator, ADB, Frida/frida-server, Objection, and Burp. `legacy-harness/` is superseded by the skill-based pipeline and should not define new architecture.
Paths: `legacy-harness/README.md`, `docs/DESIGN.md`, `CLAUDE.md`.

Main entry points: [`scripts/harness.py`](https://github.com/abisheikm1/tribunal/blob/main/scripts/harness.py) (Target workspace), [`tools/apktool/apktool.jar`](https://github.com/abisheikm1/tribunal/blob/main/tools/apktool/apktool.jar) (Vendored decompilers), [`skills/decompile-threat-review/SKILL.md`](https://github.com/abisheikm1/tribunal/blob/main/skills/decompile-threat-review/SKILL.md) (Threat review), [`skills/dynamic-verify/scripts/verify_runner.py`](https://github.com/abisheikm1/tribunal/blob/main/skills/dynamic-verify/scripts/verify_runner.py) (Dynamic verifier)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_scope["Scope &amp; State"]
  node_apk["Scoped APK input<br/>input boundary<br/>[README.md]"]
  node_scope_gate["Scope gate<br/>enforcement<br/>[scope_gate.py]"]
  node_harness["Target workspace<br/>runtime helper<br/>[harness.py]"]
  node_target_state[("Per-APK artifacts<br/>workspace")]
end

subgraph group_static["Static Analysis"]
  node_decompilers["Vendored decompilers<br/>toolchain<br/>[apktool.jar]"]
  node_jadx["JADX launcher<br/>toolchain"]
  node_inventory["Static inventory<br/>analysis script<br/>[inventory.py]"]
  node_static_review["Threat review<br/>skill control plane<br/>[SKILL.md]"]
  node_adversarial_workflow["Adversarial review<br/>agent workflow"]
  node_vuln_catalog["Vulnerability rubric<br/>knowledge base<br/>[vuln-catalog.md]"]
  node_specialist_audits["Specialist audits<br/>static audit skills<br/>[detect_exported.py]"]
end

subgraph group_dynamic["Dynamic &amp; API Verification"]
  node_preflight["Dynamic preflight<br/>readiness check<br/>[preflight_check.py]"]
  node_dynamic_verify["Dynamic verifier<br/>verification runner<br/>[verify_runner.py]"]
  node_frida_assets["Frida hooks<br/>per-target assets<br/>[bypass_template.js]"]
  node_api_testing["API evidence testing<br/>server-side skill"]
end

subgraph group_decision["Decision &amp; Publication"]
  node_courtroom["Courtroom verdict<br/>decision workflow<br/>[SKILL.md]"]
  node_verdict_workflow["Verdict workflow<br/>agent workflow"]
  node_reports["Published reports<br/>output boundary<br/>[README.md]"]
end

node_apk -->|"submit"| node_scope_gate
node_scope_gate -->|"approved APK"| node_harness
node_harness -->|"hashes and initializes"| node_target_state
node_harness -->|"decompile target"| node_decompilers
node_decompilers -->|"source output"| node_jadx
node_jadx -->|"decompiled source"| node_target_state
node_decompilers -->|"manifest and resources"| node_target_state
node_target_state -->|"decompiled data"| node_inventory
node_inventory -->|"baseline inventory"| node_static_review
node_vuln_catalog -->|"rubric"| node_static_review
node_static_review -->|"candidate review"| node_adversarial_workflow
node_adversarial_workflow -->|"threat model and findings"| node_target_state
node_target_state -->|"static evidence"| node_specialist_audits
node_specialist_audits -->|"supporting evidence"| node_target_state
node_target_state -->|"target context"| node_preflight
node_preflight -->|"ready environment"| node_dynamic_verify
node_frida_assets -->|"hooks"| node_dynamic_verify
node_dynamic_verify -->|"validation evidence and status"| node_target_state
node_target_state -->|"identity and evidence"| node_api_testing
node_api_testing -->|"endpoint findings"| node_target_state
node_target_state -->|"confirmed findings"| node_courtroom
node_courtroom -->|"case decision"| node_verdict_workflow
node_verdict_workflow -->|"guilty findings"| node_reports

click node_apk "https://github.com/abisheikm1/tribunal/blob/main/apk/README.md"
click node_scope_gate "https://github.com/abisheikm1/tribunal/blob/main/scripts/scope_gate.py"
click node_harness "https://github.com/abisheikm1/tribunal/blob/main/scripts/harness.py"
click node_decompilers "https://github.com/abisheikm1/tribunal/blob/main/tools/apktool/apktool.jar"
click node_jadx "https://github.com/abisheikm1/tribunal/blob/main/tools/jadx/bin/jadx"
click node_inventory "https://github.com/abisheikm1/tribunal/blob/main/skills/decompile-threat-review/scripts/inventory.py"
click node_static_review "https://github.com/abisheikm1/tribunal/blob/main/skills/decompile-threat-review/SKILL.md"
click node_adversarial_workflow "https://github.com/abisheikm1/tribunal/blob/main/.claude/workflows/android-adversarial-review.js"
click node_vuln_catalog "https://github.com/abisheikm1/tribunal/blob/main/docs/vuln-catalog.md"
click node_specialist_audits "https://github.com/abisheikm1/tribunal/blob/main/skills/exported-components/scripts/detect_exported.py"
click node_preflight "https://github.com/abisheikm1/tribunal/blob/main/scripts/preflight_check.py"
click node_dynamic_verify "https://github.com/abisheikm1/tribunal/blob/main/skills/dynamic-verify/scripts/verify_runner.py"
click node_frida_assets "https://github.com/abisheikm1/tribunal/blob/main/skills/dynamic-verify/scripts/frida/bypass_template.js"
click node_api_testing "https://github.com/abisheikm1/tribunal/blob/main/skills/api-vuln-test/scripts/extract_endpoints.py"
click node_courtroom "https://github.com/abisheikm1/tribunal/blob/main/skills/courtroom-verdict/SKILL.md"
click node_verdict_workflow "https://github.com/abisheikm1/tribunal/blob/main/.claude/workflows/android-courtroom-verdict.js"
click node_reports "https://github.com/abisheikm1/tribunal/blob/main/report/README.md"

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_apk,node_scope_gate,node_harness,node_target_state toneBlue
class node_decompilers,node_jadx,node_inventory,node_static_review,node_adversarial_workflow,node_vuln_catalog,node_specialist_audits toneAmber
class node_preflight,node_dynamic_verify,node_frida_assets,node_api_testing toneMint
class node_courtroom,node_verdict_workflow,node_reports toneRose
```

## Components

### Scope & State

- [Scoped APK input](https://github.com/abisheikm1/tribunal/blob/main/apk/README.md): input boundary · Only APKs under apk/ are accepted. · `apk/README.md`
- [Scope gate](https://github.com/abisheikm1/tribunal/blob/main/scripts/scope_gate.py): enforcement · Resolves APK paths and rejects out-of-scope inputs. · `scripts/scope_gate.py`
- [Target workspace](https://github.com/abisheikm1/tribunal/blob/main/scripts/harness.py): runtime helper · Hashes APK content and manages isolated per-target state. · `scripts/harness.py`
- **Per-APK artifacts**: workspace · State and evidence live under targets/<apk-sha256>/.

### Static Analysis

- [Vendored decompilers](https://github.com/abisheikm1/tribunal/blob/main/tools/apktool/apktool.jar): toolchain · APKTool and JADX produce resources, manifest, and source pivots. · `tools/apktool/apktool.jar`
- [JADX launcher](https://github.com/abisheikm1/tribunal/blob/main/tools/jadx/bin/jadx): toolchain · `tools/jadx/bin/jadx`
- [Static inventory](https://github.com/abisheikm1/tribunal/blob/main/skills/decompile-threat-review/scripts/inventory.py): analysis script · Builds the baseline inventory from decompiled target data. · `skills/decompile-threat-review/scripts/inventory.py`
- [Threat review](https://github.com/abisheikm1/tribunal/blob/main/skills/decompile-threat-review/SKILL.md): skill control plane · Builds threat model, candidates, chains, and coverage. · `skills/decompile-threat-review/SKILL.md`
- [Adversarial review](https://github.com/abisheikm1/tribunal/blob/main/.claude/workflows/android-adversarial-review.js): agent workflow · Fans out rubric review and applies skeptical candidate review. · `.claude/workflows/android-adversarial-review.js`
- [Vulnerability rubric](https://github.com/abisheikm1/tribunal/blob/main/docs/vuln-catalog.md): knowledge base · `docs/vuln-catalog.md`
- [Specialist audits](https://github.com/abisheikm1/tribunal/blob/main/skills/exported-components/scripts/detect_exported.py): static audit skills · Inspects Android-specific risk surfaces to support static evidence. · `skills/exported-components/scripts/detect_exported.py`

### Dynamic & API Verification

- [Dynamic preflight](https://github.com/abisheikm1/tribunal/blob/main/scripts/preflight_check.py): readiness check · Checks human-operated dynamic tooling readiness. · `scripts/preflight_check.py`
- [Dynamic verifier](https://github.com/abisheikm1/tribunal/blob/main/skills/dynamic-verify/scripts/verify_runner.py): verification runner · Scaffolds evidence and updates finding status after validation. · `skills/dynamic-verify/scripts/verify_runner.py`
- [Frida hooks](https://github.com/abisheikm1/tribunal/blob/main/skills/dynamic-verify/scripts/frida/bypass_template.js): per-target assets · Templates and targeted source-informed hooks. · `skills/dynamic-verify/scripts/frida/bypass_template.js`
- [API evidence testing](https://github.com/abisheikm1/tribunal/blob/main/skills/api-vuln-test/scripts/extract_endpoints.py): server-side skill · Imports Burp history and extracts endpoint findings for API assessment. · `skills/api-vuln-test/scripts/extract_endpoints.py`

### Decision & Publication

- [Courtroom verdict](https://github.com/abisheikm1/tribunal/blob/main/skills/courtroom-verdict/SKILL.md): decision workflow · Only confirmed findings undergo prosecution, defense, and judgment. · `skills/courtroom-verdict/SKILL.md`
- [Verdict workflow](https://github.com/abisheikm1/tribunal/blob/main/.claude/workflows/android-courtroom-verdict.js): agent workflow · Verdict records prevent retrial. · `.claude/workflows/android-courtroom-verdict.js`
- [Published reports](https://github.com/abisheikm1/tribunal/blob/main/report/README.md): output boundary · Guilty findings become package-organized Markdown reports. · `report/README.md`

## Connections

- Scoped APK input → Scope gate: submit
- Scope gate → Target workspace: approved APK
- Target workspace → Per-APK artifacts: hashes and initializes
- Target workspace → Vendored decompilers: decompile target
- Vendored decompilers → JADX launcher: source output
- JADX launcher → Per-APK artifacts: decompiled source
- Vendored decompilers → Per-APK artifacts: manifest and resources
- Per-APK artifacts → Static inventory: decompiled data
- Static inventory → Threat review: baseline inventory
- Vulnerability rubric → Threat review: rubric
- Threat review → Adversarial review: candidate review
- Adversarial review → Per-APK artifacts: threat model and findings
- Per-APK artifacts → Specialist audits: static evidence
- Specialist audits → Per-APK artifacts: supporting evidence
- Per-APK artifacts → Dynamic preflight: target context
- Dynamic preflight → Dynamic verifier: ready environment
- Frida hooks → Dynamic verifier: hooks
- Dynamic verifier → Per-APK artifacts: validation evidence and status
- Per-APK artifacts → API evidence testing: identity and evidence
- API evidence testing → Per-APK artifacts: endpoint findings
- Per-APK artifacts → Courtroom verdict: confirmed findings
- Courtroom verdict → Verdict workflow: case decision
- Verdict workflow → Published reports: guilty findings
