DeepSec GRU IDS

Description
  • Date: 18/06/2025
  • Categories: Project
In today’s cybersecurity landscape, detecting threats in real time is no longer optional—it’s a necessity. That’s the idea behind DeepSec-GRU-IDS, a project I developed as part of my cybersecurity engineering program at ENSET Mohammedia, under the supervision of Mr. Soufiane Hamida. The project aims to detect anomalies in network traffic using a deep learning model specifically tuned for sequential data. It combines a Gated Recurrent Unit (GRU) neural network with FastAPI to enable fast, accurate intrusion detection in real-time environments.

Why Sequence Data Matters in Cybersecurity

Network traffic is inherently sequential. Attack patterns unfold over time—whether it’s a brute force login attempt or a slow port scan. That’s why sequence modeling techniques like GRU or LSTM are far more effective for intrusion detection than traditional feedforward models. In this project, I used preprocessed traffic data structured as time-ordered sequences. This format allows the model to learn temporal dependencies and spot unusual behaviors across sessions—not just within isolated packets.

Model Architecture: GRU Layers for Temporal Learning

The core of the system is a GRU model with two stacked layers: the first has 128 neurons, and the second 64 neurons. This architecture was chosen to balance learning capacity and model efficiency. One of the most notable outcomes was the model’s learning curve. It showed effective pattern recognition from the very first epoch, demonstrating strong generalization on the validation set and a smooth convergence trend.

Real-Time Detection with FastAPI

FastAPI was used to serve the model, enabling real-time inference through a RESTful API. The backend handles preprocessing of new traffic data, prediction, and structured logging of results for further analysis. The system also includes a simple visualization layer that displays alerts and detection metrics, making it easier for analysts to monitor system health and act on threats as they occur.
DeepSec-GRU-IDS demonstrates the power of combining deep learning with modern backend technologies for cybersecurity. It’s a practical, scalable solution for detecting threats that evolve over time—an increasingly common pattern in today’s networks.
You can explore the full project on GitHub: github.com/ElGhazi1/deepsec-gru-ids Let me know what you think, and feel free to reach out if you’d like to collaborate or provide feedback.