亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? sp_clientserver.c

?? 著名的入侵檢測系統snort的最新版本的源碼
?? C
字號:
/* $Id$ *//* ** Copyright (C) 2002-2006 Sourcefire, Inc. ** Author: Martin Roesch ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License Version 2 as ** published by the Free Software Foundation.  You may not use, modify or ** distribute this program under any other version of the GNU General ** Public License. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *//* sp_clientserver  *  * Purpose: * * Wouldn't be nice if we could tell a TCP rule to only apply if it's going  * to or from the client or server side of a connection?  Think of all the  * false alarms we could elminate!  That's what we're doing with this one, * it allows you to write rules that only apply to client or server packets. * One thing though, you *must* have stream4 enabled for it to work! * * Arguments: *    *   None. * * Effect: * * Test the packet to see if it's coming from the client or the server side * of a connection. * * Comments: * * None. * *//* put the name of your pluging header file here */#ifdef HAVE_CONFIG_H#include "config.h"#endif#include <sys/types.h>#include <stdlib.h>#include <string.h>#include <ctype.h>#include "rules.h"#include "decode.h"#include "plugbase.h"#include "parser.h"#include "debug.h"#include "util.h"#include "plugin_enum.h"#include "snort.h"//#include "signature.h"#include "stream_api.h"typedef struct _ClientServerData{    u_int8_t from_server;    u_int8_t from_client;        u_int8_t ignore_reassembled; /* ignore reassembled sessions */    u_int8_t only_reassembled; /* ignore reassembled sessions */} ClientServerData;void FlowInit(char *, OptTreeNode *, int);void ParseFlowArgs(char *, OptTreeNode *);void InitFlowData(OptTreeNode *);int CheckFromClient(Packet *, struct _OptTreeNode *, OptFpList *);int CheckFromServer(Packet *, struct _OptTreeNode *, OptFpList *);int CheckForReassembled(Packet *, struct _OptTreeNode *, OptFpList *);int CheckForNonReassembled(Packet *p, struct _OptTreeNode *, OptFpList *);int OtnFlowFromServer( OptTreeNode * otn ){    ClientServerData *csd;    csd = (ClientServerData *)otn->ds_list[PLUGIN_CLIENTSERVER];    if(csd )    {        if( csd->from_server ) return 1;    }    return 0; }int OtnFlowFromClient( OptTreeNode * otn ){    ClientServerData *csd;    csd = (ClientServerData *)otn->ds_list[PLUGIN_CLIENTSERVER];    if(csd )    {        if( csd->from_client ) return 1;    }    return 0; }int OtnFlowIgnoreReassembled( OptTreeNode * otn ){    ClientServerData *csd;    csd = (ClientServerData *)otn->ds_list[PLUGIN_CLIENTSERVER];    if( csd )    {        if( csd->ignore_reassembled ) return 1;    }    return 0; }int OtnFlowOnlyReassembled( OptTreeNode * otn ){    ClientServerData *csd;    csd = (ClientServerData *)otn->ds_list[PLUGIN_CLIENTSERVER];    if( csd )    {        if( csd->only_reassembled ) return 1;    }    return 0; }/**************************************************************************** *  * Function: SetupClientServer() * * Purpose: Generic detection engine plugin template.  Registers the *          configuration function and links it to a rule keyword.  This is *          the function that gets called from InitPlugins in plugbase.c. * * Arguments: None. * * Returns: void function * ****************************************************************************/void SetupClientServer(void){    /* map the keyword to an initialization/processing function */    RegisterPlugin("flow", FlowInit, OPT_TYPE_DETECTION);    DEBUG_WRAP(DebugMessage(DEBUG_PLUGIN,                             "Plugin: ClientServerName(Flow) Setup\n"););}/**************************************************************************** *  * Function: FlowInit(char *, OptTreeNode *) * * Purpose: Configure the flow init option to register the appropriate checks * * Arguments: data => rule arguments/data *            otn => pointer to the current rule option list node * * Returns: void function * ****************************************************************************/void FlowInit(char *data, OptTreeNode *otn, int protocol){#ifdef STREAM4_UDP    if ((protocol != IPPROTO_TCP) && (protocol != IPPROTO_UDP))    {        FatalError("%s(%d): Cannot check flow connection "                   "for non-TCP and non-UDP traffic\n", file_name, file_line);    }#else    if(protocol != IPPROTO_TCP)    {        if (!stream_api || (stream_api->version != STREAM_API_VERSION5))        {            FatalError("%s(%d): Cannot check flow connection "                   "for non-TCP traffic\n", file_name, file_line);        }    }#endif    /* multiple declaration check */    if(otn->ds_list[PLUGIN_CLIENTSERVER])    {        FatalError("%s(%d): Multiple flow options in rule\n", file_name,                 file_line);    }            InitFlowData(otn);    ParseFlowArgs(data, otn);}/**************************************************************************** *  * Function: ParseFlowArgs(char *, OptTreeNode *) * * Purpose: parse the arguments to the flow plugin and alter the otn *          accordingly * * Arguments: otn => pointer to the current rule option list node * * Returns: void function * ****************************************************************************/void ParseFlowArgs(char *data, OptTreeNode *otn){    char *token, *str, *p;    ClientServerData *csd;    csd = (ClientServerData *)otn->ds_list[PLUGIN_CLIENTSERVER];    str = SnortStrdup(data);    p = str;    /* nuke leading whitespace */    while(isspace((int)*p)) p++;    token = strtok(p, ",");    while(token)     {        DEBUG_WRAP(DebugMessage(DEBUG_PLUGIN,                     "parsed %s,(%d)\n", token,strlen(token)););        while(isspace((int)*token))            token++;        if(!strcasecmp(token, "to_server"))        {            csd->from_client = 1;        }        else if(!strcasecmp(token, "to_client"))        {            csd->from_server = 1;        }         else if(!strcasecmp(token, "from_server"))        {            csd->from_server = 1;        }         else if(!strcasecmp(token, "from_client"))        {            csd->from_client = 1;        }        else if(!strcasecmp(token, "stateless"))        {            otn->stateless = 1;        }        else if(!strcasecmp(token, "established"))        {            otn->established = 1;        }        else if(!strcasecmp(token, "not_established"))        {            otn->unestablished = 1;        }        else if(!strcasecmp(token, "no_stream"))        {            csd->ignore_reassembled = 1;        }        else if(!strcasecmp(token, "only_stream"))        {            csd->only_reassembled = 1;        }        else        {            FatalError("%s:%d: Unknown Flow Option: '%s'\n",                       file_name,file_line,token);        }        token = strtok(NULL, ",");    }    if(csd->from_client && csd->from_server)    {        FatalError("%s:%d: Can't use both from_client"                   "and flow_from server", file_name, file_line);    }    if(csd->ignore_reassembled && csd->only_reassembled)    {        FatalError("%s:%d: Can't use no_stream and"                   " only_stream", file_name,file_line);    }    if(otn->stateless && (csd->from_client || csd->from_server))     {        FatalError("%s:%d: Can't use flow: stateless option with"                   " other options", file_name, file_line);    }    if(otn->stateless && otn->established)    {        FatalError("%s:%d: Can't specify established and stateless "                   "options in same rule\n", file_name, file_line);    }    if(otn->stateless && otn->unestablished)    {        FatalError("%s:%d: Can't specify unestablished and stateless "                   "options in same rule\n", file_name, file_line);    }    if(otn->established && otn->unestablished)    {        FatalError("%s:%d: Can't specify unestablished and established "                   "options in same rule\n", file_name, file_line);    }    if(csd->from_client)     {        AddOptFuncToList(CheckFromClient, otn);    }     if(csd->from_server)     {        AddOptFuncToList(CheckFromServer, otn);    }    if(csd->ignore_reassembled)     {        AddOptFuncToList(CheckForNonReassembled, otn);    }    if(csd->only_reassembled)     {        AddOptFuncToList(CheckForReassembled, otn);    }        free(str);}/**************************************************************************** *  * Function: InitFlowData(OptTreeNode *) * * Purpose: calloc the clientserver data node * * Arguments: otn => pointer to the current rule option list node * * Returns: void function * ****************************************************************************/void InitFlowData(OptTreeNode * otn){    /* allocate the data structure and attach it to the       rule's data struct list */    otn->ds_list[PLUGIN_CLIENTSERVER] = (ClientServerData *)         calloc(sizeof(ClientServerData), sizeof(char));    if(otn->ds_list[PLUGIN_CLIENTSERVER] == NULL)     {        FatalError("FlowData calloc Failed!\n");    }}/**************************************************************************** *  * Function: CheckFromClient(Packet *, struct _OptTreeNode *, OptFpList *) * * Purpose: Check to see if this packet came from the client side of the  *          connection. * * Arguments: data => argument data *            otn => pointer to the current rule's OTN * * Returns: 0 on failure * ****************************************************************************/int CheckFromClient(Packet *p, struct _OptTreeNode *otn, OptFpList *fp_list){#ifdef DEBUG_CS    DebugMessage(DEBUG_STREAM, "CheckFromClient: entering\n");    if(p->packet_flags & PKT_REBUILT_STREAM)    {        DebugMessage(DEBUG_STREAM, "=> rebuilt!\n");    }#endif /* DEBUG_CS */        if(!pv.stateful)    {        /* if we're not in stateful mode we ignore this plugin */        return fp_list->next->OptTestFunc(p, otn, fp_list->next);    }    if(p->packet_flags & PKT_FROM_CLIENT ||             !(p->packet_flags & PKT_FROM_SERVER))    {        return fp_list->next->OptTestFunc(p, otn, fp_list->next);    }    /* if the test isn't successful, this function *must* return 0 */    DEBUG_WRAP(DebugMessage(DEBUG_STREAM, "CheckFromClient: returning 0\n"););    return 0;}/**************************************************************************** *  * Function: CheckFromServer(Packet *, struct _OptTreeNode *, OptFpList *) * * Purpose: Check to see if this packet came from the client side of the  *          connection. * * Arguments: data => argument data *            otn => pointer to the current rule's OTN * * Returns: 0 on failure * ****************************************************************************/int CheckFromServer(Packet *p, struct _OptTreeNode *otn, OptFpList *fp_list){    if(!pv.stateful)    {        /* if we're not in stateful mode we ignore this plugin */        return fp_list->next->OptTestFunc(p, otn, fp_list->next);    }        if(p->packet_flags & PKT_FROM_SERVER ||             !(p->packet_flags & PKT_FROM_CLIENT))    {        return fp_list->next->OptTestFunc(p, otn, fp_list->next);    }    /* if the test isn't successful, this function *must* return 0 */    return 0;}/**************************************************************************** *  * Function: int CheckForReassembled(Packet *p, struct _OptTreeNode *otn,                                    OptFpList *fp_list) * * Purpose: Check to see if this packet came from a reassembled connection *          connection. * * Arguments: data => argument data *            otn => pointer to the current rule's OTN * * Returns: 0 on failure * ****************************************************************************/int CheckForReassembled(Packet *p, struct _OptTreeNode *otn, OptFpList *fp_list){    /* is this a reassembled stream? */    if(p->packet_flags & PKT_REBUILT_STREAM)    {        return fp_list->next->OptTestFunc(p, otn, fp_list->next);    }    /* if the test isn't successful, this function *must* return 0 */    return 0;}/*  * Function: int CheckForNonReassembled(Packet *p, struct _OptTreeNode *otn,                                    OptFpList *fp_list) * * Purpose: Check to see if this packet came from a reassembled connection *          connection. * * Arguments: data => argument data *            otn => pointer to the current rule's OTN * * Returns: 0 on failure * ****************************************************************************/int CheckForNonReassembled(Packet *p, struct _OptTreeNode *otn, OptFpList *fp_list){    /* is this a reassembled stream? */    if(p->packet_flags & PKT_REBUILT_STREAM)    {        return 0;    }    /* if the test isn't successful, this function *must* return 0 */    return fp_list->next->OptTestFunc(p, otn, fp_list->next);}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
午夜久久久久久久久| 久久蜜桃一区二区| 2024国产精品| 国产精品久久久久久久久图文区 | 热久久久久久久| 久久国产精品99久久久久久老狼 | 国产精品理伦片| 亚洲综合免费观看高清完整版| 日韩国产高清影视| 国产精品一区二区无线| 91丨九色porny丨蝌蚪| 欧美日韩免费一区二区三区视频| 日韩一区二区视频在线观看| 久久综合精品国产一区二区三区 | 丰满少妇在线播放bd日韩电影| 91丝袜美腿高跟国产极品老师| 欧美一区二区三区在线观看| 日本一区二区在线不卡| 亚洲h在线观看| 成人午夜在线视频| 日韩午夜精品视频| 亚洲欧美日韩在线| 国内国产精品久久| 欧美三级午夜理伦三级中视频| 精品成人私密视频| 夜夜嗨av一区二区三区网页 | 久久久不卡影院| 亚洲午夜精品17c| 成人国产免费视频| 91精品国产手机| 亚洲人妖av一区二区| 国产综合色在线| 欧美高清视频一二三区 | 成人av小说网| 欧美成人在线直播| 亚洲午夜羞羞片| 国产.欧美.日韩| 日韩手机在线导航| 一区二区三区在线视频免费观看| 黄一区二区三区| 欧美日韩视频一区二区| 国产精品乱人伦中文| 激情综合网天天干| 欧美二区三区91| 亚洲免费色视频| 国产综合色在线视频区| 制服丝袜中文字幕亚洲| 亚洲综合另类小说| 91热门视频在线观看| 国产精品三级电影| 亚洲一级电影视频| 色天使色偷偷av一区二区| 色综合久久中文字幕综合网| 国产一区二区三区| 肉色丝袜一区二区| 久久国产生活片100| 欧美日韩一本到| 在线观看视频一区二区欧美日韩| 中文字幕在线不卡| 日本视频一区二区| 日本精品一级二级| 亚洲欧美日韩电影| 99国产欧美另类久久久精品| 国产丝袜在线精品| 国产一区二区在线免费观看| 精品免费99久久| 奇米777欧美一区二区| 欧美一区二区成人| 日韩高清在线电影| 日韩欧美国产综合一区| 蜜臀99久久精品久久久久久软件| 91精品国产一区二区三区蜜臀| 日韩黄色片在线观看| 欧美日本在线一区| 日本在线观看不卡视频| 91精品国产综合久久久久久久久久 | 国产日本欧洲亚洲| 国产成人在线视频网址| 久久久久久久久久久久久久久99 | 久久久久亚洲蜜桃| 国产成a人亚洲精品| 国产精品久久久久四虎| 99久久伊人精品| 欧美xingq一区二区| 黄色资源网久久资源365| 国产成人综合视频| 亚洲成人午夜影院| 中文字幕精品一区二区精品绿巨人| 91在线云播放| 激情综合一区二区三区| 日韩一区日韩二区| 精品久久一二三区| 欧美在线影院一区二区| 粉嫩蜜臀av国产精品网站| www.欧美色图| 欧美人xxxx| 看片网站欧美日韩| 精品视频全国免费看| 国产亚洲精品福利| 91丨国产丨九色丨pron| 天堂久久久久va久久久久| 日韩一级二级三级| 国产成人自拍高清视频在线免费播放| 日本一区二区三区国色天香 | 2023国产精华国产精品| 粉嫩aⅴ一区二区三区四区 | 制服.丝袜.亚洲.中文.综合| 久久精品国产久精国产| 中文在线免费一区三区高中清不卡| 成人动漫一区二区| 亚洲一区成人在线| 日韩欧美不卡一区| 成人av网站大全| 首页国产丝袜综合| 国产亚洲欧美一区在线观看| 色综合久久综合| 久久国内精品自在自线400部| 中文字幕日韩一区| 88在线观看91蜜桃国自产| 国产成人精品亚洲午夜麻豆| 亚洲一区二区三区免费视频| 精品88久久久久88久久久| 97精品电影院| 美脚の诱脚舐め脚责91| 中文字幕亚洲在| 日韩三级免费观看| 91色porny| 国产毛片精品一区| 午夜激情一区二区| 国产精品午夜电影| 日韩丝袜美女视频| 日本道精品一区二区三区| 激情小说欧美图片| 亚洲激情在线激情| 国产视频视频一区| 欧美浪妇xxxx高跟鞋交| 99精品欧美一区| 国产一区日韩二区欧美三区| 性做久久久久久久免费看| 中文字幕乱码一区二区免费| 欧美大片在线观看一区二区| 欧美午夜精品一区二区三区| 国产69精品一区二区亚洲孕妇| 奇米一区二区三区| 亚洲自拍欧美精品| 国产精品日韩精品欧美在线| 日韩美一区二区三区| 欧美性色欧美a在线播放| av网站免费线看精品| 国产在线乱码一区二区三区| 五月婷婷综合在线| 亚洲天堂福利av| 欧美国产一区在线| 久久久久国色av免费看影院| 日韩欧美区一区二| 欧美一区二区三区电影| 欧美日韩中文国产| 色94色欧美sute亚洲线路二| 成人性视频网站| 久久久久久久国产精品影院| 3atv在线一区二区三区| 欧美熟乱第一页| 91国偷自产一区二区三区成为亚洲经典| 国产成人在线观看免费网站| 久久成人免费日本黄色| 日韩国产在线一| 婷婷久久综合九色国产成人| 亚洲一二三区视频在线观看| 亚洲欧美日韩中文播放| 中文字幕欧美一区| 日韩久久精品一区| 国产一区欧美一区| 精品国产乱码久久久久久蜜臀| 日一区二区三区| 欧美一级片在线看| 久久精品99国产精品日本| 国产目拍亚洲精品99久久精品| 精品一区二区影视| 久久久国产午夜精品| 国产不卡高清在线观看视频| 久久久精品综合| 成人手机在线视频| 亚洲美女视频在线| 欧美日韩国产欧美日美国产精品| 亚洲综合在线免费观看| 欧美在线三级电影| 日韩精彩视频在线观看| 精品福利一区二区三区| 国产aⅴ综合色| 奇米影视7777精品一区二区| 精品国产区一区| 欧美片在线播放| 国产一区二区三区四区五区入口| 亚洲同性gay激情无套| 亚洲国产精品二十页| 日韩手机在线导航| 国产日韩欧美精品一区| 精品黑人一区二区三区久久| 91视频观看视频| 国产精品1024久久|