From 5595ffcac7867c87251d064fc3bae5fa422cfacb Mon Sep 17 00:00:00 2001 From: Cyril Jaquier Date: Thu, 7 Jul 2005 16:56:30 +0000 Subject: [PATCH] - Lot of changes. Most of them are cleanup git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/branches/FAIL2BAN-0_5@122 a942ae1a-1317-0410-a47c-b1dcaea8d605 --- fail2ban.py | 266 ++++++++++++++++------------------------------------ 1 file changed, 81 insertions(+), 185 deletions(-) diff --git a/fail2ban.py b/fail2ban.py index 301975b5..12ae2d77 100755 --- a/fail2ban.py +++ b/fail2ban.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - # This file is part of Fail2Ban. # # Fail2Ban is free software; you can redistribute it and/or modify @@ -26,19 +24,9 @@ __date__ = "$Date$" __copyright__ = "Copyright (c) 2004 Cyril Jaquier" __license__ = "GPL" -import time, sys, getopt, os, string, signal +import time, sys, getopt, os, string, signal, log4py from ConfigParser import * -# Checks if log4py is present. -try: - import log4py -except: - print "log4py is needed (see README)" - sys.exit(-1) - -# Appends our own modules path -sys.path.append('/usr/lib/fail2ban') - from firewall.firewall import Firewall from logreader.logreader import LogReader from confreader.configreader import ConfigReader @@ -48,15 +36,18 @@ from version import version # Gets the instance of log4py. logSys = log4py.Logger().get_instance() +# Global variables +logFwList = list() +conf = dict() + def usage(): - print "Usage: fail2ban.py [OPTIONS]" + print "Usage: fail2ban [OPTIONS]" print print "Fail2Ban v"+version+" reads log file that contains password failure report" print "and bans the corresponding IP address using iptables." print print " -b start fail2ban in background" print " -d start fail2ban in debug mode" - print " -e ban IP on the INTF interface" print " -c read configuration file FILE" print " -p create PID lock in FILE" print " -h display this help message" @@ -66,8 +57,6 @@ def usage(): print " -r allow a max of VALUE password failure" print " -t