From dba169ae9c491434146efe12d3f82533944542b0 Mon Sep 17 00:00:00 2001 From: Cyril Jaquier Date: Tue, 12 Jul 2005 13:08:24 +0000 Subject: [PATCH] - 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-b1dcaea8d605 --- firewall/firewall.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/firewall/firewall.py b/firewall/firewall.py index e022f78c..66034e18 100644 --- a/firewall/firewall.py +++ b/firewall/firewall.py @@ -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. """