资源简介
snort-2.9.11是一款开源的入侵检测系统,想学习的可以下载下来研究研究
代码片段和文件信息
/* $Id$ */
/****************************************************************************
*
* Copyright (C) 2014-2017 Cisco and/or its affiliates. All rights reserved.
* Copyright (C) 2005-2013 Sourcefire Inc.
*
* 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. 51 Franklin Street Fifth Floor Boston MA 02110-1301 USA.
*
****************************************************************************/
// @file active.c
// @author Russ Combs
#ifdef HAVE_CONFIG_H
#include “config.h“
#endif
#ifdef HAVE_DUMBNET_H
#include
#else
#include
#endif
#include “active.h“
#include “session_api.h“
#include “stream_api.h“
#include “snort.h“
#include “preprocessors/spp_frag3.h“
#ifdef ACTIVE_RESPONSE
#include “encode.h“
#include “sfdaq.h“
#endif
// these can‘t be pkt flags because we do the handling
// of these flags following all processing and the drop
// or response may have been produced by a pseudopacket.
tActiveDrop active_drop_pkt = ACTIVE_ALLOW;
tActiveSsnDrop active_drop_ssn = ACTIVE_SSN_ALLOW;
// TBD consider performance of replacing active_drop_pkt/ssn
// with a active_verdict. change over if it is a wash or better.
int active_tunnel_bypass = 0;
int active_suspend = 0;
#ifdef ACTIVE_RESPONSE
int active_have_rsp = 0;
#define MAX_ATTEMPTS 20
static uint8_t s_attempts = 0;
static int s_enabled = 0;
static eth_t* s_link = NULL;
static ip_t* s_ipnet = NULL;
static void* s_rejData *s_rspData;
static Active_ResponseFunc s_rejFunc = NULL s_rspFunc = NULL;
static int Active_Open(const char*);
static int Active_Close(void);
static int Active_SendEth(const DAQ_PktHdr_t* int const uint8_t* uint32_t);
static int Active_SendIp(const DAQ_PktHdr_t* int const uint8_t* uint32_t);
typedef int (*send_t) (
const DAQ_PktHdr_t* h int rev const uint8_t* buf uint32_t len);
static send_t s_send = DAQ_Inject;
static uint64_t s_injects = 0;
static inline PROTO_ID GetInnerProto (const Packet* p)
{
if ( !p->next_layer ) return PROTO_MAX;
return ( p->layers[p->next_layer-1].proto );
}
//--------------------------------------------------------------------
// this implementation ensures that flexible responses
// take precedence over active responses.
int Active_QueueReject (void)
{
if ( Active_Suspended() )
return 0;
if ( !s_
- 上一篇:ADAMS Vibration 中文教材
- 下一篇:QT属性表改变值操作demo
评论
共有 条评论