{"id":28919278,"url":"https://github.com/otuemre/realtimenids","last_synced_at":"2026-05-07T19:13:07.620Z","repository":{"id":295475690,"uuid":"990202279","full_name":"otuemre/RealTimeNIDS","owner":"otuemre","description":"Real-time network intrusion detection system using Zeek flow logs and machine learning (IsolationForest). Detects threats with both signature-based and anomaly-based techniques trained on the CSE-CIC-IDS2018 dataset.","archived":false,"fork":false,"pushed_at":"2025-06-10T16:17:14.000Z","size":46,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-23T23:38:01.840Z","etag":null,"topics":["anomaly-detection","cybersecurity","flow-analysis","isolation-forest","machine-learning","network-intrusion-detection","nids","scapy","scikit-learn","zeek"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/otuemre.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-25T17:51:52.000Z","updated_at":"2025-06-20T16:02:14.000Z","dependencies_parsed_at":"2025-07-23T22:40:15.222Z","dependency_job_id":"865a4500-7d21-451b-8602-bc21c6d9ada3","html_url":"https://github.com/otuemre/RealTimeNIDS","commit_stats":null,"previous_names":["otuemre/realtimenids"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/otuemre/RealTimeNIDS","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/otuemre%2FRealTimeNIDS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/otuemre%2FRealTimeNIDS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/otuemre%2FRealTimeNIDS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/otuemre%2FRealTimeNIDS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/otuemre","download_url":"https://codeload.github.com/otuemre/RealTimeNIDS/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/otuemre%2FRealTimeNIDS/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32752038,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-07T02:14:30.463Z","status":"ssl_error","status_checked_at":"2026-05-07T02:14:29.405Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["anomaly-detection","cybersecurity","flow-analysis","isolation-forest","machine-learning","network-intrusion-detection","nids","scapy","scikit-learn","zeek"],"created_at":"2025-06-22T03:05:27.033Z","updated_at":"2026-05-07T19:13:07.602Z","avatar_url":"https://github.com/otuemre.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Real-Time Network Intrusion Detection System (RealTimeNIDS)  \r\n![Python](https://img.shields.io/badge/Python-3.10-blue) ![Zeek](https://img.shields.io/badge/Zeek-NetworkMonitoring-orange) ![Sklearn](https://img.shields.io/badge/ML-IsolationForest-green) ![Platform](https://img.shields.io/badge/Cross--Platform-Windows%2C%20Linux%2C%20macOS-blueviolet) ![Status](https://img.shields.io/badge/Project-Active-important)\r\n\r\nThis project is a **Real-Time Network Intrusion Detection System (NIDS)** that monitors network traffic at the **flow level** using **Zeek**, extracts relevant features, and detects threats in real-time using both:\r\n\r\n- ✅ **Signature-based detection** (e.g., port scans)\r\n- ✅ **Anomaly-based detection** using a trained **IsolationForest** model\r\n\r\nThe system is trained on the **CIC-IDS 2018** dataset for realistic attack patterns and supports continuous monitoring via Zeek’s `conn.log`.\r\n\r\n\u003e ⚠️ **Important:** This project is for educational and research purposes. Always obtain permission before deploying on real or institutional networks.\r\n\r\n---\r\n\r\n## 📑 Table of Contents\r\n\r\n- [Features](#features)\r\n- [Tech Stack](#tech-stack)\r\n- [Installation](#installation)\r\n- [Zeek Configuration](#zeek-configuration)\r\n- [Running the System](#running-the-system)\r\n- [Project Structure](#project-structure)\r\n- [Future Improvements](#future-improvements)\r\n- [Acknowledgements](#acknowledgements)\r\n- [License](#license)\r\n\r\n---\r\n\r\n## 🚀 Features\r\n\r\n- 📡 **Real-time network monitoring** using Zeek\r\n- 🧠 **Anomaly detection** with IsolationForest (trained on CIC-IDS 2018)\r\n- 🛡️ **Signature-based detection** for rule-based threats like port scans\r\n- 📊 **Flow-level feature extraction** (e.g., byte rates, packet rates, flags)\r\n- ⚠️ **Threat detection console output** with structured threat data\r\n\r\n---\r\n\r\n## 🧰 Tech Stack\r\n\r\n- **Python 3.10**\r\n- **Zeek** – Real-time network traffic analyzer\r\n- **scikit-learn** – IsolationForest for anomaly detection\r\n- **joblib** – For loading pre-trained ML models\r\n- **WSL** (for Windows) – Zeek runs in Ubuntu via WSL\r\n- **Matplotlib / Pandas / NumPy** (used during training, optional for runtime)\r\n\r\n---\r\n\r\n## ⚙️ Installation\r\n\r\n### 1. Clone the repository\r\n```bash\r\ngit clone https://github.com/otuemre/RealTimeNIDS.git\r\ncd RealTimeNIDS\r\n```\r\n\r\n### 2. Install Python dependencies\r\n```bash\r\npip install -r requirements.txt\r\n```\r\n\r\n### 3. Install Zeek\r\n\r\nFor Ubuntu (WSL or native):\r\n```bash\r\nsudo apt update\r\nsudo apt install zeek\r\n```\r\n\r\n---\r\n\r\n## 🔧 Zeek Configuration\r\n\r\nTo start Zeek and monitor your interface:\r\n```bash\r\nsudo /opt/zeek/bin/zeek -i eth0 -C\r\n```\r\n\r\n- `eth0` is your interface (check with `ifconfig` inside WSL)\r\n- `-C` disables checksum validation (useful in WSL)\r\n\r\n\u003e 📁 Zeek will generate a `conn.log` file containing flow records.\r\n\r\n---\r\n\r\n## ▶️ Running the System\r\n\r\nChange the path to `conn.log` in `src/realtime_nids/zeek_monitor.py`:\r\n```python\r\nLOG_FILE = 'PATH_TO_YOUR_CONN_FILE'\r\n```\r\n\r\nStart your monitor in another terminal:\r\n\r\n```bash\r\npython src/realtime_nids/zeek_monitor.py\r\n```\r\n\r\nYou’ll see real-time detection logs like:\r\n```\r\n[*] Starting real-time Zeek log monitor...\r\n[!] 0 Live Threat Detect:\r\n    → {'type': 'signature', 'rule': 'port_scan', 'confidence': 1.0}\r\n    → {'type': 'anomaly', 'score': -0.72, 'confidence': 0.72}\r\n```\r\n\r\n\u003e ✅ Works for live tests (e.g., `hping3`, simulated attacks).\r\n\r\n---\r\n\r\n## 📁 Project Structure\r\n\r\n| File                                    | Description                                                               |\r\n|-----------------------------------------|---------------------------------------------------------------------------|\r\n| `src/realtime_nids/zeek_monitor.py`     | Reads and parses Zeek `conn.log` for real-time flow monitoring            |\r\n| `src/realtime_nids/detection_engine.py` | Contains both signature-based and IsolationForest-based anomaly detection |\r\n| `model/isolation_model.pkl`             | Pre-trained IsolationForest model (from CIC-IDS 2018)                     |\r\n| `src/realtime_nids/zeek_parser.py`      | (Optional helper) Parses logs and maps fields cleanly                     |\r\n| `notebooks/`                            | Jupyter notebooks for model training and threshold tuning                 |\r\n| `datasets/`                             | Location for downloaded training datasets                                 |\r\n| `.env`                                  | Configuration (optional, not required)                                    |\r\n\r\n---\r\n\r\n## 📈 Future Improvements\r\n\r\n- Add support for **model retraining pipeline**\r\n- Dynamic threshold tuning via **quantile calibration**\r\n- Web dashboard for real-time alert visualization\r\n- Support for other models (e.g., One-Class SVM, Autoencoders)\r\n- Add more signature-based approach derived on **CIC-IDS 2018** dataset\r\n\r\n---\r\n\r\n## 🙏 Acknowledgements\r\n\r\n- Based on FreeCodeCamp's [Real-Time IDS Tutorial](https://www.freecodecamp.org/news/build-a-real-time-intrusion-detection-system-with-python/)\r\n- IDS 2018 Intrusion CSVs (CSE-CIC-IDS2018) – Source: [Kaggle: IDS Intrusion CSVs](https://www.kaggle.com/datasets/solarmainframe/ids-intrusion-csv/)\r\n\r\n---\r\n\r\n## 📝 License\r\n\r\nLicensed under the [MIT License](LICENSE.md). You’re free to use and modify responsibly.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fotuemre%2Frealtimenids","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fotuemre%2Frealtimenids","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fotuemre%2Frealtimenids/lists"}