# zahraaabidha/astra architecture

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

- Interactive diagram: https://gitdiagram.com/zahraaabidha/astra
- Repository: https://github.com/zahraaabidha/astra

## Overview

ASTRA is a prototype malware-analysis service: an analyst submits a file, the backend extracts features, scores risk, conditionally runs Tier 2 analysis, and returns a structured report for review. The implemented pipeline and API support this core workflow; the README also describes multi-format routing and cross-sample knowledge-graph capabilities, but the graph directory has no implementation shown. Dynamic sandbox verification is likewise described as a capability, while sampled Tier 2 code validates citations. Upload and history page internals were not sampled, so their API wiring is omitted.

Main entry points: [`backend/api/main.py`](https://github.com/zahraaabidha/astra/blob/main/backend/api/main.py) (HTTP API), [`frontend/src/App.tsx`](https://github.com/zahraaabidha/astra/blob/main/frontend/src/App.tsx) (Dashboard shell), [`backend/pipeline.py`](https://github.com/zahraaabidha/astra/blob/main/backend/pipeline.py) (Analysis orchestrator), [`backend/ml/train.py`](https://github.com/zahraaabidha/astra/blob/main/backend/ml/train.py) (Classifier training)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Analyst interface"]
  node_app["Dashboard shell<br/>[App.tsx]"]
  node_upload["File upload<br/>[UploadPage.tsx]"]
  node_results["Report view<br/>[ResultsPage.tsx]"]
  node_history["Analysis history<br/>[HistoryPage.tsx]"]
  node_navbar["Service status<br/>[Navbar.tsx]"]
end

subgraph group_service["Analysis service"]
  node_api["HTTP API<br/>[main.py]"]
  node_pipeline["Analysis orchestrator<br/>[pipeline.py]"]
  node_reporter["Report builder<br/>[reporter.py]"]
end

subgraph group_tier1["Feature scoring"]
  node_extractor["Format extraction<br/>[extractor.py]"]
  node_scorer["Risk scorer<br/>[scorer.py]"]
  node_training["Classifier training<br/>[train.py]"]
end

subgraph group_tier2["Deep analysis"]
  node_tier2["Reverse engineering<br/>[deobfuscator.py]"]
  node_knowledge_graph[("Campaign graph")]
end

subgraph group_state["Analysis state"]
  node_training_data["Training data<br/>[training_data.csv]"]
  node_model_store["Model artifacts"]
  node_sample_store["Uploaded samples<br/>[main.py]"]
  node_job_store["Job status<br/>[main.py]"]
  node_report_store["Saved reports<br/>[main.py]"]
  node_reference_db[("Bank references<br/>[bank_apps.json]")]
end

node_analyst(("Analyst"))
node_ollama["Ollama model service"]

node_analyst -->|"uses"| node_app
node_app -->|"shows"| node_upload
node_app -->|"shows"| node_results
node_app -->|"shows"| node_history
node_app -->|"shows"| node_navbar
node_navbar -->|"checks health"| node_api
node_results -->|"fetches report"| node_api
node_api -->|"writes upload"| node_sample_store
node_api -->|"tracks job"| node_job_store
node_api -->|"dispatches analysis"| node_pipeline
node_pipeline -->|"extracts features"| node_extractor
node_extractor -->|"reads bank data"| node_reference_db
node_pipeline -->|"scores features"| node_scorer
node_pipeline -->|"routes when needed"| node_tier2
node_tier2 -->|"requests analysis"| node_ollama
node_pipeline -->|"builds report"| node_reporter
node_api -->|"writes report"| node_report_store
node_training -->|"trains from"| node_training_data
node_training -->|"saves model"| node_model_store
node_scorer -->|"loads model"| node_model_store

click node_app "https://github.com/zahraaabidha/astra/blob/main/frontend/src/App.tsx"
click node_upload "https://github.com/zahraaabidha/astra/blob/main/frontend/src/pages/UploadPage.tsx"
click node_results "https://github.com/zahraaabidha/astra/blob/main/frontend/src/pages/ResultsPage.tsx"
click node_history "https://github.com/zahraaabidha/astra/blob/main/frontend/src/pages/HistoryPage.tsx"
click node_navbar "https://github.com/zahraaabidha/astra/blob/main/frontend/src/components/Navbar.tsx"
click node_api "https://github.com/zahraaabidha/astra/blob/main/backend/api/main.py"
click node_pipeline "https://github.com/zahraaabidha/astra/blob/main/backend/pipeline.py"
click node_extractor "https://github.com/zahraaabidha/astra/blob/main/analysis/static/extractor.py"
click node_scorer "https://github.com/zahraaabidha/astra/blob/main/backend/ml/scorer.py"
click node_training "https://github.com/zahraaabidha/astra/blob/main/backend/ml/train.py"
click node_training_data "https://github.com/zahraaabidha/astra/blob/main/data/models/training_data.csv"
click node_model_store "https://github.com/zahraaabidha/astra/tree/main/data/models"
click node_tier2 "https://github.com/zahraaabidha/astra/blob/main/backend/tier2/deobfuscator.py"
click node_reporter "https://github.com/zahraaabidha/astra/blob/main/backend/tier2/reporter.py"
click node_sample_store "https://github.com/zahraaabidha/astra/blob/main/backend/api/main.py"
click node_job_store "https://github.com/zahraaabidha/astra/blob/main/backend/api/main.py"
click node_report_store "https://github.com/zahraaabidha/astra/blob/main/backend/api/main.py"
click node_reference_db "https://github.com/zahraaabidha/astra/blob/main/data/reference_db/bank_apps.json"
click node_knowledge_graph "https://github.com/zahraaabidha/astra/tree/main/backend/graph"

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_app,node_upload,node_results,node_history,node_navbar toneBlue
class node_api,node_pipeline,node_reporter toneAmber
class node_extractor,node_scorer,node_training toneMint
class node_tier2,node_knowledge_graph toneRose
class node_training_data,node_model_store,node_sample_store,node_job_store,node_report_store,node_reference_db,node_analyst,node_ollama toneIndigo
```

## Components

### Analyst interface

- [Dashboard shell](https://github.com/zahraaabidha/astra/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [File upload](https://github.com/zahraaabidha/astra/blob/main/frontend/src/pages/UploadPage.tsx): `frontend/src/pages/UploadPage.tsx`
- [Report view](https://github.com/zahraaabidha/astra/blob/main/frontend/src/pages/ResultsPage.tsx): `frontend/src/pages/ResultsPage.tsx`
- [Analysis history](https://github.com/zahraaabidha/astra/blob/main/frontend/src/pages/HistoryPage.tsx): `frontend/src/pages/HistoryPage.tsx`
- [Service status](https://github.com/zahraaabidha/astra/blob/main/frontend/src/components/Navbar.tsx): `frontend/src/components/Navbar.tsx`

### Analysis service

- [HTTP API](https://github.com/zahraaabidha/astra/blob/main/backend/api/main.py): `backend/api/main.py`
- [Analysis orchestrator](https://github.com/zahraaabidha/astra/blob/main/backend/pipeline.py): `backend/pipeline.py`
- [Report builder](https://github.com/zahraaabidha/astra/blob/main/backend/tier2/reporter.py): `backend/tier2/reporter.py`

### Feature scoring

- [Format extraction](https://github.com/zahraaabidha/astra/blob/main/analysis/static/extractor.py): `analysis/static/extractor.py`
- [Risk scorer](https://github.com/zahraaabidha/astra/blob/main/backend/ml/scorer.py): `backend/ml/scorer.py`
- [Classifier training](https://github.com/zahraaabidha/astra/blob/main/backend/ml/train.py): `backend/ml/train.py`

### Deep analysis

- [Reverse engineering](https://github.com/zahraaabidha/astra/blob/main/backend/tier2/deobfuscator.py): `backend/tier2/deobfuscator.py`
- [Campaign graph](https://github.com/zahraaabidha/astra/tree/main/backend/graph): `backend/graph`

### Analysis state

- [Training data](https://github.com/zahraaabidha/astra/blob/main/data/models/training_data.csv): `data/models/training_data.csv`
- [Model artifacts](https://github.com/zahraaabidha/astra/tree/main/data/models): `data/models`
- [Uploaded samples](https://github.com/zahraaabidha/astra/blob/main/backend/api/main.py): `backend/api/main.py`
- [Job status](https://github.com/zahraaabidha/astra/blob/main/backend/api/main.py): `backend/api/main.py`
- [Saved reports](https://github.com/zahraaabidha/astra/blob/main/backend/api/main.py): `backend/api/main.py`
- [Bank references](https://github.com/zahraaabidha/astra/blob/main/data/reference_db/bank_apps.json): `data/reference_db/bank_apps.json`

### Other components

- **Analyst**
- **Ollama model service**

## Connections

- Analyst → Dashboard shell: uses
- Dashboard shell → File upload: shows
- Dashboard shell → Report view: shows
- Dashboard shell → Analysis history: shows
- Dashboard shell → Service status: shows
- Service status → HTTP API: checks health
- Report view → HTTP API: fetches report
- HTTP API → Uploaded samples: writes upload
- HTTP API → Job status: tracks job
- HTTP API → Analysis orchestrator: dispatches analysis
- Analysis orchestrator → Format extraction: extracts features
- Format extraction → Bank references: reads bank data
- Analysis orchestrator → Risk scorer: scores features
- Analysis orchestrator → Reverse engineering: routes when needed
- Reverse engineering → Ollama model service: requests analysis
- Analysis orchestrator → Report builder: builds report
- HTTP API → Saved reports: writes report
- Classifier training → Training data: trains from
- Classifier training → Model artifacts: saves model
- Risk scorer → Model artifacts: loads model
