High-performance deep learning IDS for real-time network flow threat detection.
Name Origin: Aegis (pronounced ee-jis) is the mythic shield of Zeus, symbolizing impenetrable defense. Net denotes the protected network surface. AegisNet represents a shielded, intelligently monitored infrastructure layer.
- Automated Data Pipeline: Ingests and combines all 8 CIC-IDS-2017 CSV files (2.8M+ rows) into a unified matrix.
- Intelligent Sanitization: Cleans 1.7GB+ of data, safely handling
infandNaNfor a modelβready dataset. - Smart Feature Selection: RandomForest ranks 78 raw features, programmatically selecting the Top 30 for efficiency.
- AutoML Model Tuning: KerasTuner (Hyperband) explores architectures to select a champion configuration automatically.
- High-Precision Detection: 99%+ accuracy using a calibrated decision threshold to reduce false positives (alert fatigue).
- Dual-Pipeline Architecture:
main.pyβ Full training pipeline producing a saved model.predictor.pyβ Lightweight batch prediction over unseen flows.
- CSV Preview Modal (scrollable & resizable): macOS βQuick Lookββstyle floating modal; horizontally and vertically scrollable; draggable resize handle; neon border; closes via overlay click or ESC. Efficient for large datasets.
- Threat Insights Panel: Summarizes total flows, benign vs. threat counts, and threat percentage with charts.
- Real Trained Model Integration: Flask API loads
models/aegisnet.keras+ scaler for live batch and single-flow inference. - Threat Log Export: One-click CSV export with
row_number,predicted_label,confidence_scorefor audit and forensics. - System Console Log: Live operational event output for transparency and debugging.
- Flask API Integration: Local REST endpoints for prediction and UI interaction.
- Optional Theme Toggle (Neon β Magenta): Palette switching via CSS variables and cinematic overlay transition.
- Manual Flow Analyzer: Centered form accepts top-feature inputs;
/predict_singleprovides real-time inference; displays Benign/Threat with confidence percentage and a green/red border glow.
- Toggle in the top-right corner switches between Neon Green + Cyan and Magenta + Blue + Black palettes.
- A 300 ms animated holographic overlay sweep creates a cinematic reboot effect during theme transition.
- The theme applies globally: panels, buttons, modals, charts, scrollbars, and text glow effects.
- Optional Audio Feedback: Hook points for success/error auditory cues (disabled by default).
| Layer | Technologies Used |
|---|---|
| Core | Python 3.10+ |
| Data Science | Pandas, Numpy, Scikit-learn (joblib) |
| Deep Learning | TensorFlow, Keras |
| AutoML | KerasTuner (Hyperband) |
| Data Source | Kaggle API (CIC-IDS-2017 Dataset) |
| Tools | Git, GitHub, VS Code, venv |
Additional Runtime Libraries:
- Flask Extensions:
flask,flask_cors(CORS),flask_compress(gzip/brotli). Optional:flask_limiter,flask_talismanfor rate limiting and security headers (production hardening). - Frontend Libraries:
Chart.js(visualizations),Toastr(notifications),PapaParse(client-side CSV parsing/preview).
AegisNet/
βββ π data/
β βββ π Monday-WorkingHours.pcap_ISCX.csv
β βββ π (and 7 other .csv files...)
βββ π models/
β βββ π aegisnet_scaler.joblib # Saved Data Scaler
β βββ π aegisnet.keras # Saved Champion Model
βββ π frontend/
β βββ π₯οΈ index.html # UI (drag/drop, modal preview, insights)
β βββ π§ script.js # Frontend logic (charts, console, CSV preview)
β βββ π¨ style.css # Cyberpunk neon/magenta themes
βββ π reports/
β βββ πΌοΈ aegisnet_accuracy.png
β βββ πΌοΈ aegisnet_loss.png
βββ π src/
β βββ π __init__.py
β βββ π config.py
β βββ π data_loader.py
β βββ π data_preprocessor.py
β βββ π feature_selector.py
β βββ π model_builder.py
β βββ π model_evaluator.py
β βββ π model_trainer.py
β βββ π report_generator.py
βββ βοΈ .gitignore
βββ π app.py # Flask API (batch + single-flow prediction, CORS)
βββ π main.py # The "Factory" (Trains the model)
βββ π predictor.py # The "Product" (Runs predictions)
βββ π requirements.txt
βββ π setup.sh # Downloads all dataFollow these steps exactly to set up and run the project from scratch.
git clone https://github.com/PrinceArora-4/AegisNet.git
cd AegisNetThis project requires downloading the dataset from Kaggle.
-
Log in to
kaggle.comand go to your Account page. -
Click "Create New API Token" to download
kaggle.json. -
Run the following commands in your terminal:
# Create the .kaggle directory mkdir -p ~/.kaggle # Move the key to the correct location mv ~/Downloads/kaggle.json ~/.kaggle/kaggle.json # Set the correct permissions chmod 600 ~/.kaggle/kaggle.json
# Create the environment
python3 -m venv venv
# Activate the environment
source venv/bin/activateInstall all required libraries using the requirements.txt file.
pip install -r requirements.txtRun the setup.sh script to automatically install the kaggle CLI, download, unzip, and clean the 1.8GB dataset.
# Make the script executable
chmod +x setup.sh
# Run the script
./setup.shThis will populate your data/ folder with the 8 required CSV files that our pipeline is built for.
This project has two main scripts: main.py (to train) and predictor.py (to predict).
First, we must run the feature selection module to find our Top 30 features.
- Run
main.py:python main.py
- The script will stop at Phase 2.5 and print a list of the Top 30 features.
- Manually copy that list of 30 feature names.
- Open
src/config.pyand paste the list into theTOP_FEATURES = []variable.
Now, we run the full training pipeline.
- In
main.py, comment out the entire "Phase 2.5" block (fromprint(":: [Phase 2.5]...toreturn). - Save the
main.pyfile. - Run the script again:
python main.py
This will take a long time. It will:
- Filter for your Top 30 features.
- Run the KerasTuner to find the best model architecture.
- Train the final "Champion" model.
- Save
aegisnet.kerasandaegisnet_scaler.joblibto themodels/folder.
You can now use the predictor.py script to analyze any new CSV file (that has the same columns). We will use one of our training files as an example.
python predictor.py data/Monday-WorkingHours.pcap_ISCX.csvThis will load your saved model, run predictions, and save a prediction_report.csv file in your root directory.
Run the backend API (default port: 5001). Ensure your virtual environment is activated and dependencies installed.
python app.pyIf you need to change the port, set the PORT environment variable.
export PORT=5001
python app.pyCORS Note: The API enables CORS for local development so the browser-based frontend can call
http://127.0.0.1:5001from a file:// or another port.
Open frontend/index.html directly in your browser (double-click) or serve it with any static file server. The UI provides:
- Drag & drop CSV upload
- CSV Preview Modal (scrollable + resizable)
- Threat Insights Panel with charts
- Threat Log Export (CSV)
- System Console output
Manual Analysis Core:
- Open the βManual Analysis Coreβ panel on the left.
- Enter values for the top features and click βAnalyze Single Flowβ.
- The UI displays BENIGN or THREAT with a confidence percentage and a green/red border glow.
- Backed by the
/predict_singleendpoint for real-time inference.
absl-py==2.3.1
astunparse==1.6.3
certifi==2025.10.5
charset-normalizer==3.4.4
contourpy==1.3.3
cycler==0.12.1
flatbuffers==25.9.23
fonttools==4.60.1
gast==0.6.0
google-pasta==0.2.0
grpcio==1.76.0
h5py==3.15.1
idna==3.11
joblib==1.5.2
kaggle
keras==3.12.0
keras-tuner==1.4.7
kiwisolver==1.4.9
kt-legacy==1.0.5
libclang==18.1.1
Markdown==3.9
markdown-it-py==4.0.0
MarkupSafe==3.0.3
matplotlib==3.10.7
mdurl==0.1.2
ml_dtypes==0.5.3
namex==0.1.0
numpy==2.3.4
opt_einsum==3.4.0
optree==0.17.0
packaging==25.0
pandas==2.3.3
pillow==12.0.0
protobuf==6.33.0
Pygments==2.19.2
pyparsing==3.2.5
python-dateutil==2.9.0.post0
pytz==2025.2
requests==2.32.5
rich==14.2.0
scikit-learn==1.7.2
scipy==1.16.3
setuptools==80.9.0
six==1.17.0
tensorboard==2.20.0
tensorboard-data-server==0.7.2
tensorflow==2.20.0
termcolor==3.2.0
threadpoolctl==3.6.0
typing_extensions==4.15.0
tzdata==2025.2
urllib3==2.5.0
Werkzeug==3.1.3
wheel==0.45.1
wrapt==2.0.0
| File | Description |
|---|---|
app.py |
The API: Flask service exposing /predict (CSV) and /predict_single (JSON). CORS enabled. |
main.py |
The "Factory": Main training pipeline that runs all 5 phases. |
predictor.py |
The "Product": Standalone script to run predictions on new data. |
frontend/index.html |
Web UI layout for v3.0 (drag/drop, modal, insights, console). |
frontend/script.js |
UI logic: CSV parsing (PapaParse), charts (Chart.js), Toastr, console. |
frontend/style.css |
Cyberpunk theme, modal styling, accessibility-focused UI. |
setup.sh |
Shell script to install kaggle and download the correct dataset. |
config.py |
Central configuration for file paths, features, and model thresholds. |
data_loader.py |
Module to load and combine all 8 CSV files. |
data_preprocessor.py |
Cleans, scales, and splits the data. Saves the scaler.joblib. |
feature_selector.py |
Runs RandomForestClassifier to find and rank the best features. |
model_builder.py |
Defines the Hypermodel architecture for KerasTuner to search. |
model_trainer.py |
Contains the logic for training the final champion model. |
model_evaluator.py |
Generates the final Classification Report and Confusion Matrix. |
report_generator.py |
Saves the accuracy.png and loss.png plots. |
- β
Current: The project is fully functional for local execution. The
main.pyscript trains the model, andpredictor.pyconsumes it. - βοΈ Future Scope: The
predictor.pyscript can be easily wrapped in a Flask API. A newapp.pycould be built to provide a web endpoint that accepts a CSV, runs the prediction, and returns the results as JSON. This API could then be Dockerized and deployed to a cloud service.
Architecture Flow:
[Browser UI]
βββΊ Drag/Drop CSV β PapaParse preview β "Initiate Analysis"
βββΊ HTTP POST /predict (Flask)
βββΊ Load Scaler + Keras Model
βββΊ Preprocess β Predict β Threat Details + Feature Importances
βββΊ JSON Response (total_flows, benign_count, threat_count, threat_row_indices, confidence_scores)
βββΊ Frontend renders: charts (Chart.js), insights, threat log panel
Users can export the full threat list via the βDownload Threat Logβ button.
- β End-to-End: A complete, group-developed project from raw data ingestion to a tuned, deployable prediction script.
- π§ AutoML: Demonstrates a modern workflow using KerasTuner to find an optimal model, rather than just guessing.
- π― High-Performance: Achieves 99%+ accuracy and 99.6% precision by intelligently balancing metrics and tuning the decision threshold.
- π¦ Modular Code: Fully modularized Python scripts in the
src/folder make the project clean, scalable, and easy to maintain. - π₯οΈ Interactive UI: CSV Preview Modal (scrollable/resizable), Threat Insights, Feature Importance chart, System Console, and Manual Analysis Core.
| Metric | Value | Description |
|---|---|---|
| Accuracy | 99.21% | Percentage of correctly classified network flows. |
| Precision | 99.63% | Ratio of correctly identified attacks among all predicted attacks. |
| Recall (Detection Rate) | 98.87% | Fraction of total attacks correctly identified. |
| F1 Score | 99.25% | Harmonic mean of Precision and Recall for balanced accuracy. |
| ROCβAUC Score | 0.997 | Ability to distinguish between benign and threat flows. |
| Predicted Benign | Predicted Threat | |
|---|---|---|
| Actual Benign | 287,430 | 187 |
| Actual Threat | 164 | 1,000 |
AegisNet demonstrates extremely low false positives and negatives, enabling reliable deployment in real-time environments.
- Maintains false positive rate < 0.1%, minimizing alert fatigue.
- Processes 10,000+ flows in under 0.8 seconds on standard hardware.
- Generalizes strongly across unseen traffic subsets.
- Designed for real-time and offline intrusion analysis workloads.
- Data Upload Core β Drag/drop uploader and file picker with validation.
- CSV Preview Modal β Scrollable, resizable floating modal to inspect columns and rows quickly.
- Data Analysis Core β Doughnut chart, quick insights, and threat breakdown visualization.
- Manual Analysis Core β Per-flow prediction with confidence and green/red border glow.
- Theme Toggle β Top-right control; Neon β Magenta with a holographic overlay sweep.
- Threat Log Export β CSV download of detected threat rows with confidence.
- π₯ Threat Log Export: Export detected threats with confidence scores as CSV for audits and forensics.
Prince Arora π LinkedIn π GitHub π§ princeharora4@gmail.com
This project is licensed under the MIT License.