From 44c1a3ad3c24e10fb04a5acee2ca073a98af7cd9 Mon Sep 17 00:00:00 2001 From: Alexei Date: Thu, 26 Dec 2024 11:58:02 -0500 Subject: [PATCH] Fix cookieblocking status detection for subdomains --- validate.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/validate.py b/validate.py index 070d9a8..591422f 100755 --- a/validate.py +++ b/validate.py @@ -164,7 +164,14 @@ if y in new_js['snitch_map']: out = out + " on " + ", ".join(new_js['snitch_map'][y]) cookieblocked = "" - if new_js['action_map'][y]['heuristicAction'] == "cookieblock": + # cookieblocked if it or any parent domain up to base is cookieblocked + domain_parts = y.split('.') + exploded_subdomains = (s for s in ( + '.'.join(domain_parts[idx:]) + for idx, _ in enumerate(domain_parts)) + if len(s) >= len(base)) + if any(sub for sub in exploded_subdomains + if new_js['action_map'].get(sub, {}).get('heuristicAction', "") == "cookieblock"): cookieblocked = f"{C_YELLOW}❋{C_RESET}" print(out.format(cookieblocked, y))