Skip to main content

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:

  1. execve โ€” fires on every execve() syscall

    • Captures: PID, PPID, UID, command name, timestamp
    • Writes event to EVENTS PerfEventArray
  2. openat โ€” fires on every openat() syscall

    • Captures: PID, filename, flags, timestamp
    • Writes event to EVENTS PerfEventArray

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
  1. PerfBuffer read โ€” async reader on the perf event array
  2. Deserialise โ€” bincode decode into Rust structs
  3. EventTracker โ€” maintains per-process state (PID โ†’ process tree)
  4. HeuristicEngine โ€” sliding-window analysis for ransomware detection
  5. 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