Talus โ Architecture
Project Structureโ
talus-process-monitor/
โโโ Cargo.toml # Workspace root
โโโ build.sh # Build script (nightly for eBPF, stable for TUI)
โโโ src/
โ โโโ main.rs # Entry point, CLI args
โ โโโ monitor.rs # eBPF loading, perf reader, event processing
โ โโโ tracker.rs # Per-process state tracking
โ โโโ heuristic.rs # Sliding-window ransomware detection
โ โโโ tui.rs # 7-panel frankentui (ftui) cyberpunk interface
โโโ process-monitor-ebpf/ # Kernel side (#![no_std], aya-ebpf)
โ โโโ Cargo.toml
โ โโโ src/
โ โ โโโ main.rs # eBPF entry point
โ โ โโโ execve.rs # execve tracepoint handler
โ โ โโโ openat.rs # openat tracepoint handler
โ โโโ build.rs # Build configuration
โโโ tests/
โโโ integration.rs # End-to-end tests
Kernel Side (process-monitor-ebpf)โ
Tracepoint Programsโ
Two eBPF programs attached to kernel tracepoints:
-
execveโ fires on everyexecve()syscall- Captures: PID, PPID, UID, command name, timestamp
- Writes event to
EVENTSPerfEventArray
-
openatโ fires on everyopenat()syscall- Captures: PID, filename, flags, timestamp
- Writes event to
EVENTSPerfEventArray
Data Structuresโ
#[repr(C)]
struct ExecEvent {
pid: u32,
ppid: u32,
uid: u32,
comm: [u8; 16], // process name
timestamp_ns: u64,
}
#[repr(C)]
struct FileEvent {
pid: u32,
filename: [u8; 256],
flags: u32,
timestamp_ns: u64,
}
Memory Safetyโ
- All eBPF programs are
#![no_std]โ no heap allocation - Stack-allocated event structs, copied to perf buffer
- Bounds-checked by the eBPF verifier before loading
- No pointer arithmetic outside verified bounds
Userspace Sideโ
Event Processing Pipelineโ
PerfBuffer โ Deserialise โ EventTracker โ HeuristicEngine โ TUI
- PerfBuffer read โ async reader on the perf event array
- Deserialise โ bincode decode into Rust structs
- EventTracker โ maintains per-process state (PID โ process tree)
- HeuristicEngine โ sliding-window analysis for ransomware detection
- TUI render โ frankentui draws the 7-panel dashboard every 100ms
Process Trackingโ
- Maintains a map of PID to process info (name, parent, start_time, file_ops)
- Process tree construction from PPID chains
- Zombie process cleanup on exit events
- Bounded memory: oldest processes evicted when map exceeds limit
Ransomware Heuristicโ
Sliding window (default: 60 seconds) tracking:
- Rename velocity: number of file renames per second
- Entropy change: Shannon entropy of file contents before/after
- Extension changes: mass extension changes (.doc โ .locked)
- Threshold: triggers alert when multiple signals correlate
Build Processโ
# 1. Build eBPF programs (requires nightly)
cd process-monitor-ebpf
cargo +nightly build --target bpfel-unknown-none --release
# 2. Build userspace (stable Rust)
cd ..
cargo build --release
# 3. Run (requires root)
sudo ./target/release/process-monitor
The build script automatically:
- Compiles eBPF programs to BPF ELF objects
- Embeds the compiled object into the userspace binary
- Generates type bindings from the eBPF struct definitions