Spaces:
Sleeping
Sleeping
Commit
Β·
452e476
1
Parent(s):
f52cb69
Added readme
Browse files
Readme.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: AI NIDS Backend
|
| 3 |
+
emoji: π‘οΈ
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: indigo
|
| 6 |
+
sdk: docker
|
| 7 |
+
app_port: 7860
|
| 8 |
+
pinned: false
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# π‘οΈ Adaptive AI Network Intrusion Detection System (NIDS)
|
| 12 |
+
|
| 13 |
+
This repository contains the backend API and machine learning logic for the AI-NIDS project. It is deployed as a Dockerized container on Hugging Face Spaces.
|
| 14 |
+
|
| 15 |
+
## π Key Features
|
| 16 |
+
- **Real-time Detection**: Flask-SocketIO with `eventlet` for high-concurrency traffic monitoring.
|
| 17 |
+
- **Dynamic ML Selection**: Automatically downloads and switches between `BCC` and `CICIDS` models from the Hugging Face Hub.
|
| 18 |
+
- **Cloud Guard**: Intelligent environment detection to disable raw socket sniffing when running in cloud environments (Hugging Face/Render).
|
| 19 |
+
- **Threat Analysis**: Integrated with Groq AI for deep packet inspection and human-readable threat summaries.
|
| 20 |
+
|
| 21 |
+
## π οΈ Tech Stack
|
| 22 |
+
- **Framework**: Flask & Flask-SocketIO
|
| 23 |
+
- **Server**: Eventlet / Gunicorn
|
| 24 |
+
- **Machine Learning**: Scikit-learn, LightGBM, Joblib
|
| 25 |
+
- **Deployment**: Docker
|
| 26 |
+
|
| 27 |
+
## π Environment Variables (Required)
|
| 28 |
+
To run this Space, you must configure the following **Secrets** in your Space Settings:
|
| 29 |
+
- `GROQ_API_KEY`: API key for AI threat analysis.
|
| 30 |
+
- `MAIL_USERNAME`: Gmail address for sending security alerts.
|
| 31 |
+
- `MAIL_PASSWORD`: Google App Password (16-character code).
|
| 32 |
+
- `HF_TOKEN`: (Optional) Required only if your model repository is private.
|
| 33 |
+
|
| 34 |
+
## π Project Structure
|
| 35 |
+
```text
|
| 36 |
+
.
|
| 37 |
+
βββ app.py # Main entry point (Port 7860)
|
| 38 |
+
βββ Dockerfile # Container configuration
|
| 39 |
+
βββ requirements.txt # Optimized dependencies
|
| 40 |
+
βββ README.md # This file (HF Config)
|
| 41 |
+
βββ utils/ # Model selector and helpers
|
| 42 |
+
βββ routes/ # API Blueprint definitions
|
| 43 |
+
βββ capture/ # Packet processing logic
|