# نظام أمني ذكي موزّع لكشف التسلل في البيئات السحابية
# Smart-IDPS
### Smart Distributed Intrusion Detection System (Smart-IDPS)
### Smart Distributed Intrusion Detection and Prevention System for Cloud Environments
نظام كشف تسلل (IDS) موزّع، مبني على Apache Hadoop وApache Spark، يعمل على عنقود (Cluster) من ثلاث عقد فعلية، ويستخدم نموذج تعلّم آلي هرمي ثنائي المرحلة (Random Forest) لتصنيف حركة الشبكة إلى طبيعية أو مهاجمة، وتحديد نوع الهجوم عند اكتشافه.
A distributed, real-time network security monitoring system built on a multi-node OpenStack cluster, leveraging Apache Hadoop and Apache Spark for large-scale traffic analysis, and a two-stage machine learning pipeline for intrusion detection.
---
---
## 1. لمحة عامة عن المشروع
## 📌 Overview
يهدف المشروع إلى بناء نظام قادر على:
Smart-IDPS monitors network traffic across a distributed cloud environment in real time, detects malicious behavior (DDoS, Brute Force, DoS), classifies the type of attack, and enables both automatic and manual incident response — including IP blocking — through a live analyst dashboard.
- تجميع سجلات حركة الشبكة من سيرفرات افتراضية متعددة عبر Apache Kafka
- تخزينها بشكل موزّع ومتسامح مع الأعطال عبر Hadoop HDFS
The project was developed as a graduation thesis and demonstrates the practical necessity of distributed computing (Hadoop + Spark) for intrusion detection at scale, backed by benchmark comparisons against traditional single-node approaches.
- تحليلها وتصنيفها في الوقت الفعلي عبر Apache Spark ونموذج تعلّم آلي مدرَّب مسبقاً
- إثبات الجدوى الهندسية لاستخدام بيئة موزّعة (Spark على عنقود من 3 عقد) مقارنة بالمعالجة المركزية (Single-Node)، من خلال تجارب مقارنة موثّقة (زمن التدريب، الاستدلال، الدقة، وقابلية التوسّع)
---
## 🏗️ System Architecture
The system runs on a **three-node OpenStack cluster**:
كل عقدة تُدار عبر ملف `docker-compose.yml` مستقل ضمن مجلدها الخاص (`k1/`, `k2/`, `k3/`)، وتتصل ببعضها عبر شبكة داخلية باستخدام عناوين IP الثابتة للأجهزة.
> **Note:** Large binary artifacts (trained models, `.pcap` captures, datasets, `node_modules/`) are excluded from version control via `.gitignore` due to size constraints. See [Model & Dataset Access](#-model--dataset-access) below.
---
## 🚀 Getting Started
### Prerequisites
- Docker & Docker Compose installed on all three nodes
- Internal network connectivity between nodes (`10.0.0.x` — **do not use floating IPs**, they are NAT addresses and will break inter-node communication)
آلية التشغيل (Setup & Run)
### Setup
### المتطلبات الأساسية
1. Clone the repository on each node:
- Docker وDocker Compose على كل عقدة من الثلاث
cd ids-project
- اتصال شبكي بين العقد الثلاث (نفس الشبكة الداخلية)
```
- تحديث عناوين IP في ملفات `docker-compose.yml` لتطابق عناوين الأجهزة الفعلية الحالية
2. Navigate to the relevant node directory (`k1-node`, `k2-node`, or `k3-node`) and start its services:
```bash
docker-compose up -d
```
> If you change a `docker-compose.yml` file, use `docker-compose up -d --force-recreate` — `restart` does **not** apply config changes.
| Model comparison | Random Forest is 3.84× faster than GBT in Stage 2 |
| Distributed vs. single-node | scikit-learn fails at full scale (16M rows); Spark succeeds |
> **Known limitation**: The two-stage classifier occasionally confuses DoS and DDoS due to the absence of a multi-source traffic indicator among the 22 selected features — addressed in the thesis as a justification for human-in-the-loop retraining.