Zierax/TinyML-Malware-LinuxTypes

GitHub: Zierax/TinyML-Malware-LinuxTypes

基于系统调用序列的Linux恶意软件家族分类器,通过TinyML知识蒸馏实现零内存占用的边缘端实时检测。

Stars: 0 | Forks: 0

TinyML 恶意软件 Linux 类型检测器

边缘端零 RAM 基于行为的系统调用机器学习

[![Python](https://img.shields.io/badge/Python-3.10%2B-blue?style=flat-square&logo=python)](https://www.python.org/) [![C99](https://img.shields.io/badge/C-C99-blue?style=flat-square&logo=c)](https://en.wikipedia.org/wiki/C99) [![Scikit-Learn](https://img.shields.io/badge/Scikit--Learn-1.4%2B-orange?style=flat-square&logo=scikit-learn)](https://scikit-learn.org/) [![LightGBM](https://img.shields.io/badge/LightGBM-4.3%2B-brightgreen?style=flat-square)](https://lightgbm.readthedocs.io/)

本项目实现了一种高度优化的、基于行为的机器学习架构,旨在仅通过监控系统调用序列,对 Linux 恶意软件家族进行分类——范围涵盖 `Ransomware` 到 `Trojans`。 虽然该项目提供了一个传统的、稠密的 **LightGBM pipeline**,可在强大的系统上实现 **>85% 的准确率**,但其核心亮点在于 **TinyML 知识蒸馏 pipeline**。该系统将提炼出的洞察蒸馏入高度剪枝的结构约束中,生成独立的 `C` 头文件,能够在资源极度受限的嵌入式边缘设备上以绝对的零动态 RAM 开销执行推理。 ## 性能评估与基准测试 当根据我们评估的硬件限制测试序列时,占用空间追踪揭示了我们的 TinyML C 编译蒸馏展开所产生指数级的效率: | 评估指标 | Python 服务器模式 (完整 LGBM) | Python 回退模式 (嵌入式 RF) | C 编译 TinyML 模式 (零 RAM) | |---|---|---|---| | **峰值推理延迟** | `147.9 ms` | `27.4 ms` | `0.0016 ms (1.6 µs)` | | **动态内存开销** | `125.0 KB` | `0 KB` | `0 KB` | | **模型磁盘大小** | `~2.5 MB` | `~300 KB` | `~50 KB` | ### 基准追踪 **完整模型阵列 (Dense TF-IDF + Pipeline 内存加载)** ![完整模型基准追踪](https://static.pigsec.cn/wp-content/uploads/repos/2026/03/7831bd0a90215456.png) **原生 C 嵌入式头文件 (瞬时浮点运算 - 绝对零约束)** ![C 嵌入式编译追踪](https://static.pigsec.cn/wp-content/uploads/repos/2026/03/5dec28dbf2215459.png) ## 项目结构 ``` . ├─ detector.py # Trains the massive density models; saves -> artifacts/model.joblib ├─ detector_embedded.py # Distills structural bounds; saves -> artifacts/model_embedded.h ├─ predict.py # Streaming CLI + importable prediction engine ├─ features.py # Custom 32-dim HandcraftedFeatures sequence transformers ├─ benchmark_c.py # Native compiled zero-latency Footprint Metrics ├─ c_harness.c # C testing suite for pure footprint profiling ├─ example_embedded.c # C Example using the compiled model header ├─ benchmark/ # Benchmark logging & analytical Matplotlib visual arrays ├─ _dataset.csv # Training dataset (Format: label, space-separated syscalls) ├─ sample.csv # Example input for predict CLI ├─ artifacts/ │ ├─ model.joblib # Saved pipeline (TF-IDF + 32-dim features + LightGBM) │ ├─ model_embedded.h # Single C Header struct storing pruned distillation logic │ └─ metrics.json # Operational evaluation JSON schemas └─ docs/ # Deep technical architecture documentation bounds ├─ academic_methodology.md ├─ benchmark.md ├─ embedded.md ├─ prediction.md ├─ setup.md ├─ TinyML.md └─ training.md ``` ## 安装 要求必须具备 Python 3.10+ 执行环境。核心处理依赖项包括 `scikit-learn`、`numpy`、`lightgbm` 和 `m2cgen`。 ``` git clone https://github.com/Zierax/TinyML-Malware-LinuxTypes.git cd TinyML-Malware-LinuxTypes pip install -r requirements.txt ``` ## 训练与模型蒸馏 数据 (`_dataset.csv`) 强制执行严格的结构:`
标签:Apex, C99, LightGBM, Linux恶意软件, Scikit-Learn, TinyML, 勒索软件检测, 客户端加密, 嵌入式安全, 性能优化, 木马检测, 机器学习, 检测绕过, 模型压缩, 知识蒸馏, 端点防护, 系统调用分析, 网络安全, 行为检测, 边缘计算, 逆向工具, 隐私保护, 零内存占用