[UPDATE] Fix parsing remote files containing wildcards

This commit is contained in:
Muntashir Al-Islam 2021-07-20 16:46:40 +06:00
parent 48c9c4c800
commit e610038e65
1 changed files with 3 additions and 1 deletions

4
config/generate-domains-blocklist.py Normal file → Executable file
View File

@ -61,13 +61,15 @@ def parse_list(content, trusted=False):
rx_mdl = re.compile(r'^"[^"]+","([a-z0-9][a-z0-9.-]*[.][a-z]{2,})",')
rx_b = re.compile(r"^([a-z0-9][a-z0-9.-]*[.][a-z]{2,}),.+,[0-9: /-]+,")
rx_dq = re.compile(r"^address=/([a-z0-9][a-z0-9.-]*[.][a-z]{2,})/.")
rx_trusted = re.compile(r"^([*a-z0-9.-]+)\s*(@\S+)?$")
if trusted:
return parse_trusted_list(content)
names = set()
time_restrictions = {}
rx_set = [rx_u, rx_l, rx_h, rx_mdl, rx_b, rx_dq]
rx_set = [rx_u, rx_l, rx_h, rx_mdl, rx_b, rx_dq, rx_trusted]
for line in content.splitlines():
line = str.lower(str.strip(line))
if rx_comment.match(line):