[FRITZ!Box:] Blacklist gebruik

maar gewoon tikwerk kan (bijna) iedereen wel,
een eBlocker / Pi-hole / AdGuardHome in elkaar zetten is wel wat anders.

't Eerste kan ik zeker wel (kost gewoon wat tijd),
als ik morgen aan het tweede moet beginnen, dan zou ik nu niet weten waar te beginnen.
( persoonlijke bekentenis )

Zo dacht ik er ook ooit over, en Linux is voor mij nog steeds een noodzakelijk kwaad waar ik nooit vriendjes mee zal worden :grin:

Misschien is het een idee er een community project van te maken?
Ik heb wel wat ideetjes, open maar een nieuw topic als dat wat lijkt…

Ik heb 2 aanvullingen voor de blacklist i.v.m. nieuwe FB activiteiten.

meta.com
mvs.org

Ik heb een url naam blocklist en een ip adres blocklist in gebruik. Deze wordt elke nacht middels een cron taak automatisch aangevuld. Zie beneden het betreffende stuk van het shell script dat ik daarvoor heb geschreven. Links van betreffende blocklist sources vind je in het script commentaar.

Op dit moment blokkeer ik 1995952 url domeinen en 142157 ip adres ranges.

# Print a separator line.
echo "================================================================================"
echo

# If the blocked names list does not exist, create an empty blocked names list.
if ! test -s /usr/local/etc/blocked_names.txt
then
        touch /usr/local/etc/blocked_names.txt
fi

# See https://github.com/DNSCrypt/dnscrypt-proxy/blob/master/utils/generate-domains-blocklist/domains-blocklist.conf for a nice collection of blocklists to consider.

# Download (wildcard) blocklist, see https://oisd.nl, and remove any blank lines or comments.
curl -m 300 https://dblw.oisd.nl \
| awk 'length( $0 ) > 0 && !/#/ { print( $0 ) }' \
>> /usr/local/etc/blocked_names.txt

# Download blocklist, see https://github.com/DNSCrypt/dnscrypt-proxy/wiki/Public-blacklists, and remove any blank lines or comments.
curl -m 300 https://download.dnscrypt.info/blocklists/domains/mybase.txt \
| awk 'length( $0 ) > 0 && !/#/ { print( $0 ) }' \
>> /usr/local/etc/blocked_names.txt

# Download blocklist, see https://github.com/notracking/hosts-blocklists, and remove any blank lines or comments.
curl -m 300 https://raw.githubusercontent.com/notracking/hosts-blocklists/master/dnscrypt-proxy/dnscrypt-proxy.blacklist.txt \
| awk 'length( $0 ) > 0 && !/#/ { print( $0 ) }' \
>> /usr/local/etc/blocked_names.txt

# Download blocklist, see https://github.com/StevenBlack/hosts, and convert from /etc/hosts format to dnscrypt-proxy format.
curl -m 300 https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-gambling-porn/hosts \
| awk '$1 == "0.0.0.0" { print( $2 ) }' \
>> /usr/local/etc/blocked_names.txt

# Download blocklist, see https://www.github.developerdan.com, and convert from /etc/hosts format to dnscrypt-proxy format.
curl -m 300 https://www.github.developerdan.com/hosts/lists/ads-and-tracking-extended.txt \
| awk '$1 == "0.0.0.0" { print( $2 ) }' \
>> /usr/local/etc/blocked_names.txt

# Download blocklist, see https://hblock.molinero.dev and https://github.com/hectorm/hblock, and remove any blank lines or comments.
curl -m 300 https://hblock.molinero.dev/hosts_domains.txt \
| awk 'length( $0 ) > 0 && !/#/ { print( $0 ) }' \
>> /usr/local/etc/blocked_names.txt

# Sort the blocklist and remove any double entries.
sort -u -o /usr/local/etc/blocked_names.txt /usr/local/etc/blocked_names.txt

# Set the blocked names list accessibility.
chmod 644 /usr/local/etc/blocked_names.txt

# Display the number of blocked domains.
echo
echo "Number of blocked domains:\c"
wc -l /usr/local/etc/blocked_names.txt

# Print a separator line.
echo
echo "================================================================================"
echo

# If the blocked IP address list does not exist, create an empty blocked IP address list.
if ! test -s /usr/local/etc/blocked_ips.txt
then
        touch /usr/local/etc/blocked_ips.txt
fi

# Download blocklist, see https://www.spamhaus.org/drop, and remove any blank lines or comments.
curl -m 300 \
https://www.spamhaus.org/drop/drop.txt \
https://www.spamhaus.org/drop/edrop.txt \
| awk -F';' 'length($1) > 0 { print( $1 ) }' \
>> /usr/local/etc/blocked_ips.txt

# Download blocklists, see https://github.com/stamparm/ipsum.
curl -m 300 \
https://raw.githubusercontent.com/stamparm/ipsum/master/levels/8.txt \
https://raw.githubusercontent.com/stamparm/ipsum/master/levels/7.txt \
https://raw.githubusercontent.com/stamparm/ipsum/master/levels/6.txt \
https://raw.githubusercontent.com/stamparm/ipsum/master/levels/5.txt \
https://raw.githubusercontent.com/stamparm/ipsum/master/levels/4.txt \
https://raw.githubusercontent.com/stamparm/ipsum/master/levels/3.txt \
https://raw.githubusercontent.com/stamparm/ipsum/master/levels/2.txt \
| awk '{ print( $0 ) }' \
>> /usr/local/etc/blocked_ips.txt

# Remove any incomplete IP addresses.
cat /usr/local/etc/blocked_ips.txt \
| awk -F'.' '{ if( NF == 4 ) print( $0 ) }' \
> /usr/local/etc/blocked_ips_cleaned.txt
rm /usr/local/etc/blocked_ips.txt
mv /usr/local/etc/blocked_ips_cleaned.txt /usr/local/etc/blocked_ips.txt

# Replace IP address ranges with the equivalent search pattern(s).
cat /usr/local/etc/blocked_ips.txt \
| awk -F'[./]' '/\/32/ { for( n = 0 ; n < 2^(32-$5) ; n++ ) print( $1 "." $2 "." $3 "." $4+n ) } !/\/32/ { print( $0 ) }' \
| awk -F'[./]' '/\/31/ { for( n = 0 ; n < 2^(32-$5) ; n++ ) print( $1 "." $2 "." $3 "." $4+n ) } !/\/31/ { print( $0 ) }' \
| awk -F'[./]' '/\/30/ { for( n = 0 ; n < 2^(32-$5) ; n++ ) print( $1 "." $2 "." $3 "." $4+n ) } !/\/30/ { print( $0 ) }' \
| awk -F'[./]' '/\/29/ { for( n = 0 ; n < 2^(32-$5) ; n++ ) print( $1 "." $2 "." $3 "." $4+n ) } !/\/29/ { print( $0 ) }' \
| awk -F'[./]' '/\/28/ { for( n = 0 ; n < 2^(32-$5) ; n++ ) print( $1 "." $2 "." $3 "." $4+n ) } !/\/28/ { print( $0 ) }' \
| awk -F'[./]' '/\/27/ { for( n = 0 ; n < 2^(32-$5) ; n++ ) print( $1 "." $2 "." $3 "." $4+n ) } !/\/27/ { print( $0 ) }' \
| awk -F'[./]' '/\/26/ { for( n = 0 ; n < 2^(32-$5) ; n++ ) print( $1 "." $2 "." $3 "." $4+n ) } !/\/26/ { print( $0 ) }' \
| awk -F'[./]' '/\/25/ { for( n = 0 ; n < 2^(32-$5) ; n++ ) print( $1 "." $2 "." $3 "." $4+n ) } !/\/25/ { print( $0 ) }' \
| awk -F'[./]' '/\/24/ { for( n = 0 ; n < 2^(24-$5) ; n++ ) print( $1 "." $2 "." $3+n ".*" ) } !/\/24/ { print( $0 ) }' \
| awk -F'[./]' '/\/23/ { for( n = 0 ; n < 2^(24-$5) ; n++ ) print( $1 "." $2 "." $3+n ".*" ) } !/\/23/ { print( $0 ) }' \
| awk -F'[./]' '/\/22/ { for( n = 0 ; n < 2^(24-$5) ; n++ ) print( $1 "." $2 "." $3+n ".*" ) } !/\/22/ { print( $0 ) }' \
| awk -F'[./]' '/\/21/ { for( n = 0 ; n < 2^(24-$5) ; n++ ) print( $1 "." $2 "." $3+n ".*" ) } !/\/21/ { print( $0 ) }' \
| awk -F'[./]' '/\/20/ { for( n = 0 ; n < 2^(24-$5) ; n++ ) print( $1 "." $2 "." $3+n ".*" ) } !/\/20/ { print( $0 ) }' \
| awk -F'[./]' '/\/19/ { for( n = 0 ; n < 2^(24-$5) ; n++ ) print( $1 "." $2 "." $3+n ".*" ) } !/\/19/ { print( $0 ) }' \
| awk -F'[./]' '/\/18/ { for( n = 0 ; n < 2^(24-$5) ; n++ ) print( $1 "." $2 "." $3+n ".*" ) } !/\/18/ { print( $0 ) }' \
| awk -F'[./]' '/\/17/ { for( n = 0 ; n < 2^(24-$5) ; n++ ) print( $1 "." $2 "." $3+n ".*" ) } !/\/17/ { print( $0 ) }' \
| awk -F'[./]' '/\/16/ { for( n = 0 ; n < 2^(16-$5) ; n++ ) print( $1 "." $2+n ".*" ) } !/\/16/ { print( $0 ) }' \
| awk -F'[./]' '/\/15/ { for( n = 0 ; n < 2^(16-$5) ; n++ ) print( $1 "." $2+n ".*" ) } !/\/15/ { print( $0 ) }' \
| awk -F'[./]' '/\/14/ { for( n = 0 ; n < 2^(16-$5) ; n++ ) print( $1 "." $2+n ".*" ) } !/\/14/ { print( $0 ) }' \
| awk -F'[./]' '/\/13/ { for( n = 0 ; n < 2^(16-$5) ; n++ ) print( $1 "." $2+n ".*" ) } !/\/13/ { print( $0 ) }' \
| awk -F'[./]' '/\/12/ { for( n = 0 ; n < 2^(16-$5) ; n++ ) print( $1 "." $2+n ".*" ) } !/\/12/ { print( $0 ) }' \
| awk -F'[./]' '/\/11/ { for( n = 0 ; n < 2^(16-$5) ; n++ ) print( $1 "." $2+n ".*" ) } !/\/11/ { print( $0 ) }' \
| awk -F'[./]' '/\/10/ { for( n = 0 ; n < 2^(16-$5) ; n++ ) print( $1 "." $2+n ".*" ) } !/\/10/ { print( $0 ) }' \
| awk -F'[./]' '/\/9/ { for( n = 0 ; n < 2^(16-$5) ; n++ ) print( $1 "." $2+n ".*" ) } !/\/9/ { print( $0 ) }' \
| awk -F'[./]' '/\/8/ { for( n = 0 ; n < 2^(8-$5) ; n++ ) print( $1+n ".*" ) } !/\/8/ { print( $0 ) }' \
| awk -F'[./]' '/\/7/ { for( n = 0 ; n < 2^(8-$5) ; n++ ) print( $1+n ".*" ) } !/\/7/ { print( $0 ) }' \
| awk -F'[./]' '/\/6/ { for( n = 0 ; n < 2^(8-$5) ; n++ ) print( $1+n ".*" ) } !/\/6/ { print( $0 ) }' \
| awk -F'[./]' '/\/5/ { for( n = 0 ; n < 2^(8-$5) ; n++ ) print( $1+n ".*" ) } !/\/5/ { print( $0 ) }' \
| awk -F'[./]' '/\/4/ { for( n = 0 ; n < 2^(8-$5) ; n++ ) print( $1+n ".*" ) } !/\/4/ { print( $0 ) }' \
| awk -F'[./]' '/\/3/ { for( n = 0 ; n < 2^(8-$5) ; n++ ) print( $1+n ".*" ) } !/\/3/ { print( $0 ) }' \
| awk -F'[./]' '/\/2/ { for( n = 0 ; n < 2^(8-$5) ; n++ ) print( $1+n ".*" ) } !/\/2/ { print( $0 ) }' \
| awk -F'[./]' '/\/1/ { for( n = 0 ; n < 2^(8-$5) ; n++ ) print( $1+n ".*" ) } !/\/1/ { print( $0 ) }' \
> /usr/local/etc/blocked_ips_expanded.txt
rm /usr/local/etc/blocked_ips.txt
mv /usr/local/etc/blocked_ips_expanded.txt /usr/local/etc/blocked_ips.txt

# Sort the blocked IP address list and remove any double entries.
sort -u -o /usr/local/etc/blocked_ips.txt /usr/local/etc/blocked_ips.txt

# Set the blocked IP address list accessibility.
chmod 644 /usr/local/etc/blocked_ips.txt

# Display the number of blocked IP address ranges.
echo
echo "Number of blocked IP address ranges:\c"
wc -l /usr/local/etc/blocked_ips.txt

# Print a separator line.
echo
echo "================================================================================"

Dit topic is 24 uur na het laatste antwoord automatisch gesloten. Nieuwe antwoorden zijn niet meer toegestaan.