mirror of
https://github.com/fail2ban/fail2ban.git
synced 2026-03-11 08:55:31 +00:00
- 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
This commit is contained in:
parent
c5b034dcf0
commit
a25ba91980
1 changed files with 14 additions and 1 deletions
|
|
@ -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 a new issue