- 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 18 years ago
parent d5ededc340
commit 6d6acb075a

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

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

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

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

@ -100,7 +100,19 @@ class BanManager:
return self.__banTotal return self.__banTotal
finally: finally:
self.__lock.release() 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. # Create a ban ticket.
# #

@ -77,6 +77,18 @@ class FailManager:
finally: finally:
self.__lock.release() 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): def addFailure(self, ticket):
self.__lock.acquire() self.__lock.acquire()
ip = ticket.getIP() ip = ticket.getIP()

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

Loading…
Cancel
Save