From acbbb11578c2fb124095cb0f725583aade5bab7d Mon Sep 17 00:00:00 2001 From: Cyril Jaquier Date: Tue, 22 Feb 2005 21:11:17 +0000 Subject: [PATCH] - A rule is added with a specified number now git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/trunk@66 a942ae1a-1317-0410-a47c-b1dcaea8d605 --- firewall/ipfw.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/firewall/ipfw.py b/firewall/ipfw.py index c8cd3cba..4e3e8f57 100644 --- a/firewall/ipfw.py +++ b/firewall/ipfw.py @@ -37,10 +37,23 @@ class Ipfw(Firewall): http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/266468 """ + crtRuleNbr = 0 + + def getCrtRuleNbr(): + """ Gets the current rule number. + """ + return self.crtRuleNbr + + def setCrtRuleNbr(self, value): + """ Sets the current rule number. + """ + self.crtRuleNbr = value + def banIP(self, ip): """ Returns query to ban IP. """ - query = "ipfw -q add deny ip from "+ip+" to any" + self.crtRuleNbr = self.crtRuleNbr + 1 + query = "ipfw -q add "+`self.crtRuleNbr`+" deny ip from "+ip+" to any" return query def unBanIP(self, ip):