# twothreetwofive/android-x-ray architecture

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

- Interactive diagram: https://gitdiagram.com/twothreetwofive/android-x-ray
- Repository: https://github.com/twothreetwofive/android-x-ray

## Overview

X-ray is an Android APK analysis dashboard and pipeline. Users upload an APK or invoke the CLI; static analysis identifies APK metadata and risk signals, then dynamic scenarios exercise the installed app while network capture records traffic. The orchestrator assembles partial module results and computes a separate aggregate risk score and security verdict, which the dashboard presents with module details. README and source-index references establish the principal connections; unsampled implementation details are omitted where their wiring is uncertain.

Main entry points: [`app.py`](https://github.com/twothreetwofive/android-x-ray/blob/main/app.py) (Streamlit dashboard), [`src/main.py`](https://github.com/twothreetwofive/android-x-ray/blob/main/src/main.py) (Pipeline orchestrator), [`src/static_analyzer/analyzer.py`](https://github.com/twothreetwofive/android-x-ray/blob/main/src/static_analyzer/analyzer.py) (Static analyzer), [`src/dynamic_analyzer/scenario_runner.py`](https://github.com/twothreetwofive/android-x-ray/blob/main/src/dynamic_analyzer/scenario_runner.py) (Scenario runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and orchestration"]
  node_dashboard["Streamlit dashboard<br/>[app.py]"]
  node_bridge["Pipeline bridge<br/>[pipeline_bridge.py]"]
  node_preflight["Device preflight<br/>[preflight.py]"]
  node_orchestrator["Pipeline orchestrator<br/>[main.py]"]
end

subgraph group_static["Static analysis"]
  node_static_analyzer["Static analyzer<br/>[analyzer.py]"]
  node_apk_prepare["APK preparation<br/>[apk_extractor.py]"]
  node_decompiler["Decompiler<br/>[decompiler.py]"]
  node_manifest["Manifest inspection<br/>[manifest_parser.py]"]
  node_code_scan["Code and string scan<br/>[code_scanner.py]"]
  node_static_signals["Certificate and SDK signals<br/>[cert_analyzer.py]"]
  node_static_score["Static risk scoring<br/>[risk_scorer.py]"]
end

subgraph group_dynamic["Dynamic analysis"]
  node_scenario_runner["Scenario runner<br/>[scenario_runner.py]"]
  node_scenarios["App scenarios<br/>[scenarios.py]"]
  node_adb["ADB controls<br/>[adb_runner.py]"]
  node_frida["Frida session"]
  node_hooks["Instrumentation hooks<br/>[hooks.bundle.js]"]
  node_event_parser["Hook event reports<br/>[message_parser.py]"]
end

subgraph group_network["Network analysis"]
  node_capture["Traffic capture<br/>[capture.py]"]
  node_scenario_capture["Scenario capture coordination"]
  node_traffic_parsers["DNS and SNI parsing<br/>[dns_parser.py]"]
  node_pcap_fallback["Scapy fallback<br/>[pcap_fallback.py]"]
  node_network_report["Network report builder<br/>[report_builder.py]"]
end

subgraph group_results["Scoring and dashboard"]
  node_aggregator["Risk and verdict aggregation<br/>[risk_aggregator.py]"]
  node_verdict_view["Verdict card<br/>[verdict_header.py]"]
  node_static_view["Static results view<br/>[static_view.py]"]
  node_static_data["Static data formatting<br/>[static_data.py]"]
  node_dynamic_view["Dynamic results view<br/>[dynamic_view.py]"]
  node_network_view["Network results view<br/>[network_view.py]"]
  node_risk_view["Risk details view<br/>[risk_view.py]"]
  node_common["Shared view helpers<br/>[common.py]"]
end

node_user(("APK analyst"))
node_emulator(("Android emulator"))

node_user -->|"uploads APK"| node_dashboard
node_dashboard -->|"runs analysis"| node_bridge
node_bridge -->|"prepares device"| node_preflight
node_bridge -->|"invokes pipeline"| node_orchestrator
node_orchestrator -->|"runs static analysis"| node_static_analyzer
node_static_analyzer -->|"prepares APK"| node_apk_prepare
node_apk_prepare -->|"runs tools"| node_decompiler
node_static_analyzer -->|"parses manifest"| node_manifest
node_static_analyzer -->|"scans code"| node_code_scan
node_static_analyzer -->|"collects signals"| node_static_signals
node_static_analyzer -->|"scores findings"| node_static_score
node_orchestrator -->|"runs scenarios"| node_scenario_runner
node_scenario_runner -->|"executes steps"| node_scenarios
node_scenario_runner -->|"controls device"| node_adb
node_scenario_runner -->|"manages hooks"| node_frida
node_frida -->|"loads script"| node_hooks
node_scenario_runner -->|"builds report"| node_event_parser
node_orchestrator -->|"coordinates capture"| node_scenario_capture
node_scenario_capture -->|"captures traffic"| node_capture
node_scenario_capture -->|"runs scenario"| node_scenario_runner
node_orchestrator -->|"parses capture"| node_traffic_parsers
node_traffic_parsers -->|"falls back to scapy"| node_pcap_fallback
node_orchestrator -->|"builds network result"| node_network_report
node_network_report -.->|"uses parsed data"| node_traffic_parsers
node_orchestrator -->|"aggregates results"| node_aggregator
node_dashboard -->|"renders verdict"| node_verdict_view
node_dashboard -->|"renders static tab"| node_static_view
node_dashboard -->|"renders dynamic tab"| node_dynamic_view
node_dashboard -->|"renders network tab"| node_network_view
node_dashboard -->|"renders risk tab"| node_risk_view
node_static_view -->|"formats data"| node_static_data
node_static_data -->|"reads manifest fields"| node_manifest
node_static_view -->|"uses helpers"| node_common
node_dynamic_view -->|"uses helpers"| node_common
node_network_view -->|"uses helpers"| node_common
node_risk_view -->|"uses helpers"| node_common
node_verdict_view -->|"uses helpers"| node_common
node_preflight -->|"checks and installs"| node_emulator
node_adb -.->|"drives app"| node_emulator
node_capture -.->|"captures packets"| node_emulator

click node_dashboard "https://github.com/twothreetwofive/android-x-ray/blob/main/app.py"
click node_bridge "https://github.com/twothreetwofive/android-x-ray/blob/main/pipeline_bridge.py"
click node_preflight "https://github.com/twothreetwofive/android-x-ray/blob/main/preflight.py"
click node_orchestrator "https://github.com/twothreetwofive/android-x-ray/blob/main/src/main.py"
click node_static_analyzer "https://github.com/twothreetwofive/android-x-ray/blob/main/src/static_analyzer/analyzer.py"
click node_apk_prepare "https://github.com/twothreetwofive/android-x-ray/blob/main/src/static_analyzer/apk_extractor.py"
click node_decompiler "https://github.com/twothreetwofive/android-x-ray/blob/main/src/static_analyzer/decompiler.py"
click node_manifest "https://github.com/twothreetwofive/android-x-ray/blob/main/src/static_analyzer/manifest_parser.py"
click node_code_scan "https://github.com/twothreetwofive/android-x-ray/blob/main/src/static_analyzer/code_scanner.py"
click node_static_signals "https://github.com/twothreetwofive/android-x-ray/blob/main/src/static_analyzer/cert_analyzer.py"
click node_static_score "https://github.com/twothreetwofive/android-x-ray/blob/main/src/static_analyzer/risk_scorer.py"
click node_scenario_runner "https://github.com/twothreetwofive/android-x-ray/blob/main/src/dynamic_analyzer/scenario_runner.py"
click node_scenarios "https://github.com/twothreetwofive/android-x-ray/blob/main/src/dynamic_analyzer/scenarios.py"
click node_adb "https://github.com/twothreetwofive/android-x-ray/blob/main/src/dynamic_analyzer/adb_runner.py"
click node_frida "https://github.com/twothreetwofive/android-x-ray/blob/main/src/dynamic_analyzer/frida_controller.py"
click node_hooks "https://github.com/twothreetwofive/android-x-ray/blob/main/src/dynamic_analyzer/hooks.bundle.js"
click node_event_parser "https://github.com/twothreetwofive/android-x-ray/blob/main/src/dynamic_analyzer/message_parser.py"
click node_capture "https://github.com/twothreetwofive/android-x-ray/blob/main/src/network_analyzer/capture.py"
click node_scenario_capture "https://github.com/twothreetwofive/android-x-ray/blob/main/src/network_analyzer/scenario_capture.py"
click node_traffic_parsers "https://github.com/twothreetwofive/android-x-ray/blob/main/src/network_analyzer/dns_parser.py"
click node_pcap_fallback "https://github.com/twothreetwofive/android-x-ray/blob/main/src/network_analyzer/pcap_fallback.py"
click node_network_report "https://github.com/twothreetwofive/android-x-ray/blob/main/src/network_analyzer/report_builder.py"
click node_aggregator "https://github.com/twothreetwofive/android-x-ray/blob/main/src/risk_aggregator.py"
click node_verdict_view "https://github.com/twothreetwofive/android-x-ray/blob/main/views/verdict_header.py"
click node_static_view "https://github.com/twothreetwofive/android-x-ray/blob/main/views/static_view.py"
click node_static_data "https://github.com/twothreetwofive/android-x-ray/blob/main/views/static_data.py"
click node_dynamic_view "https://github.com/twothreetwofive/android-x-ray/blob/main/views/dynamic_view.py"
click node_network_view "https://github.com/twothreetwofive/android-x-ray/blob/main/views/network_view.py"
click node_risk_view "https://github.com/twothreetwofive/android-x-ray/blob/main/views/risk_view.py"
click node_common "https://github.com/twothreetwofive/android-x-ray/blob/main/common.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_dashboard,node_bridge,node_preflight,node_orchestrator toneBlue
class node_static_analyzer,node_apk_prepare,node_decompiler,node_manifest,node_code_scan,node_static_signals,node_static_score toneAmber
class node_scenario_runner,node_scenarios,node_adb,node_frida,node_hooks,node_event_parser toneMint
class node_capture,node_scenario_capture,node_traffic_parsers,node_pcap_fallback,node_network_report toneRose
class node_aggregator,node_verdict_view,node_static_view,node_static_data,node_dynamic_view,node_network_view,node_risk_view,node_common,node_user,node_emulator toneIndigo
```

## Components

### Entry and orchestration

- [Streamlit dashboard](https://github.com/twothreetwofive/android-x-ray/blob/main/app.py): `app.py`
- [Pipeline bridge](https://github.com/twothreetwofive/android-x-ray/blob/main/pipeline_bridge.py): `pipeline_bridge.py`
- [Device preflight](https://github.com/twothreetwofive/android-x-ray/blob/main/preflight.py): `preflight.py`
- [Pipeline orchestrator](https://github.com/twothreetwofive/android-x-ray/blob/main/src/main.py): `src/main.py`

### Static analysis

- [Static analyzer](https://github.com/twothreetwofive/android-x-ray/blob/main/src/static_analyzer/analyzer.py): `src/static_analyzer/analyzer.py`
- [APK preparation](https://github.com/twothreetwofive/android-x-ray/blob/main/src/static_analyzer/apk_extractor.py): `src/static_analyzer/apk_extractor.py`
- [Decompiler](https://github.com/twothreetwofive/android-x-ray/blob/main/src/static_analyzer/decompiler.py): `src/static_analyzer/decompiler.py`
- [Manifest inspection](https://github.com/twothreetwofive/android-x-ray/blob/main/src/static_analyzer/manifest_parser.py): `src/static_analyzer/manifest_parser.py`
- [Code and string scan](https://github.com/twothreetwofive/android-x-ray/blob/main/src/static_analyzer/code_scanner.py): `src/static_analyzer/code_scanner.py`
- [Certificate and SDK signals](https://github.com/twothreetwofive/android-x-ray/blob/main/src/static_analyzer/cert_analyzer.py): `src/static_analyzer/cert_analyzer.py`
- [Static risk scoring](https://github.com/twothreetwofive/android-x-ray/blob/main/src/static_analyzer/risk_scorer.py): `src/static_analyzer/risk_scorer.py`

### Dynamic analysis

- [Scenario runner](https://github.com/twothreetwofive/android-x-ray/blob/main/src/dynamic_analyzer/scenario_runner.py): `src/dynamic_analyzer/scenario_runner.py`
- [App scenarios](https://github.com/twothreetwofive/android-x-ray/blob/main/src/dynamic_analyzer/scenarios.py): `src/dynamic_analyzer/scenarios.py`
- [ADB controls](https://github.com/twothreetwofive/android-x-ray/blob/main/src/dynamic_analyzer/adb_runner.py): `src/dynamic_analyzer/adb_runner.py`
- [Frida session](https://github.com/twothreetwofive/android-x-ray/blob/main/src/dynamic_analyzer/frida_controller.py): `src/dynamic_analyzer/frida_controller.py`
- [Instrumentation hooks](https://github.com/twothreetwofive/android-x-ray/blob/main/src/dynamic_analyzer/hooks.bundle.js): `src/dynamic_analyzer/hooks.bundle.js`
- [Hook event reports](https://github.com/twothreetwofive/android-x-ray/blob/main/src/dynamic_analyzer/message_parser.py): `src/dynamic_analyzer/message_parser.py`

### Network analysis

- [Traffic capture](https://github.com/twothreetwofive/android-x-ray/blob/main/src/network_analyzer/capture.py): `src/network_analyzer/capture.py`
- [Scenario capture coordination](https://github.com/twothreetwofive/android-x-ray/blob/main/src/network_analyzer/scenario_capture.py): `src/network_analyzer/scenario_capture.py`
- [DNS and SNI parsing](https://github.com/twothreetwofive/android-x-ray/blob/main/src/network_analyzer/dns_parser.py): `src/network_analyzer/dns_parser.py`
- [Scapy fallback](https://github.com/twothreetwofive/android-x-ray/blob/main/src/network_analyzer/pcap_fallback.py): `src/network_analyzer/pcap_fallback.py`
- [Network report builder](https://github.com/twothreetwofive/android-x-ray/blob/main/src/network_analyzer/report_builder.py): `src/network_analyzer/report_builder.py`

### Scoring and dashboard

- [Risk and verdict aggregation](https://github.com/twothreetwofive/android-x-ray/blob/main/src/risk_aggregator.py): `src/risk_aggregator.py`
- [Verdict card](https://github.com/twothreetwofive/android-x-ray/blob/main/views/verdict_header.py): `views/verdict_header.py`
- [Static results view](https://github.com/twothreetwofive/android-x-ray/blob/main/views/static_view.py): `views/static_view.py`
- [Static data formatting](https://github.com/twothreetwofive/android-x-ray/blob/main/views/static_data.py): `views/static_data.py`
- [Dynamic results view](https://github.com/twothreetwofive/android-x-ray/blob/main/views/dynamic_view.py): `views/dynamic_view.py`
- [Network results view](https://github.com/twothreetwofive/android-x-ray/blob/main/views/network_view.py): `views/network_view.py`
- [Risk details view](https://github.com/twothreetwofive/android-x-ray/blob/main/views/risk_view.py): `views/risk_view.py`
- [Shared view helpers](https://github.com/twothreetwofive/android-x-ray/blob/main/common.py): `common.py`

### Other components

- **APK analyst**
- **Android emulator**

## Connections

- APK analyst → Streamlit dashboard: uploads APK (evidence: `app.py`)
- Streamlit dashboard → Pipeline bridge: runs analysis (evidence: `app.py`)
- Pipeline bridge → Device preflight: prepares device (evidence: `pipeline_bridge.py`)
- Pipeline bridge → Pipeline orchestrator: invokes pipeline (evidence: `pipeline_bridge.py`)
- Pipeline orchestrator → Static analyzer: runs static analysis (evidence: `src/main.py`)
- Static analyzer → APK preparation: prepares APK (evidence: `src/static_analyzer/analyzer.py`)
- APK preparation → Decompiler: runs tools (evidence: `src/static_analyzer/apk_extractor.py`)
- Static analyzer → Manifest inspection: parses manifest (evidence: `src/static_analyzer/analyzer.py`)
- Static analyzer → Code and string scan: scans code (evidence: `src/static_analyzer/analyzer.py`)
- Static analyzer → Certificate and SDK signals: collects signals (evidence: `src/static_analyzer/analyzer.py`)
- Static analyzer → Static risk scoring: scores findings (evidence: `src/static_analyzer/analyzer.py`)
- Pipeline orchestrator → Scenario runner: runs scenarios (evidence: `src/main.py`)
- Scenario runner → App scenarios: executes steps (evidence: `src/dynamic_analyzer/scenario_runner.py`)
- Scenario runner → ADB controls: controls device (evidence: `src/dynamic_analyzer/scenario_runner.py`)
- Scenario runner → Frida session: manages hooks (evidence: `src/dynamic_analyzer/scenario_runner.py`)
- Frida session → Instrumentation hooks: loads script (evidence: `src/dynamic_analyzer/frida_controller.py`)
- Scenario runner → Hook event reports: builds report (evidence: `src/dynamic_analyzer/scenario_runner.py`)
- Pipeline orchestrator → Scenario capture coordination: coordinates capture (evidence: `src/main.py`)
- Scenario capture coordination → Traffic capture: captures traffic (evidence: `src/network_analyzer/scenario_capture.py`)
- Scenario capture coordination → Scenario runner: runs scenario (evidence: `src/network_analyzer/scenario_capture.py`)
- Pipeline orchestrator → DNS and SNI parsing: parses capture (evidence: `src/main.py`)
- DNS and SNI parsing → Scapy fallback: falls back to scapy (evidence: `src/network_analyzer/dns_parser.py`)
- Pipeline orchestrator → Network report builder: builds network result (evidence: `src/main.py`)
- Network report builder → DNS and SNI parsing: uses parsed data
- Pipeline orchestrator → Risk and verdict aggregation: aggregates results (evidence: `src/main.py`)
- Streamlit dashboard → Verdict card: renders verdict (evidence: `app.py`)
- Streamlit dashboard → Static results view: renders static tab (evidence: `app.py`)
- Streamlit dashboard → Dynamic results view: renders dynamic tab (evidence: `app.py`)
- Streamlit dashboard → Network results view: renders network tab (evidence: `app.py`)
- Streamlit dashboard → Risk details view: renders risk tab (evidence: `app.py`)
- Static results view → Static data formatting: formats data (evidence: `views/static_view.py`)
- Static data formatting → Manifest inspection: reads manifest fields (evidence: `views/static_data.py`)
- Static results view → Shared view helpers: uses helpers (evidence: `views/static_view.py`)
- Dynamic results view → Shared view helpers: uses helpers (evidence: `views/dynamic_view.py`)
- Network results view → Shared view helpers: uses helpers (evidence: `views/network_view.py`)
- Risk details view → Shared view helpers: uses helpers (evidence: `views/risk_view.py`)
- Verdict card → Shared view helpers: uses helpers (evidence: `views/verdict_header.py`)
- Device preflight → Android emulator: checks and installs
- ADB controls → Android emulator: drives app
- Traffic capture → Android emulator: captures packets
