Skip to content

Quickstart

This page shows how to run the existing systems, provenance-based (PIDSs) and network (NIDSs), change their arguments from the command line, and find their results.

Before you start

Complete the installation. The pidsmaker command runs from any folder.

Your first run

Every run takes the same two positional arguments, a system and a dataset:

pidsmaker SYSTEM DATASET [--arg=value ...]

From a clone of the repository, python pidsmaker/main.py SYSTEM DATASET [--arg=value ...] is equivalent.

SYSTEM

The name of a YAML file in config/, which describes the full pipeline of a system:

  • provenance: velox, orthrus, kairos, magic, flash, nodlink, rcaid, threatrace, ocrapt;
  • network: euler, argus, jbeil, lares, egraphsage, anomal_e;
  • or your own.

See Systems for a comparison.

DATASET

A dataset defined in DATASET_DEFAULT_CONFIG in pidsmaker/config/config.py, which maps it to its database, a folder of Parquet files downloaded the first time the dataset is used:

  • provenance: CADETS_E3, THEIA_E3, CLEARSCOPE_E3, FIVEDIRECTIONS_E3, TRACE_E3, CADETS_E5, THEIA_E5, CLEARSCOPE_E5, FIVEDIRECTIONS_E5, TRACE_E5, optc_h201, optc_h501, optc_h051, ATLASV2_EDR, CARBANAKV2_EDR;
  • network: LANL, OPTC_NET.

See Datasets.

Any system runs on both kinds of datasets, with a few exceptions.

For example:

Velox on CADETS E3, which looks for the processes, files and netflows of the attacks:

pidsmaker velox CADETS_E3

Euler on LANL, which looks for the authentications of the red team:

pidsmaker euler LANL

The content of the config (e.g. config/velox.yml) is parsed and checked against the arguments available in TASK_ARGS (pidsmaker/config/config.py), then the seven stages of the pipeline run one after the other.

Ways to run

Logs are printed to the terminal. Good for quick tests and debugging.

pidsmaker SYSTEM DATASET

Same, but logs, metrics and figures are also sent to Weights & Biases.

pidsmaker SYSTEM DATASET --wandb

Recommended for research and for running several experiments in parallel. The run continues after you close the terminal or log out, and logs to W&B. The command prints the log file of the run, in the current folder:

pidsmaker SYSTEM DATASET --wandb --background
tail -f pidsmaker_SYSTEM_DATASET_*.log   # follow the logs

All runs of pidsmaker are reproducible: it sets PYTHONHASHSEED=0 (sets of strings are iterated in the same order) and CUBLAS_WORKSPACE_CONFIG=:4096:8 (for the deterministic algorithms of CUDA), unless you set them yourself. python pidsmaker/main.py does not.

Change arguments

Every argument of the YAML config can be overridden from the command line, using its dotted path. CLI arguments always take precedence over the YAML file:

pidsmaker kairos CADETS_E3 \
  --training.node_hid_dim=128 \
  --batching.intra_graph_batching.tgn_last_neighbor.tgn_neighbor_size=10
pidsmaker euler LANL \
  --construction.time_window_size=60.0 \
  --training.decoder.predict_edge_contrastive.neg_ratio=5

Components can be swapped the same way. For example, Orthrus with doc2vec instead of word2vec, and 3 GraphSAGE layers instead of 2 attention layers:

pidsmaker orthrus CADETS_E3 \
  --featurization.used_method=doc2vec \
  --featurization.emb_dim=128 \
  --training.encoder.used_methods=tgn,sage \
  --training.encoder.sage.num_layers=3

All arguments are listed in the Reference. The flags that are not part of the YAML config (--wandb, --cpu, --force_restart...) are listed in Command line.

Re-running is cheap

Each task of the pipeline is cached on disk under a hash of its arguments. When you change --training.lr, graph construction and featurization are reused and only training and evaluation run again. See Pipeline.

GPU or CPU

By default, PIDSMaker runs on the GPU cuda:0. If no GPU is found, it falls back to the CPU and prints a warning. To force the CPU:

pidsmaker velox CADETS_E3 --cpu

Results

At the end of the evaluation task, metrics are printed in the logs and, with --wandb, sent to W&B with the figures (score distributions, detected attacks...). The main metrics are:

Metric Meaning
precision, recall, fscore, mcc Classification of nodes (or edges, time windows) as malicious, with the threshold chosen on the validation set
tp, fp, tn, fn Confusion matrix
ap, auc Average precision and ROC AUC of the anomaly scores, independent of the threshold
adp_score Attack Detection Precision: area under the curve of the percentage of attacks detected against precision. It rewards systems that detect every attack with few false positives
discrimination Margin between the highest score of each attack and the mean of the 10 highest benign scores (normalized scores), averaged over attacks. Positive when attacks stand out

Provenance systems classify nodes by default, network systems edges (authentications or flows). How samples are labeled, how thresholds are chosen and how each metric is computed is explained in Evaluation & labeling.

All files produced by a run are written in the artifact folder: $PIDSMAKER_ARTIFACT_DIR if it is set, else /home/artifacts/ if this folder exists, else artifacts/ in the working directory. Use --artifact_dir to change it for a run (see Where files are stored).

Next steps

  • Understand the pipeline


    How the seven stages fit together, and how caching speeds up experiments.

    Pipeline

  • Compare the systems


    The provenance and network systems side by side, and which datasets each one runs on.

    Systems

  • Build your own system


    Write a new encoder and a new YAML config, and evaluate them.

    Tutorial

  • Measure instability


    Run each system several times and report the mean and standard deviation.

    Instability

  • Tune a system


    Grid, random or Bayesian sweeps with W&B.

    Hyperparameter tuning