How hoangnv2001/real-time-ids works
Main Components
• Frontend Web Interface:
• Represented by the “static” and “templates” folders.
• Components include HTML pages (main index and detailed flow view), CSS styling, and JavaScript for client-side interactivity.
• Backend Application Server:
• The “application.py” file is the main entry point that runs the Flask (or similar) web server.
• This component handles HTTP requests, routing, and rendering the web pages.
• Flow Data Handling Module:
• Located in the “flow” directory (e.g., Flow.py, FlowFeature.py, PacketInfo.py); these modules manage real-time flow capture and possibly pre-process the network traffic data.
• Machine Learning Component:
• In the “models” folder you see several model files:
• “autoencoder_39ft.hdf5” & “preprocess_pipeline_AE_39ft.save” for anomaly detection using an autoencoder.
• “model.pkl” and “scaler.pkl” plus the “explainer” subfolder, likely for the supervised learning part (Random Forest and related preprocessing).
• This indicates a dual approach:
◦ Supervised learning (for known attacks) with RF.
◦ Unsupervised learning (AE for anomaly detection).
• Third-Party / External Dependencies:
• External tools such as Npcap (mentioned in README) are used for capturing live network traffic.
• The environment setup and dependency management (requirements.txt) ensure that necessary libraries are included.
Relationships and Interactions
• The user interacts with the frontend interface (browser) that displays data and flow details.
• The frontend makes HTTP requests to the backend (application.py), which then processes these requests.
• The backend extracts network flow information, using modules from the “flow” directory.
• The captured flow data is then passed through the machine learning components (loaded ML models and preprocess pipelines from “models”) to determine whether an intrusion is detected.
• Finally, the processed results (detection outcomes) are sent back to the frontend for user display.
Architectural Patterns and Design Principles
• Separation of Concerns:
• Discrete modules for handling the web interface (static and templates), network traffic flow processing (flow/), and machine learning (models/).
• Model Integration:
• Clear boundaries exist where data preprocessing and prediction are decoupled from UI logic.
• Real-Time Processing:
• Real-time nature of flow capture and analysis, likely involving continuous data flow and rapid ML inference.
• Use of Modular, Reusable Components:
• The directory structure supports modularity (code separated by functionality).
Relevant Technologies, Frameworks, or Libraries
• Python 3.9 and its associated libraries as defined in requirements.txt.
• Likely a web framework (Flask or similar) for the backend in application.py.
• Machine learning frameworks/libraries – models in HDF5 and pickle suggest use of frameworks like Keras (TensorFlow) and scikit-learn.
• Npcap for network packet capturing.