# haarsxh/android-analyzer architecture

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

- Interactive diagram: https://gitdiagram.com/haarsxh/android-analyzer
- Repository: https://github.com/haarsxh/android-analyzer

## Overview

Android Analyzer accepts APKs through a Flask web UI or REST API, runs static analysis and optional device-backed dynamic analysis, then persists findings and produces reports. The README describes the major analysis stages and integrations; sampled excerpts confirm selected auth, storage, reporting, rule-processing, and hook behavior. Several orchestration modules were not excerpted, so their documented links are represented as README-supported relationships rather than claims of source-level inspection.

Main entry points: [`app/interface/scanning.py`](https://github.com/haarsxh/android-analyzer/blob/master/app/interface/scanning.py) (Web scanning), [`app/static_analysis/static_analyzer.py`](https://github.com/haarsxh/android-analyzer/blob/master/app/static_analysis/static_analyzer.py) (Static orchestrator), [`app/dynamic_analysis/android_runtime.py`](https://github.com/haarsxh/android-analyzer/blob/master/app/dynamic_analysis/android_runtime.py) (Runtime sessions), [`app/static_analysis/sast_engine.py`](https://github.com/haarsxh/android-analyzer/blob/master/app/static_analysis/sast_engine.py) (Code scanning)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Interface and access"]
  node_flask_app["Flask application<br/>[main.py]"]
  node_web_scanning["Web scanning<br/>[scanning.py]"]
  node_api_entry["REST API<br/>[api.py]"]
  node_auth["Accounts and auth<br/>[auth_routes.py]"]
  node_access_control["Access control<br/>[authorization.py]"]
  node_security_middleware["Security middleware<br/>[security.py]"]
end

subgraph group_static["Static analysis"]
  node_static_orchestrator["Static orchestrator<br/>[static_analyzer.py]"]
  node_apk_parser["APK parsing<br/>[app.py]"]
  node_manifest_checks["Manifest checks<br/>[android_checks.py]"]
  node_sast["Code scanning<br/>[sast_engine.py]"]
  node_library_analysis["Library analysis<br/>[libraries.py]"]
  node_library_detector["Library detection"]
  node_native_scanner["Native scanning"]
  node_permission_info["Permission details<br/>[permission_info.py]"]
end

subgraph group_dynamic["Dynamic analysis"]
  node_dynamic_runtime["Runtime sessions<br/>[android_runtime.py]"]
  node_device_control["Device control<br/>[device.py]"]
  node_frida_bridge["Frida bridge<br/>[views.py]"]
  node_frida_hooks["App behavior hooks<br/>[hooks.js]"]
  node_runtime_rules["Runtime findings<br/>[runtime_rules.py]"]
  node_traffic_proxy["Traffic capture<br/>[webproxy.py]"]
  node_data_at_rest["Device data review<br/>[data_dir.py]"]
end

subgraph group_intel["Security intelligence"]
  node_malware_checks["Malware heuristics<br/>[malware_checks.py]"]
  node_reputation["Hash reputation<br/>[reputation.py]"]
  node_geolocation["Server geolocation<br/>[geolocation.py]"]
  node_firebase_check["Firebase checks"]
end

subgraph group_results["Results and storage"]
  node_scan_jobs["Background jobs<br/>[jobs.py]"]
  node_database[("SQLite results<br/>[models.py]")]
  node_reporting["Reports and trends<br/>[report.py]"]
end

node_researcher(("Security researcher"))
node_ci_client(("CI client"))
node_android_device["Android device"]

node_researcher -->|"uploads APK"| node_web_scanning
node_ci_client -->|"submits scans"| node_api_entry
node_flask_app -->|"registers routes"| node_web_scanning
node_flask_app -->|"registers routes"| node_api_entry
node_flask_app -->|"registers routes"| node_auth
node_flask_app -->|"initializes security"| node_security_middleware
node_auth -->|"manages accounts"| node_database
node_auth -->|"checks throttling"| node_security_middleware
node_web_scanning -->|"checks ownership"| node_access_control
node_web_scanning -->|"starts analysis"| node_static_orchestrator
node_api_entry -->|"queues scans"| node_scan_jobs
node_web_scanning -->|"runs background scans"| node_scan_jobs
node_static_orchestrator -->|"parses APK"| node_apk_parser
node_static_orchestrator -->|"scans decompiled code"| node_sast
node_static_orchestrator -->|"checks configuration"| node_manifest_checks
node_sast -->|"adjusts library findings"| node_library_analysis
node_sast -->|"uses detection"| node_library_detector
node_sast -->|"scans native code"| node_native_scanner
node_web_scanning -->|"describes permissions"| node_permission_info
node_static_orchestrator -.->|"checks parsed APK"| node_malware_checks
node_malware_checks -->|"looks up hash"| node_reputation
node_sast -->|"provides domains"| node_geolocation
node_static_orchestrator -.->|"checks Firebase"| node_firebase_check
node_web_scanning -->|"starts session"| node_dynamic_runtime
node_dynamic_runtime -->|"controls device"| node_device_control
node_dynamic_runtime -->|"uses Frida bridge"| node_frida_bridge
node_frida_bridge -->|"loads hooks"| node_frida_hooks
node_frida_hooks -->|"emits events"| node_runtime_rules
node_dynamic_runtime -->|"captures traffic"| node_traffic_proxy
node_dynamic_runtime -->|"reviews app data"| node_data_at_rest
node_device_control -->|"controls device"| node_android_device
node_frida_bridge -->|"attaches hooks"| node_android_device
node_traffic_proxy -.->|"captures requests"| node_android_device
node_scan_jobs -->|"executes scan"| node_static_orchestrator
node_scan_jobs -.->|"persists results"| node_database
node_reporting -->|"reads scan data"| node_database
node_web_scanning -->|"renders reports"| node_reporting
node_dynamic_runtime -.->|"scores events"| node_runtime_rules

click node_flask_app "https://github.com/haarsxh/android-analyzer/blob/master/app/main.py"
click node_web_scanning "https://github.com/haarsxh/android-analyzer/blob/master/app/interface/scanning.py"
click node_api_entry "https://github.com/haarsxh/android-analyzer/blob/master/app/interface/api.py"
click node_auth "https://github.com/haarsxh/android-analyzer/blob/master/app/interface/auth_routes.py"
click node_access_control "https://github.com/haarsxh/android-analyzer/blob/master/app/interface/authorization.py"
click node_security_middleware "https://github.com/haarsxh/android-analyzer/blob/master/app/interface/security.py"
click node_static_orchestrator "https://github.com/haarsxh/android-analyzer/blob/master/app/static_analysis/static_analyzer.py"
click node_apk_parser "https://github.com/haarsxh/android-analyzer/blob/master/app/static_analysis/app.py"
click node_manifest_checks "https://github.com/haarsxh/android-analyzer/blob/master/app/static_analysis/android_checks.py"
click node_sast "https://github.com/haarsxh/android-analyzer/blob/master/app/static_analysis/sast_engine.py"
click node_library_analysis "https://github.com/haarsxh/android-analyzer/blob/master/app/static_analysis/libraries.py"
click node_library_detector "https://github.com/haarsxh/android-analyzer/blob/master/app/static_analysis/library_detector.py"
click node_native_scanner "https://github.com/haarsxh/android-analyzer/blob/master/app/static_analysis/native_lib_scanner.py"
click node_permission_info "https://github.com/haarsxh/android-analyzer/blob/master/app/static_analysis/permission_info.py"
click node_dynamic_runtime "https://github.com/haarsxh/android-analyzer/blob/master/app/dynamic_analysis/android_runtime.py"
click node_device_control "https://github.com/haarsxh/android-analyzer/blob/master/app/dynamic_analysis/device.py"
click node_frida_bridge "https://github.com/haarsxh/android-analyzer/blob/master/app/dynamic_analysis/views.py"
click node_frida_hooks "https://github.com/haarsxh/android-analyzer/blob/master/app/dynamic_analysis/frida_scripts/hooks.js"
click node_runtime_rules "https://github.com/haarsxh/android-analyzer/blob/master/app/dynamic_analysis/runtime_rules.py"
click node_traffic_proxy "https://github.com/haarsxh/android-analyzer/blob/master/app/dynamic_analysis/webproxy.py"
click node_data_at_rest "https://github.com/haarsxh/android-analyzer/blob/master/app/dynamic_analysis/data_dir.py"
click node_malware_checks "https://github.com/haarsxh/android-analyzer/blob/master/app/security_intel/malware_checks.py"
click node_reputation "https://github.com/haarsxh/android-analyzer/blob/master/app/security_intel/reputation.py"
click node_geolocation "https://github.com/haarsxh/android-analyzer/blob/master/app/security_intel/geolocation.py"
click node_firebase_check "https://github.com/haarsxh/android-analyzer/blob/master/app/security_intel/firebase_checker.py"
click node_scan_jobs "https://github.com/haarsxh/android-analyzer/blob/master/app/storage/jobs.py"
click node_database "https://github.com/haarsxh/android-analyzer/blob/master/app/storage/models.py"
click node_reporting "https://github.com/haarsxh/android-analyzer/blob/master/app/storage/report.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_flask_app,node_web_scanning,node_api_entry,node_auth,node_access_control,node_security_middleware,node_ci_client toneBlue
class node_static_orchestrator,node_apk_parser,node_manifest_checks,node_sast,node_library_analysis,node_library_detector,node_native_scanner,node_permission_info toneAmber
class node_dynamic_runtime,node_device_control,node_frida_bridge,node_frida_hooks,node_runtime_rules,node_traffic_proxy,node_data_at_rest toneMint
class node_malware_checks,node_reputation,node_geolocation,node_firebase_check toneRose
class node_scan_jobs,node_database,node_reporting,node_researcher,node_android_device toneIndigo
```

## Components

### Interface and access

- [Flask application](https://github.com/haarsxh/android-analyzer/blob/master/app/main.py): `app/main.py`
- [Web scanning](https://github.com/haarsxh/android-analyzer/blob/master/app/interface/scanning.py): `app/interface/scanning.py`
- [REST API](https://github.com/haarsxh/android-analyzer/blob/master/app/interface/api.py): `app/interface/api.py`
- [Accounts and auth](https://github.com/haarsxh/android-analyzer/blob/master/app/interface/auth_routes.py): `app/interface/auth_routes.py`
- [Access control](https://github.com/haarsxh/android-analyzer/blob/master/app/interface/authorization.py): `app/interface/authorization.py`
- [Security middleware](https://github.com/haarsxh/android-analyzer/blob/master/app/interface/security.py): `app/interface/security.py`

### Static analysis

- [Static orchestrator](https://github.com/haarsxh/android-analyzer/blob/master/app/static_analysis/static_analyzer.py): `app/static_analysis/static_analyzer.py`
- [APK parsing](https://github.com/haarsxh/android-analyzer/blob/master/app/static_analysis/app.py): `app/static_analysis/app.py`
- [Manifest checks](https://github.com/haarsxh/android-analyzer/blob/master/app/static_analysis/android_checks.py): `app/static_analysis/android_checks.py`
- [Code scanning](https://github.com/haarsxh/android-analyzer/blob/master/app/static_analysis/sast_engine.py): `app/static_analysis/sast_engine.py`
- [Library analysis](https://github.com/haarsxh/android-analyzer/blob/master/app/static_analysis/libraries.py): `app/static_analysis/libraries.py`
- [Library detection](https://github.com/haarsxh/android-analyzer/blob/master/app/static_analysis/library_detector.py): `app/static_analysis/library_detector.py`
- [Native scanning](https://github.com/haarsxh/android-analyzer/blob/master/app/static_analysis/native_lib_scanner.py): `app/static_analysis/native_lib_scanner.py`
- [Permission details](https://github.com/haarsxh/android-analyzer/blob/master/app/static_analysis/permission_info.py): `app/static_analysis/permission_info.py`

### Dynamic analysis

- [Runtime sessions](https://github.com/haarsxh/android-analyzer/blob/master/app/dynamic_analysis/android_runtime.py): `app/dynamic_analysis/android_runtime.py`
- [Device control](https://github.com/haarsxh/android-analyzer/blob/master/app/dynamic_analysis/device.py): `app/dynamic_analysis/device.py`
- [Frida bridge](https://github.com/haarsxh/android-analyzer/blob/master/app/dynamic_analysis/views.py): `app/dynamic_analysis/views.py`
- [App behavior hooks](https://github.com/haarsxh/android-analyzer/blob/master/app/dynamic_analysis/frida_scripts/hooks.js): `app/dynamic_analysis/frida_scripts/hooks.js`
- [Runtime findings](https://github.com/haarsxh/android-analyzer/blob/master/app/dynamic_analysis/runtime_rules.py): `app/dynamic_analysis/runtime_rules.py`
- [Traffic capture](https://github.com/haarsxh/android-analyzer/blob/master/app/dynamic_analysis/webproxy.py): `app/dynamic_analysis/webproxy.py`
- [Device data review](https://github.com/haarsxh/android-analyzer/blob/master/app/dynamic_analysis/data_dir.py): `app/dynamic_analysis/data_dir.py`

### Security intelligence

- [Malware heuristics](https://github.com/haarsxh/android-analyzer/blob/master/app/security_intel/malware_checks.py): `app/security_intel/malware_checks.py`
- [Hash reputation](https://github.com/haarsxh/android-analyzer/blob/master/app/security_intel/reputation.py): `app/security_intel/reputation.py`
- [Server geolocation](https://github.com/haarsxh/android-analyzer/blob/master/app/security_intel/geolocation.py): `app/security_intel/geolocation.py`
- [Firebase checks](https://github.com/haarsxh/android-analyzer/blob/master/app/security_intel/firebase_checker.py): `app/security_intel/firebase_checker.py`

### Results and storage

- [Background jobs](https://github.com/haarsxh/android-analyzer/blob/master/app/storage/jobs.py): `app/storage/jobs.py`
- [SQLite results](https://github.com/haarsxh/android-analyzer/blob/master/app/storage/models.py): `app/storage/models.py`
- [Reports and trends](https://github.com/haarsxh/android-analyzer/blob/master/app/storage/report.py): `app/storage/report.py`

### Other components

- **Security researcher**
- **CI client**
- **Android device**

## Connections

- Security researcher → Web scanning: uploads APK
- CI client → REST API: submits scans
- Flask application → Web scanning: registers routes (evidence: `app/main.py`)
- Flask application → REST API: registers routes (evidence: `app/main.py`)
- Flask application → Accounts and auth: registers routes (evidence: `app/main.py`)
- Flask application → Security middleware: initializes security (evidence: `app/main.py`)
- Accounts and auth → SQLite results: manages accounts (evidence: `app/interface/auth_routes.py`)
- Accounts and auth → Security middleware: checks throttling (evidence: `app/interface/auth_routes.py`)
- Web scanning → Access control: checks ownership (evidence: `app/interface/scanning.py`)
- Web scanning → Static orchestrator: starts analysis (evidence: `app/interface/scanning.py`)
- REST API → Background jobs: queues scans
- Web scanning → Background jobs: runs background scans (evidence: `app/interface/scanning.py`)
- Static orchestrator → APK parsing: parses APK
- Static orchestrator → Code scanning: scans decompiled code
- Static orchestrator → Manifest checks: checks configuration
- Code scanning → Library analysis: adjusts library findings (evidence: `app/static_analysis/sast_engine.py`)
- Code scanning → Library detection: uses detection (evidence: `app/static_analysis/sast_engine.py`)
- Code scanning → Native scanning: scans native code (evidence: `app/static_analysis/sast_engine.py`)
- Web scanning → Permission details: describes permissions (evidence: `app/interface/scanning.py`)
- Static orchestrator → Malware heuristics: checks parsed APK
- Malware heuristics → Hash reputation: looks up hash (evidence: `app/security_intel/malware_checks.py`)
- Code scanning → Server geolocation: provides domains
- Static orchestrator → Firebase checks: checks Firebase
- Web scanning → Runtime sessions: starts session (evidence: `app/interface/scanning.py`)
- Runtime sessions → Device control: controls device
- Runtime sessions → Frida bridge: uses Frida bridge
- Frida bridge → App behavior hooks: loads hooks
- App behavior hooks → Runtime findings: emits events
- Runtime sessions → Traffic capture: captures traffic
- Runtime sessions → Device data review: reviews app data
- Device control → Android device: controls device
- Frida bridge → Android device: attaches hooks
- Traffic capture → Android device: captures requests
- Background jobs → Static orchestrator: executes scan
- Background jobs → SQLite results: persists results
- Reports and trends → SQLite results: reads scan data (evidence: `app/storage/report.py`)
- Web scanning → Reports and trends: renders reports (evidence: `app/interface/scanning.py`)
- Runtime sessions → Runtime findings: scores events
