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