# proffaro/major-p1-v1 architecture

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

- Interactive diagram: https://gitdiagram.com/proffaro/major-p1-v1
- Repository: https://github.com/proffaro/major-p1-v1

## Overview

KShark is a hybrid eBPF security platform: its Go agent captures kernel telemetry, the Python engine analyzes it with behavioral rules and ML, persists events and alerts, and exposes an API; a PyQt GUI provides interactive event analysis. The graph follows the documented orchestration and the excerpted real-time processing path. Agent-to-probe details and several GUI/API connections are not shown in sampled source, so uncertain links are omitted or marked unverified.

Main entry points: [`ml_engine/inference/realtime_engine.py`](https://github.com/proffaro/major-p1-v1/blob/main/ml_engine/inference/realtime_engine.py) (Real-time ingestion), [`main.py`](https://github.com/proffaro/major-p1-v1/blob/main/main.py) (Python orchestrator), [`kshark/app.py`](https://github.com/proffaro/major-p1-v1/blob/main/kshark/app.py) (GUI entry), [`kshark/core/coloring_engine.py`](https://github.com/proffaro/major-p1-v1/blob/main/kshark/core/coloring_engine.py) (Event coloring)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Kernel capture"]
  node_go_agent["Go eBPF agent<br/>[main.go]"]
  node_bpf_probes["eBPF probes"]
  node_tetragon_probe["Tetragon LSM probe<br/>[tetragon_lsm.bpf.c]"]
  node_agent_websocket["Agent WebSocket<br/>[websocket.go]"]
end

subgraph group_analysis["Detection pipeline"]
  node_realtime["Real-time ingestion<br/>[realtime_engine.py]"]
  node_feature_extractor["Feature extraction"]
  node_process_graph["Process lineage<br/>[process_graph.py]"]
  node_behavioral_engine["Behavioral rules"]
  node_falco_engine["Falco rules<br/>[falco_engine.py]"]
  node_detector["ML detector<br/>[detector.py]"]
  node_alert_dispatcher["Alert dispatcher"]
end

subgraph group_persistence["Storage and API"]
  node_database[("DuckDB and SQLite<br/>[db_manager.py]")]
  node_api_server["FastAPI server<br/>[server.py]"]
  node_api_routes["REST routes<br/>[routes.py]"]
end

subgraph group_desktop["Desktop analysis"]
  node_gui_entry["GUI entry<br/>[app.py]"]
  node_main_window["Main window<br/>[main_window.py]"]
  node_event_table["Event table model"]
  node_filter_engine["Display filters<br/>[filter_engine.py]"]
  node_coloring_engine["Event coloring<br/>[coloring_engine.py]"]
  node_theme["Theme manager<br/>[theme.py]"]
  node_syscall_table["Syscall lookup<br/>[syscall_table.py]"]
end

subgraph group_orchestration["System orchestration"]
  node_orchestrator["Python orchestrator<br/>[main.py]"]
end

node_operator(("Operator"))
node_kernel(("Linux kernel"))

node_operator -->|"starts"| node_orchestrator
node_operator -->|"opens"| node_gui_entry
node_kernel -.->|"emits events"| node_bpf_probes
node_bpf_probes -.->|"streams events"| node_go_agent
node_tetragon_probe -->|"observes and enforces"| node_kernel
node_orchestrator -->|"starts agent"| node_go_agent
node_go_agent -.->|"serves telemetry"| node_agent_websocket
node_agent_websocket -->|"streams telemetry"| node_realtime
node_orchestrator -->|"starts ingestion"| node_realtime
node_orchestrator -->|"initializes storage"| node_database
node_orchestrator -->|"starts API"| node_api_server
node_orchestrator -->|"launches GUI"| node_gui_entry
node_realtime -->|"extracts features"| node_feature_extractor
node_realtime -->|"updates lineage"| node_process_graph
node_realtime -->|"evaluates events"| node_behavioral_engine
node_behavioral_engine -->|"evaluates Falco rules"| node_falco_engine
node_realtime -->|"scores features"| node_detector
node_realtime -->|"dispatches alerts"| node_alert_dispatcher
node_realtime -->|"persists telemetry"| node_database
node_api_server -->|"registers routes"| node_api_routes
node_api_routes -->|"queries alerts"| node_database
node_gui_entry -->|"creates window"| node_main_window
node_gui_entry -->|"imports filters"| node_filter_engine
node_gui_entry -->|"imports coloring"| node_coloring_engine
node_gui_entry -->|"imports model"| node_event_table
node_coloring_engine -->|"matches rules"| node_filter_engine
node_coloring_engine -->|"reads theme"| node_theme
node_filter_engine -->|"resolves syscalls"| node_syscall_table

click node_go_agent "https://github.com/proffaro/major-p1-v1/blob/main/agent/cmd/agent/main.go"
click node_bpf_probes "https://github.com/proffaro/major-p1-v1/tree/main/bpf/probes"
click node_tetragon_probe "https://github.com/proffaro/major-p1-v1/blob/main/bpf/probes/tetragon_lsm.bpf.c"
click node_agent_websocket "https://github.com/proffaro/major-p1-v1/blob/main/agent/server/websocket.go"
click node_orchestrator "https://github.com/proffaro/major-p1-v1/blob/main/main.py"
click node_realtime "https://github.com/proffaro/major-p1-v1/blob/main/ml_engine/inference/realtime_engine.py"
click node_feature_extractor "https://github.com/proffaro/major-p1-v1/blob/main/ml_engine/preprocessing/feature_extractor.py"
click node_process_graph "https://github.com/proffaro/major-p1-v1/blob/main/ml_engine/preprocessing/process_graph.py"
click node_behavioral_engine "https://github.com/proffaro/major-p1-v1/blob/main/ml_engine/rules/behavioral_engine.py"
click node_falco_engine "https://github.com/proffaro/major-p1-v1/blob/main/ml_engine/rules/falco_engine.py"
click node_detector "https://github.com/proffaro/major-p1-v1/blob/main/ml_engine/models/detector.py"
click node_alert_dispatcher "https://github.com/proffaro/major-p1-v1/blob/main/ml_engine/detection/alert_dispatcher.py"
click node_database "https://github.com/proffaro/major-p1-v1/blob/main/ml_engine/storage/db_manager.py"
click node_api_server "https://github.com/proffaro/major-p1-v1/blob/main/ml_engine/api/server.py"
click node_api_routes "https://github.com/proffaro/major-p1-v1/blob/main/ml_engine/api/routes.py"
click node_gui_entry "https://github.com/proffaro/major-p1-v1/blob/main/kshark/app.py"
click node_main_window "https://github.com/proffaro/major-p1-v1/blob/main/kshark/main_window.py"
click node_event_table "https://github.com/proffaro/major-p1-v1/blob/main/kshark/models/event_table_model.py"
click node_filter_engine "https://github.com/proffaro/major-p1-v1/blob/main/kshark/core/filter_engine.py"
click node_coloring_engine "https://github.com/proffaro/major-p1-v1/blob/main/kshark/core/coloring_engine.py"
click node_theme "https://github.com/proffaro/major-p1-v1/blob/main/kshark/core/theme.py"
click node_syscall_table "https://github.com/proffaro/major-p1-v1/blob/main/kshark/core/syscall_table.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_go_agent,node_bpf_probes,node_tetragon_probe,node_agent_websocket toneBlue
class node_realtime,node_feature_extractor,node_process_graph,node_behavioral_engine,node_falco_engine,node_detector,node_alert_dispatcher toneAmber
class node_database,node_api_server,node_api_routes toneMint
class node_gui_entry,node_main_window,node_event_table,node_filter_engine,node_coloring_engine,node_theme,node_syscall_table toneRose
class node_orchestrator,node_operator,node_kernel toneIndigo
```

## Components

### Kernel capture

- [Go eBPF agent](https://github.com/proffaro/major-p1-v1/blob/main/agent/cmd/agent/main.go): `agent/cmd/agent/main.go`
- [eBPF probes](https://github.com/proffaro/major-p1-v1/tree/main/bpf/probes): `bpf/probes`
- [Tetragon LSM probe](https://github.com/proffaro/major-p1-v1/blob/main/bpf/probes/tetragon_lsm.bpf.c): `bpf/probes/tetragon_lsm.bpf.c`
- [Agent WebSocket](https://github.com/proffaro/major-p1-v1/blob/main/agent/server/websocket.go): `agent/server/websocket.go`

### Detection pipeline

- [Real-time ingestion](https://github.com/proffaro/major-p1-v1/blob/main/ml_engine/inference/realtime_engine.py): `ml_engine/inference/realtime_engine.py`
- [Feature extraction](https://github.com/proffaro/major-p1-v1/blob/main/ml_engine/preprocessing/feature_extractor.py): `ml_engine/preprocessing/feature_extractor.py`
- [Process lineage](https://github.com/proffaro/major-p1-v1/blob/main/ml_engine/preprocessing/process_graph.py): `ml_engine/preprocessing/process_graph.py`
- [Behavioral rules](https://github.com/proffaro/major-p1-v1/blob/main/ml_engine/rules/behavioral_engine.py): `ml_engine/rules/behavioral_engine.py`
- [Falco rules](https://github.com/proffaro/major-p1-v1/blob/main/ml_engine/rules/falco_engine.py): `ml_engine/rules/falco_engine.py`
- [ML detector](https://github.com/proffaro/major-p1-v1/blob/main/ml_engine/models/detector.py): `ml_engine/models/detector.py`
- [Alert dispatcher](https://github.com/proffaro/major-p1-v1/blob/main/ml_engine/detection/alert_dispatcher.py): `ml_engine/detection/alert_dispatcher.py`

### Storage and API

- [DuckDB and SQLite](https://github.com/proffaro/major-p1-v1/blob/main/ml_engine/storage/db_manager.py): `ml_engine/storage/db_manager.py`
- [FastAPI server](https://github.com/proffaro/major-p1-v1/blob/main/ml_engine/api/server.py): `ml_engine/api/server.py`
- [REST routes](https://github.com/proffaro/major-p1-v1/blob/main/ml_engine/api/routes.py): `ml_engine/api/routes.py`

### Desktop analysis

- [GUI entry](https://github.com/proffaro/major-p1-v1/blob/main/kshark/app.py): `kshark/app.py`
- [Main window](https://github.com/proffaro/major-p1-v1/blob/main/kshark/main_window.py): `kshark/main_window.py`
- [Event table model](https://github.com/proffaro/major-p1-v1/blob/main/kshark/models/event_table_model.py): `kshark/models/event_table_model.py`
- [Display filters](https://github.com/proffaro/major-p1-v1/blob/main/kshark/core/filter_engine.py): `kshark/core/filter_engine.py`
- [Event coloring](https://github.com/proffaro/major-p1-v1/blob/main/kshark/core/coloring_engine.py): `kshark/core/coloring_engine.py`
- [Theme manager](https://github.com/proffaro/major-p1-v1/blob/main/kshark/core/theme.py): `kshark/core/theme.py`
- [Syscall lookup](https://github.com/proffaro/major-p1-v1/blob/main/kshark/core/syscall_table.py): `kshark/core/syscall_table.py`

### System orchestration

- [Python orchestrator](https://github.com/proffaro/major-p1-v1/blob/main/main.py): `main.py`

### Other components

- **Operator**
- **Linux kernel**

## Connections

- Operator → Python orchestrator: starts
- Operator → GUI entry: opens (evidence: `kshark/app.py`)
- Linux kernel → eBPF probes: emits events
- eBPF probes → Go eBPF agent: streams events
- Tetragon LSM probe → Linux kernel: observes and enforces (evidence: `bpf/probes/tetragon_lsm.bpf.c`)
- Python orchestrator → Go eBPF agent: starts agent (evidence: `main.py`)
- Go eBPF agent → Agent WebSocket: serves telemetry
- Agent WebSocket → Real-time ingestion: streams telemetry (evidence: `ml_engine/inference/realtime_engine.py`)
- Python orchestrator → Real-time ingestion: starts ingestion (evidence: `main.py`)
- Python orchestrator → DuckDB and SQLite: initializes storage (evidence: `main.py`)
- Python orchestrator → FastAPI server: starts API (evidence: `main.py`)
- Python orchestrator → GUI entry: launches GUI (evidence: `main.py`)
- Real-time ingestion → Feature extraction: extracts features (evidence: `ml_engine/inference/realtime_engine.py`)
- Real-time ingestion → Process lineage: updates lineage (evidence: `ml_engine/inference/realtime_engine.py`)
- Real-time ingestion → Behavioral rules: evaluates events (evidence: `ml_engine/inference/realtime_engine.py`)
- Behavioral rules → Falco rules: evaluates Falco rules (evidence: `ml_engine/rules/behavioral_engine.py`)
- Real-time ingestion → ML detector: scores features (evidence: `ml_engine/inference/realtime_engine.py`)
- Real-time ingestion → Alert dispatcher: dispatches alerts (evidence: `ml_engine/inference/realtime_engine.py`)
- Real-time ingestion → DuckDB and SQLite: persists telemetry (evidence: `ml_engine/inference/realtime_engine.py`)
- FastAPI server → REST routes: registers routes (evidence: `ml_engine/api/server.py`)
- REST routes → DuckDB and SQLite: queries alerts (evidence: `ml_engine/api/routes.py`)
- GUI entry → Main window: creates window (evidence: `kshark/app.py`)
- GUI entry → Display filters: imports filters (evidence: `kshark/app.py`)
- GUI entry → Event coloring: imports coloring (evidence: `kshark/app.py`)
- GUI entry → Event table model: imports model (evidence: `kshark/app.py`)
- Event coloring → Display filters: matches rules (evidence: `kshark/core/coloring_engine.py`)
- Event coloring → Theme manager: reads theme (evidence: `kshark/core/coloring_engine.py`)
- Display filters → Syscall lookup: resolves syscalls (evidence: `kshark/core/filter_engine.py`)
