From 18029d4426dfc2d7818cbd6b48d2bde5efebc533 Mon Sep 17 00:00:00 2001 From: Cyril Jaquier Date: Thu, 14 Oct 2004 10:30:25 +0000 Subject: [PATCH] - Add log4py import exception handling - Remove metalog class. Now use LogReader - Add -r option: you can specifie the maximum number of login failure before ban - Code comments git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/trunk@27 a942ae1a-1317-0410-a47c-b1dcaea8d605 --- fail2ban.py | 54 +++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 44 insertions(+), 10 deletions(-) diff --git a/fail2ban.py b/fail2ban.py index 5b813a3a..5e498085 100755 --- a/fail2ban.py +++ b/fail2ban.py @@ -27,13 +27,19 @@ __copyright__ = "Copyright (c) 2004 Cyril Jaquier" __license__ = "GPL" import posix, time, sys, getopt, os, signal -import log4py + +# 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.iptables import Iptables -from logreader.metalog import Metalog +from logreader.logreader import LogReader from version import version def usage(): @@ -47,6 +53,7 @@ def usage(): print " -f read password failure from FILE" print " -h display this help message" print " -l log message in FILE" + print " -r allow a max of VALUE password failure" print " -t