- 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
0.6
Cyril Jaquier 2005-02-22 21:11:17 +00:00
parent 7b13c386f9
commit acbbb11578
1 changed files with 14 additions and 1 deletions

View File

@ -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):