mirror of https://github.com/fail2ban/fail2ban
- Fixed a bug with static class members
git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/trunk@283 a942ae1a-1317-0410-a47c-b1dcaea8d6050.x
parent
9fe1efcc45
commit
ca5b70cd24
|
@ -34,6 +34,8 @@ logSys = logging.getLogger("fail2ban.client.config")
|
||||||
|
|
||||||
class JailReader(ConfigReader):
|
class JailReader(ConfigReader):
|
||||||
|
|
||||||
|
actionCRE = re.compile("^((?:\w|-|_|\.)+)(?:\[(.*)\])?$")
|
||||||
|
|
||||||
def __init__(self, name):
|
def __init__(self, name):
|
||||||
ConfigReader.__init__(self)
|
ConfigReader.__init__(self)
|
||||||
self.name = name
|
self.name = name
|
||||||
|
@ -92,7 +94,7 @@ class JailReader(ConfigReader):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def splitAction(action):
|
def splitAction(action):
|
||||||
m = re.match("^((?:\w|-|_|\.)+)(?:\[(.*)\])?$", action)
|
m = JailReader.actionCRE.match(action)
|
||||||
d = dict()
|
d = dict()
|
||||||
if m.group(2) <> None:
|
if m.group(2) <> None:
|
||||||
for param in m.group(2).split(','):
|
for param in m.group(2).split(','):
|
||||||
|
|
|
@ -468,8 +468,8 @@ import socket, struct
|
||||||
|
|
||||||
class DNSUtils:
|
class DNSUtils:
|
||||||
|
|
||||||
dnsRe = re.compile("(?:(?:\w|-)+\.){2,}\w+")
|
dnsCRE = re.compile("(?:(?:\w|-)+\.){2,}\w+")
|
||||||
ipRe = re.compile("(?:\d{1,3}\.){3}\d{1,3}")
|
ipCRE = re.compile("(?:\d{1,3}\.){3}\d{1,3}")
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def dnsToIp(dns):
|
def dnsToIp(dns):
|
||||||
|
@ -486,7 +486,7 @@ class DNSUtils:
|
||||||
""" Search for possible DNS in an arbitrary text.
|
""" Search for possible DNS in an arbitrary text.
|
||||||
Thanks to Tom Pike.
|
Thanks to Tom Pike.
|
||||||
"""
|
"""
|
||||||
match = dnsRe.find(text)
|
match = DNSUtils.dnsCRE.match(text)
|
||||||
if match:
|
if match:
|
||||||
return match
|
return match
|
||||||
else:
|
else:
|
||||||
|
@ -497,7 +497,8 @@ class DNSUtils:
|
||||||
""" Search if an IP address if directly available and return
|
""" Search if an IP address if directly available and return
|
||||||
it.
|
it.
|
||||||
"""
|
"""
|
||||||
match = ipRe.find(text)
|
print DNSUtils.ipCRE
|
||||||
|
match = DNSUtils.ipCRE.match(text)
|
||||||
if match:
|
if match:
|
||||||
return match
|
return match
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue