Skip to main content

CoT-KG Network Intrusion Detection using Knowledge Graph and GraphSAGE

This project implements a network intrusion detection system using Chain of Thought (CoT), knowledge graphs and GraphSAGE model on the CICIDS2017 dataset. The Chain of Thought approach is used to enhance the knowledge graph construction and improve the interpretability of the detection process.

Key Features

  • Chain of Thought (CoT) enhanced knowledge graph construction
  • GraphSAGE-based network intrusion detection
  • Interpretable AI techniques for explaining detection results
  • Integration of domain knowledge with machine learning

Data Download and Preparation

The CICIDS2017 dataset is used in this project. Follow these steps to download and prepare the data:

  1. Clone this repository:
git clone https://github.com/chenxingqiang/cotkg-network-intrusion-detection.git
cd cotkg-network-intrusion-detection
  1. Install the required dependencies:
pip install -r requirements.txt
  1. Run the data download script:
python src/download_data.py

This script will:

  • Download the MachineLearningCSV.zip file from the CICIDS2017 dataset

  • Check the integrity of the downloaded file

  • Extract the contents to the data/raw/ directory

Note: The download might take some time as the file is about 224MB.

  1. After running the script, the data will be available in the data/raw/MachineLearningCVE/ directory.

Installation

To install the required dependencies, run:

pip install -r requirements.txt

Usage

After preparing the data, you can run the main script to train and evaluate the model:

python src/main.py

This script will:

  • Load and preprocess the data
  • Perform feature engineering
  • Construct the knowledge graph
  • Train the GraphSAGE model
  • Evaluate the model
  • Generate explanations for the predictions

Note

The raw data files are large and are not included in the git repository. They will be downloaded when you run the download_data.py script. If you need to share the project, others can use the same script to download the data.

Author

Chen Xingqiang Hanghzou Turing AI Co.,Ltd. Email: chen.xingqiang@iechor.com

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

Metadata

Release files for cotkg-network-intrusion-detection 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cotkg-network-intrusion-detection 0.1.1
File Size Uploaded
cotkg_network_intrusion_detection-0.1.1.tar.gz 56.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cotkg-network-intrusion-detection 0.1.1
File Interpreter ABI Platform
cotkg_network_intrusion_detection-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 83.0 kB

Release files / cotkg_network_intrusion_detection-0.1.1.tar.gz

Download URL cotkg_network_intrusion_detection-0.1.1.tar.gz
Size 56.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b8822ee247466d1f5d54adf6ac8b9bceda71ff7788c39be80fba59823f059b55
BLAKE2b-256 checksum
How to use checksums
2711e79d3bef3fe83e1e7089685f18e57656f62df016b6dae7d55155787d93d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.0

Release files / cotkg_network_intrusion_detection-0.1.1-py3-none-any.whl

Download URL cotkg_network_intrusion_detection-0.1.1-py3-none-any.whl
Size 26.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8dc6cc8f678d343ecdea0a7210a7fcfd280702ed1a2439a31adfe78de11da20f
BLAKE2b-256 checksum
How to use checksums
beca92fc7a2a90910bdb42e8c490812ac88f755734dc85814bd3032584c8c35a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.0

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release 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