How must0mar/network-traffic-anomaly-detection works
Main Components
• Data Collection & Preprocessing:
• Component: Capture_Detection.py
• Role: Captures network traffic data (normal and potentially malicious) using tools like tshark (as mentioned in the README). It also handles initial preprocessing and feature extraction from the raw packet data.
• Machine Learning Model:
• Component: AnomalyDetectionModel.joblib
• Role: Represents the trained model that classifies packets as normal or anomalous. This is the core of the AI-based detection.
• Notification/Guidance Module:
• Component: Email.py and associated configuration (emails.json, alert.json)
• Role: After detection, this module sends alerts or recommendations to the user via email. This aligns with the “User Guidance” objective in the README.
• API/Endpoint:
• Component: Endpoint.go (with go.mod and go.sum for dependency management)
• Role: Likely provides a backend API that interfaces with the detection service and serves results to the front-end, enabling integration and real-time communication.
• User Interface:
• Components: Files in the “Front-End” directory – index.html, email.html, Script.js, Styles.css.
• Role: Provides a user-friendly interface where users can view real-time monitoring data, alerts, and recommendations. It acts as the dashboard layer of the system.
• Supplementary/Logging:
• Files such as network_traffic_summary.json and packet_errors.log help track system outputs and errors, contributing to logging, monitoring, and offline analyses.
Interactions and Relationships
• Data Flow:
• Real-time network data (normal and anomalous) is captured by Capture_Detection.py.
• Preprocessed data is then fed into the ML module (AnomalyDetectionModel.joblib) for analysis.
• The ML module outputs classification results, which are then passed to an alert/notification system.
• Notification Flow:
• Email.py takes the detection result and triggers appropriate user notifications (using preconfigured details from alert.json or emails.json).
• API & UI Integration:
• The Endpoint.go component functions as the bridge between the backend processing and the front-end dashboard.
• The Front-End communicates with Endpoint.go via HTTP calls (or similar protocols) to display real-time results, alerts, network summaries, etc.
• Logging & Monitoring:
• Files like packet_errors.log and network_traffic_summary.json are updated continuously to provide logs and summaries, helping both in debugging and in performance monitoring of the system.
Architectural Patterns & Design Principles
• Layered Architecture:
• The design clearly separates data collection and processing, model inference, and user interaction which is a common pattern in full-stack systems.
• Real-Time Processing:
• Microservice/Modular Approach:
• Use of External Data and Communication: