Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 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
455c865
Restructured project into standard layout
yasaswitaraja Aug 23, 2025
45be184
Added NSL-KDD dataset and basic analysis code
yasaswitaraja Aug 23, 2025
6f90ea2
Delete plots directory
yasaswitaraja Aug 23, 2025
76d4b46
Delete scripts directory
yasaswitaraja Aug 23, 2025
1e99e82
Delete models directory
yasaswitaraja Aug 23, 2025
e7b7611
Organized dataset documentation and visualizations
yasaswitaraja Aug 23, 2025
de0b958
Merge pull request #11 from yasaswitaraja/main
yasaswitaraja Aug 23, 2025
71487ea
Delete requirements.txt
yasaswitaraja Sep 14, 2025
77f969c
Delete README.md
yasaswitaraja Sep 14, 2025
5e65890
Add files via upload
yasaswitaraja Sep 14, 2025
ed506a5
Delete src directory
yasaswitaraja Sep 14, 2025
9f1ffa1
Create CICISA 2017
yasaswitaraja Sep 14, 2025
3e6f17c
Delete data/CICISA 2017
yasaswitaraja Sep 14, 2025
399cb4b
Create CICIDS 2017
yasaswitaraja Sep 14, 2025
cfdb69f
Delete data/CICIDS 2017
yasaswitaraja Sep 14, 2025
7b0db43
Add CICIDS2017 dataset - Friday Working Hours Afternoon DDos
yasaswitaraja Sep 14, 2025
8cdf698
Delete docs/datapreprocessing-checkpoint.ipynb
yasaswitaraja Sep 15, 2025
75b245d
CICIDS2017- Traffic distribution visualization
yasaswitaraja Sep 15, 2025
bf97ee6
Created using Colab
yasaswitaraja Sep 16, 2025
0178a8d
NSS-KDD data set preprocessing outputs
yasaswitaraja Sep 16, 2025
e280563
Add NSS-KDD analysis outputs and visualizations
yasaswitaraja Sep 16, 2025
a947dc6
Created using Colab
yasaswitaraja Sep 20, 2025
6f55815
Created using Colab
yasaswitaraja Sep 20, 2025
5517ed0
Created using Colab
yasaswitaraja Sep 20, 2025
8cf6680
Delete notebooks/.ipynb
yasaswitaraja Sep 20, 2025
826bd42
CICIDS dataset preprocessing
yasaswitaraja Sep 20, 2025
2bf9fbe
Added CICIDS Outputs
yasaswitaraja Sep 20, 2025
27cf6db
Created using Colab
yasaswitaraja Sep 20, 2025
cb28d42
Delete notebooks/NSS_KDD.ipynb
yasaswitaraja Sep 20, 2025
9c139fb
Add files via upload
yasaswitaraja Sep 23, 2025
af60475
Rename NSS-KDD Distribution of Different Attack Types.png to NSL-KDD …
yasaswitaraja Sep 23, 2025
2927519
Delete outputs/NSS-KDD Accuracy for different models.png
yasaswitaraja Sep 23, 2025
a963636
Rename NSS-KDD Confusion Matrix.png to NSL-KDD Confusion Matrix.png
yasaswitaraja Sep 23, 2025
553e6bf
Rename NSS-KDD Correlation Heatmap of Numerical Features.png to NSL-K…
yasaswitaraja Sep 23, 2025
47de22e
Rename NSS-KDD Distribution of Network Traffic.png to NSL-KDD Distrib…
yasaswitaraja Sep 23, 2025
c648498
Rename NSS-KDD Important features.png to NSL-KDD Important features.png
yasaswitaraja Sep 23, 2025
1204de5
Rename NSS-KDD Outlier Detection.png to NSL-KDD Outlier Detection.png
yasaswitaraja Sep 23, 2025
4b212b1
Rename NSS-KDD protocol dristribution, Service types, Flag distributi…
yasaswitaraja Sep 23, 2025
e901c71
Rename cicids_top10_attack_types.png to CICIDS_top10_attack_types.png
yasaswitaraja Sep 23, 2025
64c39dc
Delete outputs/image.png
yasaswitaraja Sep 23, 2025
272e446
Rename kdd_attack_categories.png to NSL-KDD_attack_categories.png
yasaswitaraja Sep 23, 2025
0a10a49
Rename kdd_attack_types.png to NSL-KDD_attack_types.png
yasaswitaraja Sep 23, 2025
a3c5b94
Add files via upload
yasaswitaraja Sep 24, 2025
893dfcc
NSL-KDD.ipynb
yasaswitaraja Sep 25, 2025
f335db9
Delete notebooks/NSL-KDD.ipynb
yasaswitaraja Sep 25, 2025
dd35901
NSL-KDD dataset
yasaswitaraja Sep 25, 2025
60879e7
Delete notebooks/NSL_KDD.ipynb
yasaswitaraja Sep 25, 2025
6ff454e
Add files via upload
yasaswitaraja Sep 25, 2025
150b0db
Rename Screenshot 2025-09-25 213859.png to ROC Curve Comparision of …
yasaswitaraja Sep 25, 2025
8bc5bcb
Created using Colab
yasaswitaraja Sep 28, 2025
f8a5506
Created using Colab
yasaswitaraja Sep 28, 2025
988f149
Created using Colab
yasaswitaraja Sep 29, 2025
5cae7cd
Delete notebooks/NSL_KDD_.ipynb
yasaswitaraja Sep 29, 2025
8e33850
Created using Colab
yasaswitaraja Sep 29, 2025
e3fd64a
Created using Colab
yasaswitaraja Sep 29, 2025
0bffe3e
Created using Colab
yasaswitaraja Sep 29, 2025
e4e5421
Add files via upload
yasaswitaraja Oct 1, 2025
d44948e
Delete Model Evaluation Metrics.docx
yasaswitaraja Oct 1, 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
13 changes: 2 additions & 11 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2025 SpringBoardMentor193s
Copyright (c) 2025 yasaswitaraja

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -9,13 +9,4 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
[Full MIT License Text here or link to https://opensource.org/licenses/MIT]
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
# 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 Project
This project is for AI-powered Network Intrusion Detection System. SentinelNet is a project that analyzes network intrusion datasets to help detect cyber attacks. It’s designed to explore, visualize, and categorize network traffic into different types of attacks, giving a clear picture of which attacks are more frequent and how balanced the dataset is.

The project focuses on two widely used datasets:

NSL-KDD – A classic network intrusion detection dataset with labels for attacks like DoS (Denial of Service), Probe, R2L (Remote to Local), U2R (User to Root), and Normal traffic.

CICIDS2017 – A modern network dataset with real traffic captured over an afternoon, including multiple attack types like DDoS, PortScan, and more.

Run the main script:
'''python scripts/main.py'''
111 changes: 111 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
import streamlit as st
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler, LabelEncoder
from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score, confusion_matrix, ConfusionMatrixDisplay
from sklearn.linear_model import LogisticRegression
from sklearn.ensemble import RandomForestClassifier, GradientBoostingClassifier
from sklearn.tree import DecisionTreeClassifier
import matplotlib.pyplot as plt

# -------------------- Sidebar --------------------
st.sidebar.title("⚡ SentinelNet IDS")
st.sidebar.subheader("Upload & Configure")

# Upload dataset
uploaded_file = st.sidebar.file_uploader("📂 Upload CSV Dataset", type=["csv"])

# Select model
model_choice = st.sidebar.radio(
"🤖 Choose ML Model",
["Logistic Regression", "Random Forest", "Decision Tree", "Gradient Boosting"]
)

# Button to trigger training
train_button = st.sidebar.button("🚀 Run Intrusion Detection")

# -------------------- Main Page --------------------
st.title("🔐 Network Intrusion Detection System")
st.write("Upload a dataset, choose a model from the sidebar, and detect intrusions.")

if uploaded_file is not None:
# Load dataset
df = pd.read_csv(uploaded_file)
st.success(f"✅ Dataset Loaded: {df.shape[0]} rows, {df.shape[1]} columns")
st.dataframe(df.head())

if train_button:
try:
# -------------------- Data Preprocessing --------------------
# Assume last column is target
X = df.iloc[:, :-1].copy()
y = df.iloc[:, -1].copy()

# If target is continuous → convert to binary
if pd.api.types.is_numeric_dtype(y):
# Threshold = median
y_binary = (y > y.median()).astype(int)
y = y_binary
st.info("ℹ️ Target column was continuous → converted to binary classes (0/1).")

# If target is categorical text → encode
elif y.dtype == 'object':
le_target = LabelEncoder()
y = le_target.fit_transform(y)

# Encode categorical features
for col in X.columns:
if X[col].dtype == 'object':
le = LabelEncoder()
X[col] = le.fit_transform(X[col])

# Train/test split
X_train, X_test, y_train, y_test = train_test_split(
X, y, test_size=0.2, random_state=42, stratify=y
)

# Scale features
scaler = StandardScaler()
X_train_scaled = scaler.fit_transform(X_train)
X_test_scaled = scaler.transform(X_test)

# -------------------- Model Selection --------------------
if model_choice == "Logistic Regression":
model = LogisticRegression(max_iter=1000)
elif model_choice == "Random Forest":
model = RandomForestClassifier(n_estimators=100, random_state=42)
elif model_choice == "Decision Tree":
model = DecisionTreeClassifier(random_state=42)
elif model_choice == "Gradient Boosting":
model = GradientBoostingClassifier(random_state=42)

# -------------------- Training --------------------
model.fit(X_train_scaled, y_train)
y_pred = model.predict(X_test_scaled)

# -------------------- Metrics --------------------
acc = accuracy_score(y_test, y_pred)
prec = precision_score(y_test, y_pred, average='weighted', zero_division=0)
rec = recall_score(y_test, y_pred, average='weighted', zero_division=0)
f1 = f1_score(y_test, y_pred, average='weighted', zero_division=0)

st.subheader("📊 Evaluation Metrics")
st.write(f"**Model Used:** {model_choice}")
st.write(f"**Accuracy:** {acc:.4f}")
st.write(f"**Precision:** {prec:.4f}")
st.write(f"**Recall:** {rec:.4f}")
st.write(f"**F1 Score:** {f1:.4f}")

# -------------------- Confusion Matrix --------------------
cm = confusion_matrix(y_test, y_pred)
fig, ax = plt.subplots()
disp = ConfusionMatrixDisplay(confusion_matrix=cm)
disp.plot(ax=ax, cmap="Blues", colorbar=False)
st.pyplot(fig)

except Exception as e:
st.error(f"❌ Error during training: {e}")

else:
st.warning("⚠️ Please upload a dataset to proceed.")
Loading