MCPcopy Index your code
hub / github.com/evilsocket/ebpf-process-anomaly-detection

github.com/evilsocket/ebpf-process-anomaly-detection @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
12 symbols 51 edges 5 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Process behaviour anomaly detection using eBPF system call tracing and unsupervised learning Autoencoders.

Read this blog post for a complete description of the project.

Installation

sudo pip3 install -r requirements.txt

Learning

During the first step, we need to sample as much data as possible from a running target process (pid 1234 in this example):

sudo ./main.py --pid 1234 --data activity.csv --learn

Keep the sampling going while you trigger normal behaviour in the target process, this will generate the activity.csv file for training.

Training a model

We'll now train a model to detect anomalies:

./main.py --data activity.csv --model model.h5 --train

The autoencoder saved to model.h5 can now be used for anomaly detection with the error threshold print at the end of the training.

Anomaly detection

Once the model has been trained it can be used on the target process to detect anomalies, in this case we're using a 10.0 error threshold:

sudo ./main.py --pid 1234 --model model.h5 --max-error 10.0 --run

When an anomaly is detected the cumulative error will be printed along wiht the top 3 anomalous system calls:

error = 30.605255 - max = 10.000000 - top 3:
  b'getpriority' = 0.994272
  b'writev' = 0.987554
  b'creat' = 0.969955

License

This project is made with ♥ by @evilsocket and it is released under the GPL3 license.

Core symbols most depended-on inside this repo

start
called by 2
lib/ebpf.py
predict
called by 2
lib/ml.py
learn_action
called by 1
main.py
train_action
called by 1
main.py
run_action
called by 1
main.py
comm_for_pid
called by 1
lib/__init__.py
create
called by 1
lib/ml.py
train
called by 1
lib/ml.py

Shape

Method 6
Function 4
Class 2

Languages

Python100%

Modules by API surface

lib/ml.py5 symbols
main.py3 symbols
lib/ebpf.py3 symbols
lib/__init__.py1 symbols

For agents

$ claude mcp add ebpf-process-anomaly-detection \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact