Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
f52d079
Added project folder structure
shreyanshi-03 Aug 19, 2025
4b52a28
Merge pull request #2 from shreyanshi-03/shreyanshi
shreyanshi-03 Aug 20, 2025
6396672
Delete data directory
shreyanshi-03 Aug 20, 2025
97f6f99
Delete documents directory
shreyanshi-03 Aug 20, 2025
9813b74
Delete scripts directory
shreyanshi-03 Aug 20, 2025
79acc02
Delete notebooks directory
shreyanshi-03 Aug 20, 2025
e94518e
Added main.py
AARIFA-R Aug 21, 2025
e685ebd
Merge pull request #7 from AARIFA-R/AARIFA-R
AARIFA-R Aug 21, 2025
49f737f
Update main.py
AARIFA-R Aug 21, 2025
59c9c71
added kddtestfile
its-saravanan Aug 22, 2025
dd9ebaa
Merge pull request #10 from SpringBoardMentor193s/Saravanan
itzsaravanan Aug 22, 2025
df4a1d6
Delete data/NSLKDD directory
itzsaravanan Aug 22, 2025
4431fb7
Add KDDTest+ dataset file
sindhu262005 Aug 23, 2025
64425e1
Add KDDTrain+.txt dataset to NSL-KDD folder
sindhu262005 Aug 23, 2025
ccba038
Merge pull request #13 from SpringBoardMentor193s/Sindhu
sindhu262005 Aug 23, 2025
0546a8c
Remove accidentally added NSL-KDD dataset folder
sindhu262005 Aug 23, 2025
9c3e750
Add NSL-KDD dataset and docs folder
sindhu262005 Aug 23, 2025
6c9d690
Deleted docs folder
sindhu262005 Aug 23, 2025
1441d2e
Add documentation.md file to docs folder
sindhu262005 Aug 23, 2025
5390084
Delete documentation.md
sindhu262005 Aug 23, 2025
5bdbd32
Update documentation: SentinelNet project overview and datasets
sindhu262005 Aug 23, 2025
27a7361
Merge branch 'sindhu' into main
sindhu262005 Aug 23, 2025
073d246
Delete docs/documentation.md
sindhu262005 Aug 23, 2025
26a2f9b
Updated README with changes
Aug 25, 2025
33d43d0
Added README and DataOverview documentation
Aug 29, 2025
4cfd62a
Rewrite README for SentinelNet NIDS
Aug 30, 2025
4fa5022
Delete README.md
Poornitha006 Sep 7, 2025
7c4d0b6
Delete DataOverview.md
Poornitha006 Sep 7, 2025
eb4e4f5
Create README.md
Poornitha006 Sep 11, 2025
949eab5
Update README.md
Poornitha006 Sep 11, 2025
753c28d
Update README.md
Poornitha006 Sep 11, 2025
c6e43dc
Update README.md
Poornitha006 Sep 11, 2025
4195a9f
Update README.md
Poornitha006 Sep 11, 2025
72b5836
Update README.md
Poornitha006 Sep 11, 2025
5006451
Update DataOverview.md
Poornitha006 Sep 14, 2025
0e06e97
Update README.md
Poornitha006 Sep 14, 2025
7b8aa30
Delete DataOverview.md
Poornitha006 Sep 14, 2025
314f24f
Added project folder structure with .gitkeep files
Sep 15, 2025
10c368d
Update README.md
Poornitha006 Sep 16, 2025
b222019
Merge branch 'SpringBoardMentor193s:poornitha' into poornitha
Poornitha006 Sep 16, 2025
04755c1
Merge pull request #75 from Poornitha006/poornitha
Poornitha006 Sep 16, 2025
f0e91e8
Create requirements.txt
Poornitha006 Sep 16, 2025
565fc5b
Merge branch 'SpringBoardMentor193s:poornitha' into poornitha
Poornitha006 Sep 19, 2025
2abd342
Add files via upload
Poornitha006 Sep 23, 2025
60f950e
Create data_overview.md
Poornitha006 Sep 23, 2025
18e8858
Update data_overview.md
Poornitha006 Sep 23, 2025
2dde58b
Merge pull request #86 from Poornitha006/poornitha
Poornitha006 Sep 28, 2025
b8ee447
Delete data/.gitkeep
Poornitha006 Sep 28, 2025
c7c4c7e
Delete notebooks/.gitkeep
Poornitha006 Sep 28, 2025
1c678fe
Merge pull request #1 from SpringBoardMentor193s/poornitha
Poornitha006 Oct 1, 2025
0d463da
Create documentation.md
Poornitha006 Oct 6, 2025
8bdb95e
Update documentation.md
Poornitha006 Oct 6, 2025
6c91058
Update documentation.md
Poornitha006 Oct 6, 2025
7f50589
Delete main.py
Poornitha006 Oct 6, 2025
4190ba5
Create main.py
Poornitha006 Oct 6, 2025
6da0a3b
Delete scripts/.gitkeep
Poornitha006 Oct 6, 2025
c46541e
Add files via upload
Poornitha006 Oct 6, 2025
0f6c81a
Add files via upload
Poornitha006 Oct 6, 2025
1cb075d
Add files via upload
Poornitha006 Oct 6, 2025
7358b9d
Add files via upload
Poornitha006 Oct 6, 2025
4d5d421
Add files via upload
Poornitha006 Oct 6, 2025
3eb61f5
Add files via upload
Poornitha006 Oct 6, 2025
79aba1d
Merge pull request #99 from Poornitha006/poornitha
Poornitha006 Oct 6, 2025
5f60695
Add files via upload
Poornitha006 Oct 6, 2025
d617570
Merge pull request #100 from Poornitha006/poornitha
Poornitha006 Oct 6, 2025
47db7ee
Add files via upload
Poornitha006 Oct 15, 2025
703a919
Delete docs/.gitkeep
Poornitha006 Oct 17, 2025
9621416
Merge pull request #102 from Poornitha006/poornitha
Poornitha006 Oct 17, 2025
c4ff46c
Merge pull request #2 from SpringBoardMentor193s/poornitha
Poornitha006 Oct 17, 2025
abc7d00
Merge pull request #103 from Poornitha006/poornitha
Poornitha006 Oct 17, 2025
207fa43
Merge pull request #3 from SpringBoardMentor193s/poornitha
Poornitha006 Oct 17, 2025
6f065d5
Merge pull request #104 from Poornitha006/poornitha
Poornitha006 Oct 17, 2025
814c00c
Add output folder with .gitkeep
Poornitha006 Oct 17, 2025
3ee23de
Add files via upload
Poornitha006 Oct 18, 2025
5bbb1b3
Delete output/.gitkeep
Poornitha006 Oct 18, 2025
44377a9
Merge pull request #108 from Poornitha006/poornitha
Poornitha006 Oct 18, 2025
bfd7c2d
Merge pull request #4 from SpringBoardMentor193s/poornitha
Poornitha006 Oct 18, 2025
1ee68e7
Merge pull request #109 from Poornitha006/poornitha
Poornitha006 Oct 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,28 @@
# SentinelNet
The goal of this project is to develop an AI-powered Network Intrusion Detection System (NIDS) capable of identifying malicious network trafic and cyber-attacks in real time. By leveraging machine learning techniques, the system will classify trafic as normal or suspicious based on historical data.
# SentinelNet – AI-Powered Network Intrusion Detection System (NIDS)

## 📌 Project Overview
SentinelNet is an AI-driven Network Intrusion Detection System that leverages machine learning to analyze and classify network traffic in real time. It extracts important features from traffic data, trains classification models, and raises alerts whenever anomalies or malicious activities are detected.

---

## 📊 Datasets Used

- **[NSL-KDD](https://www.unb.ca/cic/datasets/nsl.html)**
- Classic dataset with **42 features**.
- Attack categories: **DoS, Probe, U2R, R2L**.

- **[CICIDS2017](https://www.unb.ca/cic/datasets/ids-2017.html)**
- Modern dataset with **80+ flow-based features**.
- Includes varied real-world attacks such as **DDoS, Brute Force, SQL Injection, Botnets, Port Scans**, etc.

---

## ⚙️ Key Features
- Data preprocessing & cleaning pipeline.
- Feature extraction & selection for effective detection.
- Model training with algorithms such as **Decision Tree, Random Forest, SVM**.
- Performance evaluation using **Accuracy, Precision, Recall, F1-score**.
- Anomaly detection with **alerting and reporting** system.

---

Binary file added data/CICID2017.zip
Binary file not shown.
22,588 changes: 22,588 additions & 0 deletions data/KDDTest+.arff

Large diffs are not rendered by default.

22,544 changes: 22,544 additions & 0 deletions data/KDDTest+.txt

Large diffs are not rendered by default.

11,894 changes: 11,894 additions & 0 deletions data/KDDTest-21.arff

Large diffs are not rendered by default.

11,850 changes: 11,850 additions & 0 deletions data/KDDTest-21.txt

Large diffs are not rendered by default.

Binary file added data/KDDTest1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
126,017 changes: 126,017 additions & 0 deletions data/KDDTrain+.arff

Large diffs are not rendered by default.

125,973 changes: 125,973 additions & 0 deletions data/KDDTrain+.txt

Large diffs are not rendered by default.

25,236 changes: 25,236 additions & 0 deletions data/KDDTrain+_20Percent.arff

Large diffs are not rendered by default.

25,192 changes: 25,192 additions & 0 deletions data/KDDTrain+_20Percent.txt

Large diffs are not rendered by default.

Binary file added data/KDDTrain1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions data/data_overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Data Overview

## Dataset Sources
- **NSL-KDD**: [Download Link](https://www.unb.ca/cic/datasets/nsl.html)
- **CICIDS2017**: [Download Link](https://www.unb.ca/cic/datasets/ids-2017.html)

## NSL-KDD Schema
- Features: 41 (e.g., duration, protocol_type, service, flag, src_bytes, dst_bytes, …)
- Label: attack type (normal or different attack categories)

## Summary
- Train Dataset Rows: ~125,973
- Test Dataset Rows: ~22,544
- Unique Attack Labels: 23
- Top 5 Frequent Attacks: neptune, normal, smurf, satan, ipsweep

## Reflection

When analyzing the NSL-KDD dataset, one key observation is that network traffic is highly imbalanced. Certain attacks such as *neptune* and *smurf* appear very frequently, while others such as *perl* or *spy* occur only a handful of times. This imbalance reflects real-world traffic, where most events are normal or dominated by a few common types of attacks. Another pattern is that some features, like protocol type and service, strongly influence the distribution of attacks, highlighting how attackers often target specific services.

Detecting intrusions is challenging because malicious traffic can closely resemble normal traffic. Attackers continuously adapt their methods, introducing novel threats that may not match historical patterns. Moreover, high-dimensional network data with 40+ features makes it difficult to identify subtle anomalies. Many attacks are rare, so machine learning models may fail to generalize. Additionally, modern networks generate huge volumes of traffic, making real-time detection computationally expensive.

Overall, intrusion detection requires handling imbalanced datasets, evolving attack patterns, and distinguishing between very similar normal and abnormal traffic. These challenges motivate the need for advanced anomaly detection, AI-driven approaches, and continuous dataset updates.
487 changes: 487 additions & 0 deletions data/index.html

Large diffs are not rendered by default.

150 changes: 150 additions & 0 deletions documentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
# 🚀 SentinelNet – NSL-KDD Dataset Project Summary

**SentinelNet** is an AI-powered **Network Intrusion Detection System (NIDS)** designed to detect and classify malicious network traffic in real-time. Using machine learning, the system analyzes network traffic, extracts key features, trains classification models, and raises alerts for anomalies.

The project utilizes two benchmark datasets:

- **NSL-KDD** – Classical dataset for intrusion detection research
- **CICIDS2017** – Modern dataset with diverse and realistic cyberattacks

---

## 📊 NSL-KDD Dataset Overview

- The NSL-KDD dataset contains **42 features per record**.
- Features are grouped into:

| Feature Type | Description | Example Features |
|--------------|-------------|----------------|
| Basic Features | Core connection attributes | `duration`, `protocol_type`, `service`, `flag` |
| Content Features | Payload-related indicators | `hot`, `num_failed_logins`, `logged_in`, `root_shell` |
| Traffic/Time Features | Aggregated metrics over time | `count`, `srv_count`, `serror_rate` |
| Label | Target classification | `normal` or attack type |

---

### 🛡 Attack Categories

The dataset includes four main types of attacks:

1. **Denial of Service (DoS)** – Overloads target systems
2. **Probe** – Reconnaissance and network scanning
3. **User-to-Root (U2R)** – Local privilege escalation
4. **Remote-to-Local (R2L)** – Unauthorized remote access

---

## 🧹 Data Loading

We use two files:

- `KDDTrain+.txt` → Training data
- `KDDTest+.txt` → Testing data

Each file contains **41 features + 1 label + 1 difficulty column**.
Example features: `duration`, `protocol_type`, `service`, `flag`, `src_bytes`, `dst_bytes`

The **label** column indicates if the connection is normal or an attack.
The **difficulty** column is removed as it is not relevant for classification.

```python
train_df, test_df = load_data("KDDTrain+.txt", "KDDTest+.txt")


🧹 Preprocessing Steps


1. Drop Unnecessary Columns

Remove difficulty column as it does not contribute to classification.

2. Handle Categorical Features

Categorical features:

protocol_type (e.g., tcp, udp, icmp)

service (e.g., http, ftp, smtp)

flag (e.g., SF, S0, REJ)

These are converted into numeric values using One-Hot Encoding:
df = pd.get_dummies(df, columns=['protocol_type', 'service', 'flag'])


3. Label Encoding

Binary classification:

normal → normal

All attacks → attack

Multi-class classification:

Preserve all unique attack labels and encode numerically using LabelEncoder.

4. Feature Scaling

Numerical features are scaled using StandardScaler to standardize ranges.


📈 Exploratory Data Analysis (EDA)


Binary Classification Visualization

Create a new column binary:
df['binary'] = df['label'].apply(lambda x: 'normal' if x == 'normal' else 'attack')
Plot protocol distribution by binary classes:
plt.figure(figsize=(5,4))
sns.countplot(x='protocol_type', data=df, hue='binary', palette='colorblind')
plt.title('Attack vs Normal Distribution - NSL-KDD (Binary)')
plt.xlabel('Protocol Type')
plt.ylabel('Count')
plt.show()
This shows how TCP, UDP, and ICMP protocols are distributed across normal and attack connections.

Multi-class Classification Visualization
plt.figure(figsize=(7,5))
sns.countplot(x='protocol_type', data=df, hue='label', palette='colorblind')
plt.title('Attack Category Distribution - NSL-KDD (Multiclass)')
plt.xlabel('Protocol Type')
plt.ylabel('Count')
plt.legend(title='Attack Types', bbox_to_anchor=(1.05, 1), loc='upper left')
plt.show()


🏗 Train-Test Preparation

After preprocessing:

Separate features (X) and labels (y)

Ensure consistent encoding and scaling for both train and test data

Use stratified splitting to maintain class balance
X_train, y_train = preprocess_data(train_df, binary=True)
X_test, y_test = preprocess_data(test_df, binary=True)
Example shapes:
| Dataset | Shape |
| -------- | ------------- |
| Training | (125973, 120) |
| Testing | (22544, 120) |


✅ Conclusion

Preprocessing of the NSL-KDD dataset involves:

Dropping irrelevant columns (difficulty)

Encoding categorical variables

Handling binary vs multi-class labels

Scaling numerical features

Visualizing distributions to inspect class imbalance and protocol usage

This pipeline prepares the dataset for both binary intrusion detection and multi-class attack classification.
Loading