mirror of
https://github.com/tanrax/maza-ad-blocking.git
synced 2024-11-22 07:05:41 +01:00
Fix Steven Black's main list has been reported to fail and default list of domains to ignore has been added.
This commit is contained in:
parent
b8b75ce46a
commit
7b94b477b3
@ -133,8 +133,6 @@ To the following:
|
|||||||
URL_DNS_LIST="https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts"
|
URL_DNS_LIST="https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts"
|
||||||
```
|
```
|
||||||
|
|
||||||
⚠️ Steven Black's main list has been reported to fail. Read the following [issue](https://github.com/tanrax/maza-ad-blocking/issues/20) to understand what is wrong and how to fix it. ⚠️
|
|
||||||
|
|
||||||
## DNSMASQ
|
## DNSMASQ
|
||||||
|
|
||||||
Unfortunately the hosts file does **not support sub-domains (wildcards)**, which is necessary to correctly filter all DNS. You will **need to install locally a server** for that purpose, Maza supports the **Dnsmasq** format.
|
Unfortunately the hosts file does **not support sub-domains (wildcards)**, which is necessary to correctly filter all DNS. You will **need to install locally a server** for that purpose, Maza supports the **Dnsmasq** format.
|
||||||
|
39
maza
39
maza
@ -15,6 +15,18 @@ COLOR_GREEN=$(tput setaf 2)
|
|||||||
COLOR_RESET=$(tput sgr0)
|
COLOR_RESET=$(tput sgr0)
|
||||||
LIST="list"
|
LIST="list"
|
||||||
LIST_DNSMASQ="dnsmasq.conf"
|
LIST_DNSMASQ="dnsmasq.conf"
|
||||||
|
IGNORE_LIST_DEFAULT="localhost \
|
||||||
|
localhost.localdomain \
|
||||||
|
local \
|
||||||
|
broadcasthost \
|
||||||
|
ip6-localhost \
|
||||||
|
ip6-loopback \
|
||||||
|
ip6-localnet \
|
||||||
|
ip6-mcastprefix \
|
||||||
|
ip6-allnodes \
|
||||||
|
ip6-allrouters \
|
||||||
|
ip6-allhosts \
|
||||||
|
0.0.0.0"
|
||||||
IGNORE_LIST_FILE="ignore"
|
IGNORE_LIST_FILE="ignore"
|
||||||
START_TAG="## MAZA - List ad blocking"
|
START_TAG="## MAZA - List ad blocking"
|
||||||
PROJECT="### https://github.com/tanrax/maza-ad-blocking"
|
PROJECT="### https://github.com/tanrax/maza-ad-blocking"
|
||||||
@ -78,14 +90,26 @@ update() {
|
|||||||
mkdir -p "$CONFIG"
|
mkdir -p "$CONFIG"
|
||||||
# Download DNS list
|
# Download DNS list
|
||||||
curl -L -s "$URL_DNS_LIST" -o "$CONFIG$LIST"
|
curl -L -s "$URL_DNS_LIST" -o "$CONFIG$LIST"
|
||||||
# Clear list
|
|
||||||
## Remove comments
|
## Remove comments
|
||||||
custom-sed -i.bak '/^#/ d' "$CONFIG$LIST"
|
custom-sed -i.bak '/^#/ d' "$CONFIG$LIST"
|
||||||
|
## Remove "0.0.0.0" or "127.0.0.1"
|
||||||
|
custom-sed -i.bak 's/0.0.0.0 //g' "$CONFIG$LIST"
|
||||||
|
custom-sed -i.bak 's/127.0.0.1 //g' "$CONFIG$LIST"
|
||||||
|
# Make ignore list
|
||||||
|
if [ ! -f "$CONFIG$IGNORE_LIST_FILE" ]; then
|
||||||
|
echo "$IGNORE_LIST_DEFAULT" | tr " " "\n" > "$CONFIG$IGNORE_LIST_FILE"
|
||||||
|
fi
|
||||||
|
# Remove ignore list
|
||||||
|
while read -r line; do
|
||||||
|
custom-sed -i.bak "/$line/d" "$CONFIG$LIST"
|
||||||
|
done < "$CONFIG$IGNORE_LIST_FILE"
|
||||||
|
## Remove empty lines
|
||||||
|
custom-sed -i.bak '/^$/d' "$CONFIG$LIST"
|
||||||
# Make dnsmasq format
|
# Make dnsmasq format
|
||||||
## 127.0.0.1 doubleclick.net to address=/doubleclick.net/127.0.0.1
|
|
||||||
cp "$CONFIG$LIST" "$CONFIG$LIST_DNSMASQ"
|
cp "$CONFIG$LIST" "$CONFIG$LIST_DNSMASQ"
|
||||||
custom-sed -i.bak 's/127.0.0.1 /address=\//g' "$CONFIG$LIST_DNSMASQ"
|
## doubleclick.net to address=/doubleclick.net/127.0.0.1
|
||||||
custom-sed -i.bak 's/$/\/127.0.0.1/g' "$CONFIG$LIST_DNSMASQ"
|
custom-sed -i.bak "s/^/address=\//g" "$CONFIG$LIST_DNSMASQ"
|
||||||
|
custom-sed -i.bak "s/$/\/127.0.0.1/g" "$CONFIG$LIST_DNSMASQ"
|
||||||
## Add start tag DNS list in first line
|
## Add start tag DNS list in first line
|
||||||
custom-sed -i.bak "1i\\$AUTHOR" "$CONFIG$LIST"
|
custom-sed -i.bak "1i\\$AUTHOR" "$CONFIG$LIST"
|
||||||
custom-sed -i.bak "1i\\$PROJECT" "$CONFIG$LIST"
|
custom-sed -i.bak "1i\\$PROJECT" "$CONFIG$LIST"
|
||||||
@ -98,13 +122,6 @@ update() {
|
|||||||
custom-sed -i.bak "1i\\$START_TAG" "$CONFIG$LIST_DNSMASQ"
|
custom-sed -i.bak "1i\\$START_TAG" "$CONFIG$LIST_DNSMASQ"
|
||||||
## Add end tag DNS DNSMASQ in first line
|
## Add end tag DNS DNSMASQ in first line
|
||||||
echo "$END_TAG" >> "$CONFIG$LIST_DNSMASQ"
|
echo "$END_TAG" >> "$CONFIG$LIST_DNSMASQ"
|
||||||
# Remove the domains to ignore. They are located in ".maza/ignore"
|
|
||||||
if [ -f "$CONFIG$IGNORE_LIST_FILE" ]; then
|
|
||||||
while IFS= read -r domain; do
|
|
||||||
custom-sed -i.bak "/$domain/d" "$CONFIG$LIST"
|
|
||||||
custom-sed -i.bak "/$domain/d" "$CONFIG$LIST_DNSMASQ"
|
|
||||||
done < "$CONFIG$IGNORE_LIST_FILE"
|
|
||||||
fi
|
|
||||||
# Remove temp file
|
# Remove temp file
|
||||||
rm "$CONFIG$LIST.bak"
|
rm "$CONFIG$LIST.bak"
|
||||||
rm "$CONFIG$LIST_DNSMASQ.bak"
|
rm "$CONFIG$LIST_DNSMASQ.bak"
|
||||||
|
Loading…
Reference in New Issue
Block a user