mirror of https://github.com/fail2ban/fail2ban
- Moved replaceTag() to utils/strings.py
git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/branches/FAIL2BAN-0_5@131 a942ae1a-1317-0410-a47c-b1dcaea8d6050.5
parent
8a94f873de
commit
dba169ae9c
|
@ -27,6 +27,7 @@ __license__ = "GPL"
|
|||
import time, os, log4py, re
|
||||
|
||||
from utils.process import executeCmd
|
||||
from utils.strings import replaceTag
|
||||
|
||||
# Gets the instance of log4py.
|
||||
logSys = log4py.Logger().get_instance()
|
||||
|
@ -98,23 +99,15 @@ class Firewall:
|
|||
def banIP(self, aInfo):
|
||||
""" Returns query to ban IP.
|
||||
"""
|
||||
query = self.replaceTag(self.banRule, aInfo)
|
||||
query = replaceTag(self.banRule, aInfo)
|
||||
return query
|
||||
|
||||
def unBanIP(self, aInfo):
|
||||
""" Returns query to unban IP.
|
||||
"""
|
||||
query = self.replaceTag(self.unBanRule, aInfo)
|
||||
query = replaceTag(self.unBanRule, aInfo)
|
||||
return query
|
||||
|
||||
def replaceTag(self, query, aInfo):
|
||||
""" Replace tags in query
|
||||
"""
|
||||
string = query
|
||||
for tag in aInfo:
|
||||
string = string.replace('<'+tag+'>', `aInfo[tag]`)
|
||||
return string
|
||||
|
||||
def viewBanList(self):
|
||||
""" Prints the ban list on screen. Usefull for debugging.
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue