CAN-Rakshak is a framework for evaluating and benchmarking CAN Intrusion Detection Systems (IDS). It provides tools for preprocessing CAN datasets, training IDS models, performing attacks, and evaluating their performance.
-
Clone the repository:
git clone https://github.com/spring-iitd/CAN-Rakshak.git cd CAN-Rakshak -
Install dependencies:
pip install -r requirements.txt
-
Prepare your dataset:
-
Inside the cloned repo, go to the
datasets/folder. -
Create a folder with the name of your dataset (e.g.,
Car_Hacking_Dataset). -
Add your dataset files and a preprocessing script inside it.
-
The preprocessing script must:
-
Include the line
from src.base_preprocessor import * -
Inherit the
DataPreprocessorclass. -
Implement the abstract function
preprocess_dataset. -
Convert raw data into CSV format with columns:
Timestamp, can_id, dlc, byte0..byte7, labelsIf
dlcis 5, prepend 3 zeros to make 8 databytes.
-
-
-
Modify configuration:
- Edit
src/config.pyto specify your dataset name, parameters, and (optionally) attack type.
- Edit
-
Train and Test IDS:
python3 src/main.py
- The results after testing will be stored inside the
Results/folder of your dataset.
- The results after testing will be stored inside the
-
Perform an Attack:
-
Set the attack name in
src/config.pyunderATTACK_NAME. -
Modify
src/attack_config.pyto adjust attack parameters. -
Re-run the IDS using:
python3 src/main.py
-
Attack results will also be saved in your dataset’s
Results/folder.
-
For complete setup, structure, and advanced details, visit the 📖 Full Documentation.
CAN-Rakshak/
├── attacks/ # Attack modules and handlers
├── datasets/ # Datasets and results
├── docs/ # Full detailed documentation
├── features/ # Feature extraction utilities
├── ids/ # IDS model definitions
├── models/ # Saved models
├── splitters/ # Data split utilities
└── src/ # Core scripts (train, test, config, etc.)
We welcome contributions! Please open an issue or pull request if you have improvements or new IDS/attack modules to add.
For any questions or setup assistance, refer to the full documentation: 👉 CAN-Rakshak Docs