nDPI分析
来源:互联网 发布:什么是淘宝a5 编辑:程序博客网 时间:2024/06/10 02:24
nDPI分析
一.概述
nDPI是保持高度欢迎的OpenDPI,在GPL证书下发布,它的目标是增加新的协议,扩展原有的库;为了支持多平台的体验,它除了支持UNIX系列外,还支持windows版本;而且,可以改动nDPI来适配流量监控的应用,当网络流量不需要监控时,可以减掉nDPI的某些特性。
nDPI可检测应用层的协议,它可检测非标准端口,如非80端口的http协议;或者检测标准端口,如80端口上的skype协议。
目前nDPI支持多种协议,如下:FTP POP SMTP IMAP DNS IPP HTTP MDNS NTP NETBIOS NFS SSDP BGP SNMP XDMCP SMB SYSLOG DHCP PostgreSQL MySQL TDS DirectDownloadLink l23V5 AppleJuice DirectConnect Socrates WinMX VMware PANDO Filetopia iMESH Kontiki OpenFT Kazaa Gnutella eDonkey Bittorrent OFF AVI FLASH OGG MPEG QuickTime RealMedia Windowsmedia MMS XBOX QQ MOVE RTSP Feidian lcecast PPLive………………下略。
二.nDPI原理
2.1检测模块的初始化
初始化检测模块完善参考数据结构
typedef struct ndpi_detection_module_struct
{
包含主要的结构:
1. TCP协议带payload检测函数
2. TCP协议不带payload检测函数
3. UDP协议带payload检测函数
4. UPD协议不带payload检测函数
5. 其他的协议检测函数
}
2.2数据检测流程
2.3 数据检测模块(以skype为例)
以skype为例,简述skype检测过程
2.3.1 skype注册函数 ndpi_search_skype()
标题中的函数在2.1中检测模块初始化的时候被注册到ndpi_detection_module_struct中:
void ndpi_search_skype(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
{
}
参数分析:1. struct ndpi_detection_module_struct *ndpi_struct
即上文2.1中检测模块初始化时生成的结构体,包含了协议分析函数;
2. struct ndpi_flow_struct *flow
该结构体包含了网络包中的数据。
2.3.2 skype协议检测函数
Void ndpi_search_skype(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
{
ndpi_check_skype(ndpi_struct, flow);
}
void ndpi_check_skype(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
{
具体的skype协议解析过程;
}
三.nDPI与netfilter的结合
在linux内核的插件netfilter中注册nDPI的协议分析引擎,
3.1注册的函数结构体
static struct xt_match
ndpi_mt_reg __read_mostly = {
.name = "ndpi",
.revision = 0,
.family = AF_INET,
.match = ndpi_mt, //在该函数中协议检测引擎分析路过的数据包
.checkentry = ndpi_mt_check,
.destroy = ndpi_mt_destroy,
.matchsize = sizeof(struct xt_ndpi_mtinfo),
.me = THIS_MODULE,
};
3.2 引擎的初始化
整个引擎可以通过netfilter注册到内核中或者可以编译成单独的模块进行动态加载和卸除,具体如下:
module_init(ndpi_mt_init);
module_exit(ndpi_mt_exit);
static int __init ndpi_mt_init(void)
{
1. 引用前文2.1中检测模块的初始化;
2. ret = xt_register_match(&ndpi_mt_reg);即这侧3.1中定义的函数结构体;
}
- nDPI分析
- NDPI的分析
- NDPI的分析
- nDPI源码的一点分析
- 协议的注册与维护——ndpi源码分析
- FTP深度包检测——ndpi源码分析
- ndpi源码分析一--几个重要的结构体
- 【智能路由器】ndpi深度报文分析源码框架
- 【智能路由器】ndpi深度报文分析之协议分析器
- 协议的注册与维护——ndpi源码分析
- ndpi源码分析一--几个重要的结构体
- nDPI - Quick Start Guide
- ndpi工作流程
- nDPI快速上手指南
- Openwrt中添加ndpi支持
- nDPI的DNS协议解析
- 移植libpcap/ndpi到openwrt cc
- NDPI识别的协议号大全
- linux下,USB四大主要数据结构
- Ubuntu vi编辑器无法正常使用
- Scrum要点
- android图片处理问题
- sudo apt-get update
- nDPI分析
- 把文件夹变为“隐私分区”
- ImageView使用wrap_content时图片尺寸有缩放
- Java基础加强之动态代理
- mysql细节
- 别让用户发呆——设计中的防呆策略
- Linux芯片级移植与底层驱动(基于3.7.4内核)
- The note of Developing Innovative Ideas for New Companies Course
- 如何在iOS地图上高效的显示大量数据