Marta-Paras-Gutierrez/iot-anomaly-detection-system

GitHub: Marta-Paras-Gutierrez/iot-anomaly-detection-system

基于机器学习的物联网流量监控与异常检测系统,提供从网络模拟、流量捕获到模型分析与可视化的完整 pipeline。

Stars: 0 | Forks: 0

# 智能 IoT 流量监控与异常检测系统 一个使用 Machine Learning、GNS3、Wireshark 和 Python 的智能 IoT 网络流量监控与异常检测系统。 ![Python](https://img.shields.io/badge/Python-3776AB?style=for-the-badge&logo=python&logoColor=white) ![Machine Learning](https://img.shields.io/badge/Machine%20Learning-FF6F00?style=for-the-badge) ![IoT](https://img.shields.io/badge/IoT-0A192F?style=for-the-badge) ![Wireshark](https://img.shields.io/badge/Wireshark-1679A7?style=for-the-badge&logo=wireshark&logoColor=white) ![GNS3](https://img.shields.io/badge/GNS3-EA4335?style=for-the-badge) ![Streamlit](https://img.shields.io/badge/Streamlit-FF4B4B?style=for-the-badge&logo=streamlit&logoColor=white) ## 项目概述 本项目展示了用于在模拟 IoT 环境中监控网络流量和检测异常的模块化系统的设计与实现。 该工作流集成了 IoT 网络模拟、流量捕获、数据预处理、特征提取和 Machine Learning 技术,以分析网络行为并识别异常活动。 该项目完全使用 Python 开发,并包含一个用于可视化模型性能和检测结果的交互式仪表板。 ## 目标 本项目的主要目标是通过 Machine Learning 技术开发一个能够检测 IoT 网络环境中异常行为的模块化且可扩展的系统。 该系统旨在: - 模拟真实的 IoT 流量场景 - 捕获并分析网络行为 - 识别异常流量模式 - 比较有监督和无监督的 ML 方法 - 提供用于监控和分析的交互式可视化工具 ## 技术栈 - Python - Machine Learning - GNS3 - Wireshark / Tshark - Streamlit - Pandas - Scikit-learn - Matplotlib - 网络流量分析 ## 系统可视化 ### 家用 IoT 拓扑 ![家用拓扑](https://static.pigsec.cn/wp-content/uploads/repos/cas/b6/b637807935cb5aa63a230493cc2b8930c14105dd45fcfc3c4c23279eda803b2f.png) ### 工业 IoT 拓扑 ![工业拓扑](https://static.pigsec.cn/wp-content/uploads/repos/cas/25/25a1fcc74e854e4b02f99915e34c4d94882f78ef83af678237e71d4ed20baa5b.png) ### 正常流量监控 ![正常流量](https://static.pigsec.cn/wp-content/uploads/repos/cas/ac/ac506564650ffe6eb887c8cfc249c2805b59425ffb7a5544821e92990eec4980.png) ### 工业流量分析 ![工业流量](https://static.pigsec.cn/wp-content/uploads/repos/cas/cb/cbb3070ada6b13659b40c6eb1874a8ba86077bff1a95bbc3eef7f0b3bdfd50c2.png) ### 无法到达目标异常 ![无法到达目标](https://static.pigsec.cn/wp-content/uploads/repos/cas/d8/d85668c72b54ebfed48b7aa9880090ee0d4aa608e056acdf4ddb4e29d2b18daa.png) ### 模拟重连异常 ![模拟重连](https://static.pigsec.cn/wp-content/uploads/repos/cas/ce/cec67d63b27964e6fe37f978d67022bdcff3ef6d8a61a2d8d35b7469047e7bc7.png) ## 生成的可视化图表 ### 模型对比 ![模型对比](https://static.pigsec.cn/wp-content/uploads/repos/cas/23/2314e62350a64717f77446946ad805404a745be87ef2a3e8cdc8bf661e4783cb.png) ### 按捕获次数的异常检测 ![异常检测](https://static.pigsec.cn/wp-content/uploads/repos/cas/4e/4e5dccb3ecaa41eec58efd59d342cc652ea1b0eea720521ed0de241f07d60525.png) ### 随机森林混淆矩阵 ![混淆矩阵](https://static.pigsec.cn/wp-content/uploads/repos/cas/0c/0c7e7bc7f36d5553d84a8beff7a123663df698aed8b919891ec559c2fc9f26af.png) ## 功能特性 - IoT 网络模拟 - 流量捕获与预处理 - 特征提取 - 有监督异常检测 - 无监督异常检测 - 自动生成可视化 - 交互式 Streamlit 仪表板 - 模块化架构 ## 项目状态 项目已完成,并包含完整的 IoT 流量分析 pipeline: - PCAP 流量处理 - 数据集预处理 - 统计特征提取 - 有监督和无监督 Machine Learning - 模型评估 - 网络异常检测 - 交互式 Streamlit 仪表板 ## 项目工作流 ``` IoT Devices │ ▼ GNS3 Simulated Network │ ▼ Traffic Capture (Wireshark/TShark) │ ▼ Data Processing Pipeline │ ▼ Machine Learning Models │ ▼ Interactive Dashboard (Streamlit) ``` ## 仓库结构 ``` iot-anomaly-detection-system/ │ ├── captures/ ├── data/ ├── images/ ├── models/ ├── notebooks/ ├── results/ ├── src/ │ ├── data_processing/ │ ├── detection/ │ ├── machine_learning/ │ ├── visualization/ │ ├── config.py │ ├── utils.py │ └── main.py ├── .gitignore ├── LICENSE ├── README.md └── requirements.txt ``` ## 安装说明 克隆仓库: ``` git clone https://github.com/Marta-Paras-Gutierrez/iot-anomaly-detection-system.git cd iot-anomaly-detection-system ``` 创建虚拟环境(推荐): ``` python -m venv .venv ``` 激活虚拟环境。 **Windows** ``` .venv\Scripts\activate ``` **Linux / macOS** ``` source .venv/bin/activate ``` 安装项目依赖: ``` pip install -r requirements.txt ``` ## 使用说明 该项目包含一个控制台应用程序,允许独立执行 pipeline 的每个阶段或运行完整的工作流。 启动主菜单: ``` python -m src.main ``` 或者,可以直接启动交互式仪表板: ``` streamlit run src/visualization/dashboard.py ``` 可用模块包括: - PCAP 处理 - 数据集预处理 - 特征提取 - Machine Learning 模型训练 - 模型评估 - 流量异常检测 - 可视化生成 - 交互式仪表板 ## 未来改进 未来可能的扩展方向包括: - 实时流量监控 - 支持额外的 IoT 协议 - 基于 Deep Learning 的异常检测 - Docker 部署 - 自动生成警报 ## 许可证 本项目基于 MIT License 授权。有关更多详细信息,请参阅 [LICENSE](LICENSE) 文件。 ## 作者 **Marta Parás**
标签:Apex, GNS3, Kubernetes, Streamlit, Wireshark, 句柄查看, 异常检测, 机器学习, 物联网, 网络流量分析, 访问控制, 逆向工具