mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-02 22:48:40 +00:00
Allow for colons in PeerGuardian/SafePeer lists' descriptions.
Check that the start & end range resembles an ip when checking a list's validity.
This commit is contained in:
parent
41353c9ae4
commit
4e2c0a70c4
1 changed files with 5 additions and 1 deletions
|
@ -34,6 +34,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
from common import raiseError, remove_zeros
|
from common import raiseError, remove_zeros
|
||||||
|
import re
|
||||||
|
|
||||||
class ReaderParseError(Exception):
|
class ReaderParseError(Exception):
|
||||||
pass
|
pass
|
||||||
|
@ -69,6 +70,9 @@ class BaseReader(object):
|
||||||
if not self.is_ignored(line):
|
if not self.is_ignored(line):
|
||||||
try:
|
try:
|
||||||
(start, end) = self.parse(line)
|
(start, end) = self.parse(line)
|
||||||
|
if not re.match("^(\d{1,3}\.){4}$", start + ".") or \
|
||||||
|
not re.match("^(\d{1,3}\.){4}$", end + "."):
|
||||||
|
valid = False
|
||||||
except:
|
except:
|
||||||
valid = False
|
valid = False
|
||||||
finally:
|
finally:
|
||||||
|
@ -94,7 +98,7 @@ class SafePeerReader(BaseReader):
|
||||||
"""Blocklist reader for SafePeer style blocklists"""
|
"""Blocklist reader for SafePeer style blocklists"""
|
||||||
@raiseError(ReaderParseError)
|
@raiseError(ReaderParseError)
|
||||||
def parse(self, line):
|
def parse(self, line):
|
||||||
return line.strip().split(":")[1].split("-")
|
return line.strip().split(":")[-1].split("-")
|
||||||
|
|
||||||
class PeerGuardianReader(SafePeerReader):
|
class PeerGuardianReader(SafePeerReader):
|
||||||
"""Blocklist reader for PeerGuardian style blocklists"""
|
"""Blocklist reader for PeerGuardian style blocklists"""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue