AI Sentinel is a real-time, machine-learning-powered firewall designed for PCs. It uses an Isolation Forest model to monitor network traffic and detect anomalies, providing an interactive web dashboard for visualization and control.
- ML Detection Engine: High-performance classification using the trained
firewall_anomaly_detection_model.pkl. - Premium Dashboard: A sleek, dark-themed UI built with FastAPI, Tailwind CSS, and Chart.js.
- Real-Time Analytics:
- Anomaly Risk Charts: Dynamic line charts plotting risk scores in real-time.
- Traffic Stats: Detailed counters for total flows and detected anomalies.
- Activity Logs: An auto-updating table of detailed network flow events.
- Interactive Controls:
- Sensitivity Threshold: Adjust the model's sensitivity on-the-fly.
- Simulation Mode: Safely test the firewall in a sandbox environment using the provided dataset.
firewall_engine.py: The core classification and packet processing engine.dashboard_app.py: FastAPI server that serves the dashboard and manages the core engine.static/index.html: The premium dashboard frontend.firewall_anomaly_detection_model.pkl: The trained Isolation Forest model and scaler.optional/: Contains non-essential files, including log2.csv, ESP32 deployment code, and research notebooks.
Ensure you have Python 3.8+ installed. It is recommended to use the existing virtual environment.
Run the following in your terminal:
.\venv\Scripts\python.exe -m pip install fastapi uvicorn pandas scikit-learn numpy plyer pydivertOption A: Manual Start (Visible)
python dashboard_app.pyOption B: Background Start (Hidden)
Double-click start_firewall.vbs to launch the firewall invisibly.
To monitor real-time network traffic instead of simulation:
- Open the dashboard at
http://localhost:8000. - Toggle "Simulation Mode" to OFF.
- Click "Start Engine".
- Note: Real-time traffic monitoring requires running the dashboard/terminal as Administrator because it uses
WinDivertto intercept packets.
To have the firewall turn on automatically with your PC:
- Press
Win + R, typeshell:startup, and press Enter. - Create a Shortcut to
start_firewall.vbsin that folder. - The AI Sentinel will now launch in the background every time you log in!
The firewall will now send Windows Toast notifications whenever a threat is detected by the ML model.
Built for the PC Firewall AI project.