为什么要了解snort插件的接口呢?有3个出发点:
一、为snort编写插件;
二、从系统架构层面学习接口的设计;
三、在明白了snort的插件接口规范之后,可以将某一插件完全剥离出来,更好的研究它;
本文是参考snort-2.9.5.5\doc\README.PLUGINS,发现其中有几个错误之处。
/* built-in preprocessors */
#include "preprocessors/spp_rpc_decode.h"
#include "preprocessors/spp_bo.h"
#include "preprocessors/spp_stream5.h"
#include "preprocessors/spp_arpspoof.h"
#include "preprocessors/spp_perfmonitor.h"
#include "preprocessors/spp_httpinspect.h"
#include "preprocessors/spp_sfportscan.h"
#include "preprocessors/spp_frag3.h"
#include "preprocessors/spp_normalize.h"
void RegisterPreprocessors(void)
{
LogMessage("Initializing Preprocessors!\n");
SetupARPspoof();
#ifdef NORMALIZER
SetupNormalizer();
#endif
SetupFrag3();
SetupStream5();
SetupRpcDecode();
SetupBo();
SetupHttpInspect();
SetupPerfMonitor();
SetupSfPortscan();
}
#ifndef __SPP_SFPORTSCAN_H__
#define __SPP_SFPORTSCAN_H__
void SetupSfPortscan(void);
#endif
sfportscan插件包含2个.h文件和2个.c文件,其中portscan.属于插件内部使用文件,spp_sfportscan.对外提供一个接口SetupSfPortscan().
libspp_a_SOURCES = spp_arpspoof.c spp_arpspoof.h spp_bo.c spp_bo.h \
spp_rpc_decode.c spp_rpc_decode.h \
stream_expect.c stream_expect.h \
spp_perfmonitor.c spp_perfmonitor.h \
perf.c perf.h \
perf-base.c perf-base.h \
perf-flow.c perf-flow.h \
perf-event.c perf-event.h \
$(PROCPIDSTATS_SOURCE) \
spp_httpinspect.c spp_httpinspect.h \
snort_httpinspect.c snort_httpinspect.h \
portscan.c portscan.h \
spp_sfportscan.c spp_sfportscan.h \
spp_frag3.c spp_frag3.h \
str_search.c str_search.h \
spp_stream5.c spp_stream5.h \
stream_api.c stream_api.h \
spp_normalize.c spp_normalize.h \
normalize.c normalize.h
本文介绍了snort插件接口规范,并拿sfportscan预处理插件作为实例进行了分析,下一步要学习sfportscan插件的源码。