Skip to main content

cpssbench

Cyber-Physical Systems Security Bench. It downloads raw traces, builds windowed tensors, and returns a PyTorch dataset with the same contract as MNIST: (window, label).

from cpssbench import SynCAN
from torch.utils.data import DataLoader

train = SynCAN(root="./data", split="train", download=True)
test = SynCAN(root="./data", split="test", download=True)

window, label = train[0]          # window: (1, time, signals), label: 0 benign / 1 attack
loader = DataLoader(train, batch_size=64, shuffle=True)

Or load by name:

import cpssbench

dataset = cpssbench.load("road", root="./data", split="test", download=True)
print(dataset.input_shape)   # (channels, window, signals)

Install

pip install cpssbench

That works after the package is published on PyPI. Until then, install this repository directly:

pip install "git+https://github.com/shahriar0651/cpssbench.git"

From a local clone, for development:

pip install -e .

Then open examples/train_like_mnist.ipynb to plot a sample grid and train a small network.

Python 3.10+. SynCAN also needs git on PATH. ROAD is fetched from Zenodo with the standard library, so wget is not required.

Datasets

Name Status What you get
syncan ready, auto-download Synthetic CAN intrusion traces
road ready, auto-download ROAD dynamometer CAN traces
misbehaviorx loader ready, manual files V2X misbehavior (also accepted as vasp)
x-canids registered, not implemented Raises a clear error until a loader is added
python -m cpssbench list
python -m cpssbench info syncan
python -m cpssbench download syncan --root ./data --split train

Downloaded files land in <root>/<name>/{ambient,attacks} plus a fitted min/max scaler under <root>/<name>/scaler. Later calls reuse those files.

Overrides

Windowing defaults live in the library so a new project does not need the old Hydra YAML. Override them per call:

from cpssbench import ROAD

dataset = ROAD(root="./data", split="train", download=True, window_size=50, step_size=5)

Pass return_meta=True if you also need the source file and row index: (window, label, {"file", "idx"}).

Layout

Each sample is a min-max scaled window with a channel axis, so the same convolutional IDS can run on every dataset. Shape is always (channels, window_size, num_signals). Label 0 is benign and 1 is attack (any attack flag inside the window).

Adding a dataset

  1. Add a DatasetSpec in src/cpssbench/specs.py.
  2. Add a downloader in src/cpssbench/download.py if the files can be fetched automatically.
  3. Register the class in src/cpssbench/datasets.py and _CLASSES in __init__.py.

The IDS experiments that consume this package live in the sibling RobIDS repo.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cpssbench-0.1.0.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cpssbench-0.1.0-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

Details for the file cpssbench-0.1.0.tar.gz.

File metadata

  • Download URL: cpssbench-0.1.0.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for cpssbench-0.1.0.tar.gz
Algorithm Hash digest
SHA256 08e0102b6549c92e439ceca6a9981f6e6b12189702551231a79240e74499fc9f
MD5 a3f1b498aa8556ccf4abf24c78c22315
BLAKE2b-256 167a0d6cd00578777ce872f3cea397eadeb8bdf75afda17b6a450a00341dd6e5

See more details on using hashes here.

Provenance

The following attestation bundles were made for cpssbench-0.1.0.tar.gz:

Publisher: publish.yml on shahriar0651/cpssbench

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cpssbench-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: cpssbench-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 17.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for cpssbench-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c2ffb20837fd7403e2103665f90645cc541e6dc8795d3ff270fbd2371cc2a468
MD5 174d53079de599dff447a184ccf26419
BLAKE2b-256 d070971017d83ebc855a3a3a11dcf5b7f3c60bef0fd2559076dc0073e7e830a9

See more details on using hashes here.

Provenance

The following attestation bundles were made for cpssbench-0.1.0-py3-none-any.whl:

Publisher: publish.yml on shahriar0651/cpssbench

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page