- Added IP list in "status <JAIL>". Thanks to Eric Gerbier

git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/trunk@535 a942ae1a-1317-0410-a47c-b1dcaea8d605
0.x
Cyril Jaquier 2007-01-29 21:46:59 +00:00
parent d5ededc340
commit 6d6acb075a
7 changed files with 36 additions and 8 deletions

View File

@ -18,6 +18,7 @@ ver. 0.7.7 (2007/??/??)
- Added file support to fail2ban-regex. Benchmark feature has
been removed
- Added cacti script and template.
- Added IP list in "status <JAIL>". Thanks to Eric Gerbier
ver. 0.7.6 (2007/01/04) - beta
----------

2
README
View File

@ -73,7 +73,7 @@ Tom Pike, Iain Lea, Andrey G. Grozin, Yaroslav Halchenko,
Jonathan Kamens, Stephen Gildea, Markus Hoffmann, Mark
Edgington, Patrick Börjesson, kojiro, zugeschmiert, Tyler,
Nick Munger, Christoph Haas, Justin Shore, Joël Bertrand,
René Berber, mEDI, Axel Thimm
René Berber, mEDI, Axel Thimm, Eric Gerbier
License:
--------

View File

@ -70,11 +70,13 @@ class Beautifier:
if len(inC) > 1:
msg = "Status for the jail: " + inC[1] + "\n"
msg = msg + "|- " + response[0][0] + "\n"
msg = msg + "| |- " + response[0][1][0][0] + ":\t\t" + `response[0][1][0][1]` + "\n"
msg = msg + "| `- " + response[0][1][1][0] + ":\t\t" + `response[0][1][1][1]` + "\n"
msg = msg + "| |- " + response[0][1][0][0] + ":\t" + `response[0][1][0][1]` + "\n"
msg = msg + "| | `- " + response[0][1][2][0] + ":\t" + `response[0][1][2][1]` + "\n"
msg = msg + "| `- " + response[0][1][1][0] + ":\t" + `response[0][1][1][1]` + "\n"
msg = msg + "`- " + response[1][0] + "\n"
msg = msg + " |- " + response[1][1][0][0] + ":\t\t" + `response[1][1][0][1]` + "\n"
msg = msg + " `- " + response[1][1][1][0] + ":\t\t" + `response[1][1][1][1]`
msg = msg + " |- " + response[1][1][0][0] + ":\t" + `response[1][1][0][1]` + "\n"
msg = msg + " | `- " + response[1][1][2][0] + ":\t" + `response[1][1][2][1]` + "\n"
msg = msg + " `- " + response[1][1][1][0] + ":\t" + `response[1][1][1][1]`
else:
msg = "Status\n"
msg = msg + "|- " + response[0][0] + ":\t" + `response[0][1]` + "\n"

View File

@ -189,6 +189,6 @@ class Actions(JailThread):
def status(self):
ret = [("Currently banned", self.__banManager.size()),
("Total banned", self.__banManager.getBanTotal())]
("Total banned", self.__banManager.getBanTotal()),
("IP list", self.__banManager.getBanList())]
return ret

View File

@ -100,7 +100,19 @@ class BanManager:
return self.__banTotal
finally:
self.__lock.release()
##
# Returns a copy of the IP list.
#
# @return IP list
def getBanList(self):
try:
self.__lock.acquire()
return list(self.__banList)
finally:
self.__lock.release()
##
# Create a ban ticket.
#

View File

@ -77,6 +77,18 @@ class FailManager:
finally:
self.__lock.release()
##
# Returns a copy of the IP list.
#
# @return IP list
def getBanList(self):
try:
self.__lock.acquire()
return list(self.__failList)
finally:
self.__lock.release()
def addFailure(self, ticket):
self.__lock.acquire()
ip = ticket.getIP()

View File

@ -463,7 +463,8 @@ class Filter(JailThread):
def status(self):
ret = [("Currently failed", self.failManager.size()),
("Total failed", self.failManager.getFailTotal())]
("Total failed", self.failManager.getFailTotal()),
("IP List", self.failManager.getBanList())]
return ret