mirror of https://github.com/fail2ban/fail2ban
- 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-b1dcaea8d6050.6
parent
7b13c386f9
commit
acbbb11578
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue