Skip to content

Commit

Permalink
Fix cookieblocking status detection for subdomains
Browse files Browse the repository at this point in the history
  • Loading branch information
ghostwords committed Dec 26, 2024
1 parent b5bb4da commit 44c1a3a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down

0 comments on commit 44c1a3a

Please sign in to comment.