资源简介
# Download latest stable version of mod_evasive from zdziarski.com website
# See wget command below: the current version number is mod_evasive_1.10.1.tar.gz.
bash# wget http://www.zdziarski.com/projects/mod_evasive/mod_evasive_1.10.1.tar.gz
bash# tar xfz mod_evasive_1.10.1.tar.gz
bash# cd mod_ev
代码片段和文件信息
/* $Id: mod_evasive.cv 1.3 2005/10/08 19:17:14 jonz Exp $ */
/*
mod_evasive for Apache 1.3
Copyright (c) by Jonathan A. Zdziarski
LICENSE
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2
of the 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.
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include “httpd.h“
#include “http_core.h“
#include “http_config.h“
#include “http_log.h“
#include “http_request.h“
module MODULE_VAR_EXPORT evasive_module;
/* BEGIN DoS Evasive Maneuvers Definitions */
#define MAILER “/bin/mail -t %s“
#define LOG( A ... ) { openlog(“mod_evasive“ LOG_PID LOG_DAEMON); syslog( A __VA_ARGS__ ); closelog(); }
#define DEFAULT_HASH_TBL_SIZE 3079ul // Default hash table size
#define DEFAULT_PAGE_COUNT 2 // Default max page hit count/interval
#define DEFAULT_SITE_COUNT 50 // Default max site hit count/interval
#define DEFAULT_PAGE_INTERVAL 1 // Default 1 second page interval
#define DEFAULT_SITE_INTERVAL 1 // Default 1 second site interval
#define DEFAULT_BLOCKING_PERIOD 10 // Default block time (Seconds)
#define DEFAULT_LOG_DIR “/tmp“
/* END DoS Evasive Maneuvers Definitions */
/* BEGIN NTT (Named Timestamp Tree) Headers */
enum { ntt_num_primes = 28 };
/* ntt root tree */
struct ntt {
long size;
long items;
struct ntt_node **tbl;
};
/* ntt node (entry in the ntt root tree) */
struct ntt_node {
char *key;
time_t timestamp;
long count;
struct ntt_node *next;
};
/* ntt cursor */
struct ntt_c {
long iter_index;
struct ntt_node *iter_next;
};
struct ntt *ntt_create(long size);
struct ntt_node *ntt_find(struct ntt *ntt const char *key);
struct ntt_node *ntt_insert(struct ntt *ntt const char *key time_t timestamp);
struct ntt_node *c_ntt_first(struct ntt *ntt struct ntt_c *c);
struct ntt_node *c_ntt_next(struct ntt *ntt struct ntt_c *c);
int ntt_destroy(struct ntt *ntt);
int ntt_delete(struct ntt *ntt const char *key);
long ntt_hashcode(struct ntt *ntt const char *key);
/* END NTT (Named Timestamp Tree) Headers */
/* BEGIN DoS Evasive Maneuvers Globals */
struct ntt *hit_list; // Our dynamic hash table
struct ntt *white_list = NULL; // White list ta
评论
共有 条评论