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
- Add a
DatasetSpecinsrc/cpssbench/specs.py. - Add a downloader in
src/cpssbench/download.pyif the files can be fetched automatically. - Register the class in
src/cpssbench/datasets.pyand_CLASSESin__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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08e0102b6549c92e439ceca6a9981f6e6b12189702551231a79240e74499fc9f
|
|
| MD5 |
a3f1b498aa8556ccf4abf24c78c22315
|
|
| BLAKE2b-256 |
167a0d6cd00578777ce872f3cea397eadeb8bdf75afda17b6a450a00341dd6e5
|
Provenance
The following attestation bundles were made for cpssbench-0.1.0.tar.gz:
Publisher:
publish.yml on shahriar0651/cpssbench
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cpssbench-0.1.0.tar.gz -
Subject digest:
08e0102b6549c92e439ceca6a9981f6e6b12189702551231a79240e74499fc9f - Sigstore transparency entry: 2810698284
- Sigstore integration time:
-
Permalink:
shahriar0651/cpssbench@fc2f3c26b326b44cb42b28b68c408107cc71ca8d -
Branch / Tag:
refs/heads/main - Owner: https://github.com/shahriar0651
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fc2f3c26b326b44cb42b28b68c408107cc71ca8d -
Trigger Event:
workflow_dispatch
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c2ffb20837fd7403e2103665f90645cc541e6dc8795d3ff270fbd2371cc2a468
|
|
| MD5 |
174d53079de599dff447a184ccf26419
|
|
| BLAKE2b-256 |
d070971017d83ebc855a3a3a11dcf5b7f3c60bef0fd2559076dc0073e7e830a9
|
Provenance
The following attestation bundles were made for cpssbench-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on shahriar0651/cpssbench
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cpssbench-0.1.0-py3-none-any.whl -
Subject digest:
c2ffb20837fd7403e2103665f90645cc541e6dc8795d3ff270fbd2371cc2a468 - Sigstore transparency entry: 2810698307
- Sigstore integration time:
-
Permalink:
shahriar0651/cpssbench@fc2f3c26b326b44cb42b28b68c408107cc71ca8d -
Branch / Tag:
refs/heads/main - Owner: https://github.com/shahriar0651
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@fc2f3c26b326b44cb42b28b68c408107cc71ca8d -
Trigger Event:
workflow_dispatch
-
Statement type: