An advanced proprietary Endpoint Detection and Response (EDR) system. The application monitors OS kernel activity in real time via eBPF, analyzes executed binaries using native GNU utilities, and exports live security metrics to Prometheus.
The system implements a proprietary self-defense technology engineered directly into the Python daemon. Its primary purpose is to protect the EDR from being maliciously terminated (e.g., by malware evasion techniques).
-
The Issue: If you attempt to initialize the daemon without a valid
prometheus.ymlfile, the consumer thread will throw a critical configuration exception. Our custom supervisor immediately triggers a sub-millisecond crash-loop respawn procedure via double-forking. -
The Consequence: The process evades termination by changing its PID so rapidly that traditional user-space tools (like
kill -9) become completely ineffective. Intercepting the process via terminal becomes impossible, which might ultimately force a hard hardware reset (pulling the power plug).
-
Pre-requisite: Always ensure that
prometheus.ymlis present in the project's root directory before any execution attempts. -
Proper Shutdown: The system deliberately ignores standard termination signals from the terminal. To safely stop the EDR and unmount the eBPF tracing policies, the built-in control flag must be used:
sudo python3 genius_analysis.pyThe system is designed for maximum throughput and zero packet drop, leveraging an asynchronous multi-threaded architecture in Python.
The EDR bypasses user-space polling by hooking directly into the Linux Kernel using eBPF (extended Berkeley Filter) technology. TracingPolicies filter system events at the source, delivering a clean stream of security-relevant logs (such as memory and privilege escalation).
To prevent log dropped events during massive system activity spikes (bursts):
-
Producer Thread: Solely responsible for rapidly reading the raw stream from Tetragon and pushing it into a thread-safe FIFO queue.
-
Consumer Thread: Pulls data chunks from the queue, decodes them, and passes them to heavy analytics, completely offloading the listener thread.
Instead of using the standard Python JSON library, the system processes data using orjson (a blazing-fast, Rust-based JSON parser). This allows the application to handle tens of thousands of kernel events per second with minimal CPU and RAM overhead.
Upon detecting a new file execution event (ELF format), the system extracts its structure, HEX headers, and section details using native GNU binary utilities. Concurrently, cryptographic SHA checksums are generated via optimized system-level utilities to match signature databases.
Relying on the native GNU toolchain guarantees:
- maximum stability
- low footprint
- compatibility across Linux environments without requiring external GPU hardware dependencies.
All classified anomalies and internal EDR performance metrics are aggregated and exposed on a dedicated server port, fully compatible with the Prometheus monitoring ecosystem. Prometheus communicates using encrypted TLS (Transport Layer Security) to ensure the confidentiality and integrity of transmitted data.
Phase 1 — Network policy
-
Monitors
tcp_v4_connectandtcp_v6_connect(TCP connection attempts) andtcp_closewithmatchAction: Post(connection close). -
Extracts
saddr,sport,daddr,dport, and process context (pid,binary).
Phase 2 — Process policy
-
Monitors
do_open_execatand thebegin_new_execexecution path, additionally observing exec events withmatchAction:Postto reliably observe the “new process image.” -
The goal is to reliably capture when and what program was executed for correlation with network activity.
Phase 3 — File integrity policy
-
Monitors
fd_installwithmatchAction: Postand a prefix filter for selected installation paths. -
The goal is to detect and record artifacts that appear in important locations (e.g., binaries, libraries, executable files).
Make sure the following are installed and available on your system before proceeding:
- Linux Arch, Kernel 7.0+
- eBPF support enabled in the kernel
- Cilium Tetragon v1.7.0+
- Python 3.14.5
- GNU binary utilities (native toolchain, for ELF/SHA analysis)
- Prometheus (for metrics scraping)
git clone https://github.com/IamGhost-ops/kernel-scope.git
cd kernal-scopeIt's recommended to use a virtual environment:
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txtKey packages include:
orjson— high-performance JSON parsingprometheus_client— metrics export- Standard library
threadingandqueuemodules (no install required)
- Install Tetragon (v1.7.0 or newer) following the official Cilium Tetragon documentation.
- Apply the three TracingPolicies described in this project:
- Network policy (
tcp_v4_connect,tcp_v6_connect,tcp_close) - Process policy (
do_open_execat,begin_new_exec) - File integrity policy (
fd_install)
- Network policy (
This step is mandatory. Starting the daemon without a valid
prometheus.ymlin the project root triggers the crash-loop respawn behavior described in the Self-Defense Mechanism section above.
Place a valid prometheus.yml in the project's root directory, configured with:
- The scrape target/port for the EDR's metrics endpoint
- TLS settings for encrypted Prometheus communication
sudo python3 genius_analysis.py- Root privileges are required for eBPF hooks and kernel-level tracing.
- The same command and flag are used for both starting and safely stopping the daemon — do not attempt to kill the process with
kill -9orCtrl+C.
Once running, confirm metrics are being exposed by checking the configured Prometheus endpoint (e.g., https://<host>:<port>/metrics).
| Component | Details |
|---|---|
| OS | Linux Arch |
| Kernel | 7.0+ |
| Kernel Interface | eBPF |
| Monitoring Engine | Tetragon v1.7.0+ |
| Analysis Script | Python 3.14.5+ |