Fix blacklist download jobs where ignore urls were not being downloaded
This commit is contained in:
parent
86053d3dc5
commit
ae042854f0
|
@ -29,7 +29,7 @@ uri_rx = re_compile(rb"^/")
|
|||
|
||||
|
||||
def check_line(kind: str, line: bytes) -> Tuple[bool, bytes]:
|
||||
if kind == "IP":
|
||||
if kind in ("IP", "IGNORE_IP"):
|
||||
if b"/" in line:
|
||||
with suppress(ValueError):
|
||||
ip_network(line.decode("utf-8"))
|
||||
|
@ -38,18 +38,18 @@ def check_line(kind: str, line: bytes) -> Tuple[bool, bytes]:
|
|||
with suppress(ValueError):
|
||||
ip_address(line.decode("utf-8"))
|
||||
return True, line
|
||||
elif kind == "RDNS":
|
||||
elif kind in ("RDNS", "IGNORE_RDNS"):
|
||||
if rdns_rx.match(line):
|
||||
return True, line.lower()
|
||||
elif kind == "ASN":
|
||||
elif kind in ("ASN", "IGNORE_ASN"):
|
||||
real_line = line.replace(b"AS", b"").replace(b"as", b"")
|
||||
if asn_rx.match(real_line):
|
||||
return True, real_line
|
||||
elif kind == "USER_AGENT":
|
||||
elif kind in ("USER_AGENT", "IGNORE_USER_AGENT"):
|
||||
return True, line.replace(b"\\ ", b" ").replace(b"\\.", b"%.").replace(
|
||||
b"\\\\", b"\\"
|
||||
).replace(b"-", b"%-")
|
||||
elif kind == "URI":
|
||||
elif kind in ("URI", "IGNORE_URI"):
|
||||
if uri_rx.match(line):
|
||||
return True, line
|
||||
|
||||
|
|
Loading…
Reference in New Issue