From 4bbf26a481b10d385337b4f06066167c1381ac35 Mon Sep 17 00:00:00 2001 From: curben <2809763-curben@users.noreply.gitlab.com> Date: Wed, 8 Jul 2020 11:22:57 +0100 Subject: [PATCH] fix: compatibility with AdGuard Home - AdGuard doesn't block subdomain in `example.com` syntax, whereas uBO interprets it as equivalent to `||example.com^`. - https://github.com/adguardteam/adguardhome/wiki/Hosts-Blocklists - https://github.com/gorhill/uBlock/wiki/Static-filter-syntax#hosts-files - Closes #19 --- script.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/script.sh b/script.sh index f17bb8ad..122c93f3 100644 --- a/script.sh +++ b/script.sh @@ -116,11 +116,20 @@ FIFTH_LINE="! License: https://creativecommons.org/publicdomain/zero/1.0/" SIXTH_LINE="! Source: https://urlhaus.abuse.ch/api/" COMMENT_ABP="$FIRST_LINE\n$SECOND_LINE\n$THIRD_LINE\n$FOURTH_LINE\n$FIFTH_LINE\n$SIXTH_LINE" -cat "malware-domains.txt" "malware-url-top-domains.txt" | \ +# Compatibility with Adguard Home (#19) +cat "malware-domains.txt" | \ +sed "s/^/||/g" | \ +sed "s/$/^/g" > "malware-domains-adguard.txt" + +cat "malware-domains-online.txt" | \ +sed "s/^/||/g" | \ +sed "s/$/^/g" > "malware-domains-online-adguard.txt" + +cat "malware-domains-adguard.txt" "malware-url-top-domains.txt" | \ sort | \ sed '1 i\'"$COMMENT_ABP"'' > "../urlhaus-filter.txt" -cat "malware-domains-online.txt" "malware-url-top-domains-online.txt" | \ +cat "malware-domains-online-adguard.txt" "malware-url-top-domains-online.txt" | \ sort | \ sed '1 i\'"$COMMENT_ABP"'' | \ sed "1s/Malicious/Online Malicious/" > "../urlhaus-filter-online.txt"