作者literkid (literkid)
看板NetSecurity
标题[问题] 关於SNORT无法插入范例的preprocessor
时间Sun Sep 16 00:02:02 2007
请教各位有使用过SNORT的先进
我在FreeBSD 6.2上安装SNORT 2.6.1.5的版本
我参考以下这个网页来插入范例的preprocessor,结果遇到一些问题
http://afrodita.unicauca.edu.co/~cbedon/snort/spp_kickstart.html
我的操作步骤如下:
1.复制$SNORT_DIR/templates/spp_template.c和spp_template.h的档案到
$SNORT_DIR/src/preprocessors/下
2.修改to $SNORT_DIR/src/plugbase.c,如下:
In the includes section:
/* built-in preprocessors */
/*My preprocessor*/
#include "preprocessors/spp_template.h"
(...)
In the function InitPreprocessors:
void InitPreprocessors(){
/*My preprocessor*/
SetupTemplate();
3.修改$SNORT_DIR/src/preprocessors/Makefile.in,如下
libspp_a_SOURCES = spp_arpspoof.c spp_arpspoof.h spp_bo.c spp_bo.h \
(...)
spp_template.c spp_template.h
am_libspp_a_OBJECTS = spp_arpspoof.$(OBJEXT) spp_bo.$(OBJEXT) \
spp_template.$(OBJEXT)
4.执行configure和make,讯息如下:
##################################################################
gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I../.. -I../../src -I../../src/sfutil
-I../../src/output-plugins -I../../src/detection-plugins
-I../../src/dynamic-plugins -I../../src/preprocessors
-I../../src/preprocessors/flow -I../../src/preprocessors/portscan
-I../../src/preprocessors/flow/int-snort
-I../../src/preprocessors/HttpInspect/include
-I../../src/preprocessors/Stream5 -I/usr/local/include -g -O2 -Wall
-DDYNAMIC_PLUGIN -c spp_template.c
spp_template.c: In function `SetupTemplate':
spp_template.c:100: warning: implicit declaration of function `DebugMessage'
spp_template.c:100: error: `DEBUG_PLUGIN' undeclared (first use in this
function)
spp_template.c:100: error: (Each undeclared identifier is reported only once
spp_template.c:100: error: for each function it appears in.)
spp_template.c: In function `TemplateInit':
spp_template.c:117: error: `DEBUG_PLUGIN' undeclared (first use in this
function)
spp_template.c:131: warning: passing arg 1 of `AddFuncToPreprocList' from
incompatible pointer type
spp_template.c:131: error: too few arguments to function
`AddFuncToPreprocList'
*** Error code 1
Stop in /usr/src/literkid/snort-2.6.1.5/src/preprocessors.
*** Error code 1
Stop in /usr/src/literkid/snort-2.6.1.5/src/preprocessors.
*** Error code 1
Stop in /usr/src/literkid/snort-2.6.1.5/src.
*** Error code 1
Stop in /usr/src/literkid/snort-2.6.1.5.
*** Error code 1
Stop in /usr/src/literkid/snort-2.6.1.5.
##################################################################
5.因为范例程式码里的DEBUG_PLUGIN未定义,所以在spp_template.c加入debug.h函式库
#include "debug.h"
编译後的讯息如下:
##################################################################
spp_template.c: In function `SetupTemplate':
spp_template.c:102: warning: implicit declaration of function `DebugMessage'
spp_template.c: In function `TemplateInit':
spp_template.c:133: warning: passing arg 1 of `AddFuncToPreprocList' from
incompatible pointer type
spp_template.c:133: error: too few arguments to function
`AddFuncToPreprocList'
*** Error code 1
Stop in /usr/src/literkid/snort-2.6.1.5/src/preprocessors.
*** Error code 1
##################################################################
6.用DEBUG_WRAP()把DebugMessage()包起来
100:
DEBUG_WRAP(DebugMessage(DEBUG_PLUGIN,"Preprocessor: Template is
setup...\n"););
117:
DEBUG_WRAP(DebugMessage(DEBUG_PLUGIN,"Preprocessor: Template
Initialized\n"););
编译後的讯息如下:
##################################################################
spp_template.c: In function `TemplateInit':
spp_template.c:133: warning: passing arg 1 of `AddFuncToPreprocList' from
incompatible pointer type
spp_template.c:133: error: too few arguments to function
`AddFuncToPreprocList'
*** Error code 1
Stop in /usr/src/literkid/snort-2.6.1.5/src/preprocessors.
*** Error code 1
##################################################################
7.新版的SNORT似乎修改了AddFuncToPreprocList()的参数,故修改如下
131:
AddFuncToPreprocList(PreprocFunction, 0, 0);
8.编译後没有错误讯息,故把范例的preprocessor加入$SNORT/etc/snort.conf的设定
执行snort -c $SNORT/etc/snort.conf的结果如下:
##################################################################
etc/snort.conf(803) unknown dynamic preprocessor "template"
ERROR: Misconfigured dynamic preprocessor(s)
Fatal Error, Quitting..
##################################################################
有人遇过相同的问题吗?可以帮我解答吗?非常谢谢!
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 61.229.41.58