软件名称:基于机器学习的加密恶意流量分析与检测平台
维护状态:持续更新中
背景介绍
随着近年来 HTTPS 的普及,加密恶意流量攻击的比例也在逐渐提升。根据报告,
目前加密通信的恶意软件基本已经覆盖所有的攻击类型,例如特洛伊木马、勒
索软件、感染式、蠕虫病毒、下载器等,其中特洛伊木马和下载器类的恶意软
件家族占比较高。
常用的软件加密通信方式,可以粗略地分为六种:
Type
Means of Attack
Trojan Horse
C&C direct connection,White stands hidden transfer,Others
ransomware
C&C direct connection
Infection type software
C&C direct connection,normal discharge
Type
Means of Attack
worm virus
C&C direct connection,worm propagation
downloader
White stands hidden transfer,Others
快速上手
关键代码部分的文件目录:
malicious_traffic_detection_platform.traffic_platform
|
|_______ train_test (模型训练/预测)
| |____ dataset (清洗完毕的特征集)
| | |____ badx.csv (正常流量特征)
| | |____ goodx.csv (异常流量特征)
| |____ protocol (协议解析模板)
| | |____ ETHER
| | |____ FILES
| | |____ IP
| | |____ PORT
| | |____ UDP
| | |____ TCP
| | |____ WARN
| |____ safe_pcap (Folder)
| |
| |____ __init__.py
| |____ main.py (模型训练入口,支持 args 参数传入)
| |____ get_goodx.py (监听并根据协议模板自动解析本机 HTTPS 流量包,存储为
goodx.csv)
| |____ get_badx.py (根据协议模板自动解析本地 pcap 流量包,存储为
badx.csv)
| |____ get_feature.py (对 goodx.csv 和 badx.csv 的特征工程)
| |____ 抓包协议分析器.py (基于 tkinter 和 scapy 实现的模仿抓包工具
wireshark 的抓包平台)
| |
| |____ model.pkl
|_______ web_platform (基于 Flask 框架的前端界面)
| |____ __init__.py
| |____ runserver.py (程序入口)
| |____ setting.py (配置文件)
| |____ controller (业务视图)
| | |____ ————init__.py
| | |____ message.py (存放 WSGI 的构造函数)
| |____ User_Info.sqlite3 (MySQL)
| |____ pcap_test(测试 pcap 文件夹)
| |____ static (静态文件)
| | |____ css(Folder)
| | |____ fonts(Folder)
| | |____ js(Folder)
| |____ tempaltes (模板)
| | |____ logout.html
| | |____ login.html
| | |____ show_entries.html
| | |____ show_error.html
| | |____ upload.html
| | |____ button.html
| | |____ wait.html
| | |____ result.html
| |____ model (SQL)
| | |____ Category.py
| | |____ User.py
|_______ model.pkl
模型训练:
1. cd 到 traffic_platform 目录下
2. 键入 python -m traffic_platform.train_test.main --train --updata_goodset=True -
-updata_badset=True
模型预测结果(不需训练):
1. cd 到 traffic_platform 目录下
2. 键入 python -m traffic_platform.train_test.main --train
基于 Flask 的流量监测平台
1. cd 到 traffic_platform 目录下
2. 键入 python -m traffic_platform.web_platform.runserver