00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifdef GIDS
00019
00020 #include <sys/types.h>
00021
00022 #include "decode.h"
00023 #include "event.h"
00024 #include "plugbase.h"
00025 #include "spo_plugbase.h"
00026 #include "parser.h"
00027 #include "debug.h"
00028 #include "plugin_enum.h"
00029 #include "detection-plugins/sp_stickydrop.h"
00030 #include "preprocessors/spp_stickydrop.h"
00031 #include "snort.h"
00032 #include "util.h"
00033
00034
00035 void AlertStickyDInit(u_char *);
00036 void AlertStickyD(Packet *, char *, void *, Event *);
00037 void AlertStickyDCleanExitFunc(int, void *);
00038 void AlertStickyDRestartFunc(int, void *);
00039
00040 extern OptTreeNode *otn_tmp;
00041 extern PV pv;
00042
00043 static int stickyd_out_running = 0;
00044
00045 void AlertStickyDSetup()
00046 {
00047
00048
00049 RegisterOutputPlugin("alert_StickyD", NT_OUTPUT_ALERT, AlertStickyDInit);
00050
00051 DEBUG_WRAP(DebugMessage(DEBUG_PLUGIN, "Output plugin: StickyD is setup...\n"););
00052 }
00053
00054
00055 void AlertStickyDInit(u_char *args)
00056 {
00057 if(!SppStickydIsRunning())
00058 {
00059 FatalError("dude, you can't have a stickydrop output-plugin without the stickydrop preproc\n");
00060 }
00061
00062 stickyd_out_running = 1;
00063
00064 DEBUG_WRAP(DebugMessage(DEBUG_PLUGIN, "Output: StickyD Initialized\n"););
00065
00066
00067 AddFuncToOutputList(AlertStickyD, NT_OUTPUT_ALERT, NULL);
00068 AddFuncToCleanExitList(AlertStickyDCleanExitFunc, NULL);
00069 AddFuncToRestartList(AlertStickyDRestartFunc, NULL);
00070 }
00071
00072
00073
00074 void AlertStickyD(Packet *p, char *msg, void *arg, Event *event)
00075 {
00076 StickyDSp *stickydsp_o;
00077 stickydsp_o=NULL;
00078
00079
00080 if(otn_tmp==NULL)
00081 {
00082 return;
00083 }
00084 if(p == NULL)
00085 {
00086 return;
00087 }
00088
00089 if(otn_tmp->ds_list[PLUGIN_STICKYDSP])
00090 {
00091 stickydsp_o=otn_tmp->ds_list[PLUGIN_STICKYDSP];
00092
00093 if(stickydsp_o)
00094 {
00095 printf("adding packet to block tree because we have options");
00096 AddIpToBlockTree(p, stickydsp_o->stickyd_direction, stickydsp_o->stickyd_timeout);
00097 }
00098 }
00099 else
00100 {
00101 return;
00102 }
00103 }
00104
00105 int StickyDOutputInitRun(void)
00106 {
00107 return stickyd_out_running;
00108 }
00109
00110 void AlertStickyDCleanExitFunc(int signal, void *arg)
00111 {
00112 return;
00113 }
00114
00115 void AlertStickyDRestartFunc(int signal, void *arg)
00116 {
00117 return;
00118 }
00119 #endif