blob: bfee65b963a057fc68a77ea3ee2ded6174ab284f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# Fail2Ban IPv6 Patch for Fail2Ban v0.9.3, v0.9.4, v0.9.5
--- filter.py.orig
+++ filter.py
@@ -849,6 +849,7 @@
class DNSUtils:
IP_CRE = re.compile("^(?:\d{1,3}\.){3}\d{1,3}$")
+ IP_CRE6 = re.compile("^(?:[0-9:A-Fa-f]{3,})$")
@staticmethod
def dnsToIp(dns):
@@ -883,19 +884,21 @@
if match:
return match
else:
- return None
+ match = DNSUtils.IP_CRE6.match(text)
+ if match:
+ """ Right Here, we faced to a ipv6
+ """
+ return match
+ else:
+ return None
@staticmethod
def isValidIP(string):
""" Return true if str is a valid IP
+ We Consider that logfiles didn't make errors ;)
"""
- s = string.split('/', 1)
- try:
- socket.inet_aton(s[0])
- return True
- except socket.error:
- return False
+ return True
@staticmethod
|