RohithM17/AI-Malware-Detection-LightGBM

GitHub: RohithM17/AI-Malware-Detection-LightGBM

该项目利用静态分析和 LightGBM 机器学习算法,实现了面向计算资源受限端点的轻量级恶意软件家族分类与检测。

Stars: 0 | Forks: 0

\# 使用 LightGBM 的 AI 恶意软件检测 \> 使用静态分析和机器学习进行轻量级恶意软件家族分类,以实现实时端点安全。 \!\[Python\](https://img.shields.io/badge/Python-3.11-blue) \!\[LightGBM\](https://img.shields.io/badge/LightGBM-Machine%20Learning-green) \!\[Cyber Security\](https://img.shields.io/badge/Cyber%20Security-Malware%20Detection-red) \!\[Status\](https://img.shields.io/badge/Status-Completed-brightgreen) \--- \# 项目概述 本代码库包含我在 \*\*萨里大学(获 NCSC 认证)\*\* 完成的网络安全硕士论文项目。 该项目研究轻量级机器学习模型是否能够准确检测和分类恶意软件,同时仍适合部署在计算资源有限的端点设备上。 与计算密集型的深度学习方法不同,此解决方案使用 \*\*LightGBM\*\* 实现了高水平的恶意软件分类性能,并显著降低了内存使用和预测时间。 \--- \# 主要特性 \- 静态恶意软件特征提取 \- 使用 LightGBM 进行恶意软件家族分类 \- Random Forest 基线对比 \- 自动化特征重要性分析 \- 生成混淆矩阵 \- 生成分类报告 \- 类别分布分析 \- 针对新样本的恶意软件检测流水线 \--- \# 问题描述 传统的恶意软件检测方法通常依赖于基于签名的检测或资源密集型的深度学习模型。 本项目探索轻量级的机器学习方法是否能在保持适合部署在端点设备的同时,提供准确的恶意软件分类。 目标包括: \- 开发轻量级的恶意软件检测模型 \- 从恶意软件样本中提取有意义的静态特征 \- 比较多种机器学习算法 \- 使用标准分类指标评估检测性能 \- 展示其在实时部署中的适用性 \--- \# 数据集 本项目基于 \*\*Microsoft Malware Classification Challenge (BIG 2015)\*\* 数据集。 数据集特征: \- 约 \*\*6,500 个恶意软件样本\*\* \- \*\*9 个恶意软件家族\*\* \- 使用 \`.bytes\` 和 \`.asm\` 文件进行静态分析 \- 提取了 270 个数值特征 由于 Microsoft 的许可条款,本代码库不包含此数据集。 \--- \# 恶意软件家族 | Label | Malware Family | |------:|----------------| | 0 | Ramnit | | 1 | Lollipop | | 2 | Kelihos\_ver3 | | 3 | Vundo | | 4 | Simda | | 5 | Tracur | | 6 | Kelihos\_ver1 | | 7 | Obfuscator.ACY | | 8 | Gatak | \--- \# 项目工作流 \`\`\`text Malware Samples (.bytes / .asm) │ ▼ Feature Extraction │ ▼ Feature Dataset (.npz) │ ▼ Machine Learning (LightGBM / Random Forest) │ ▼ Model Evaluation │ ▼ Malware Prediction \`\`\` \--- \# 代码库结构 \`\`\` AI-Malware-Detection-LightGBM/ ├── dataset/ │ ├── trainLabels.csv │ └── big2015\_features.npz │ ├── docs/ │ └── Real-Time\_Malware\_Detection\_Using\_Lightweight\_AI\_Rohith\_Manju.pdf │ ├── images/ │ ├── confusion\_matrix.png │ ├── feature\_importance.png │ ├── class\_distribution.png │ ├── model\_comparison.png │ └── benchmark\_results.png │ ├── models/ │ ├── lightgbm\_big2015\_model.pkl │ └── randomforest\_big2015\_model.pkl │ ├── src/ │ ├── extract\_features.py │ ├── train\_big2015\_lightgbm.py │ ├── random\_forest.py │ ├── detect.py │ ├── comparison.py │ ├── confusion\_matrix.py │ ├── feature\_importance\_plot.py │ └── class\_distribution.py │ ├── requirements.txt └── README.md \`\`\` \--- \# 机器学习流水线 1\. 从恶意软件样本中提取静态特征 2\. 生成数值特征向量 3\. 准备带标签的数据集 4\. 训练 LightGBM 分类器 5\. 训练 Random Forest 基线模型 6\. 对比模型性能 7\. 使用多种指标进行评估 8\. 预测未知样本的恶意软件家族 \--- \# 结果 本项目使用以下指标评估性能: \- Accuracy \- Precision \- Recall \- F1-score \- Confusion Matrix \- Feature Importance \- 训练时间 \- 预测时间 实验表明,\*\*LightGBM 在保持计算高效的同时,提供了出色的恶意软件分类性能\*\*,使其成为轻量级端点恶意软件检测的理想选择。 :contentReference\[oaicite:1\]{index=1} \--- \# 使用的技术 \- Python \- LightGBM \- Scikit-learn \- NumPy \- Pandas \- Matplotlib \- Joblib \--- \# 展示的技能 \- 恶意软件分析 \- 机器学习 \- 静态特征工程 \- Python 开发 \- 模型评估 \- 数据可视化 \- 网络安全研究 \- 软件工程 \- 技术文档编写 \--- \# 未来改进 \- 动态恶意软件分析 \- 使用 SHAP 的可解释 AI \- REST API 部署 \- Docker 容器化 \- ONNX 模型转换 \- 实时端点监控 \- 实时威胁情报集成 \--- \# 安装说明 克隆代码库 \`\`\`bash git clone https://github.com/RohithM17/AI-Malware-Detection-LightGBM.git \`\`\` 安装依赖项 \`\`\`bash pip install \-r requirements.txt \`\`\` 训练模型 \`\`\`bash python src/train\_big2015\_lightgbm.py \`\`\` 运行恶意软件检测 \`\`\`bash python src/detect.py \`\`\` \--- \# 项目可视化 \#\# 混淆矩阵 \!\[混淆矩阵\](./images/confusion\_matrix.png) ![](https://raw.githubusercontent.com/RohithM17/AI-Malware-Detection-LightGBM/main/) \--- \#\# 特征重要性 \!\[特征重要性\](./images/feature\_importance.png) ![](https://raw.githubusercontent.com/RohithM17/AI-Malware-Detection-LightGBM/main/) \--- \#\# 类别分布 \!\[类别分布\](./images/class\_distribution.png) ![](https://raw.githubusercontent.com/RohithM17/AI-Malware-Detection-LightGBM/main/) \--- \#\# 模型对比 \!\[模型对比\](./images/model\_comparison.png) ![](https://raw.githubusercontent.com/RohithM17/AI-Malware-Detection-LightGBM/main/) \--- \#\# 基准测试结果 \!\[基准测试结果\](./images/benchmark\_results.png) ![](https://raw.githubusercontent.com/RohithM17/AI-Malware-Detection-LightGBM/main/) \--- \# 毕业论文 完整的硕士论文可在 \`docs\` 文件夹中找到,其中提供了以下方面的详细信息: \- 文献综述 \- 研究方法 \- 特征工程 \- 模型开发 \- 实验评估 \- 讨论 \- 局限性 \- 未来工作 \--- \# 关于我 \*\*Rohith Krishna Sivaprasad Manju\*\* 🎓 网络安全硕士 (优等) 萨里大学 📍 英国,伦敦 📧 rohithkrishna0707@gmail.com 💼 LinkedIn: https://linkedin.com/in/rohithkrishnasm0707 🐙 GitHub: https://github.com/RohithM17 \--- \# 许可证 本项目采用 MIT 许可证授权。
标签:Apex, LightGBM, Python, 云安全监控, 安全, 无后门, 机器学习, 超时处理, 逆向工具, 静态分析