Fine-tuning block-advert.sh

Here is where you can post tips and tricks to share with other users of MX. Do not ask for help in this Forum.
Message
Author
User avatar
MikeR
Posts: 267
Joined: Sun Jun 25, 2023 6:42 am

Fine-tuning block-advert.sh

#1 Post by MikeR »

On my internet-connected Linux (plural Linii?) I installed block-advert which is a great help in cutting down adverts and other unwanted slop. (advert-block-antix in synaptic)
However the blocking was slightly too strict as I lost access to a couple of addresses that I wanted to reach.
My solution was as follows:
1. open /usr/local/bin/block-advert.sh in your editor of choice.
2. after the second occurrence of the line "====================YTO"
added the lines:
echo "Modify $WORKINGDIR/blocklist-all: Remove whatsapp & reddit (Mike)"
grep -v whatsapp $WORKINGDIR/blocklist-all | grep -v reddit > $WORKINGDIR/blocklist-all2
mv $WORKINGDIR/blocklist-all2 $WORKINGDIR/blocklist-all
(On my copy of /usr/local/bin/block-advert.sh this came at line 83)
N.B. Obviously change my choices reddit and whatsapp to your own preference, add whatever, and you can skip Mike or replace with a string that you can easily search

HTH,
Mike
Old RSTS hack
Registered Linux user #542196

User avatar
m_pav
Developer
Posts: 1901
Joined: Sun Aug 06, 2006 3:02 pm

Re: Fine-tuning block-advert.sh

#2 Post by m_pav »

Interesting, I've been using advert-block-antix for quite a few years now and neither whatsapp nor reddit are blocked. They do show up in my /etc/hosts file, but only elements of such, not the primary site url. IIRC, I did have troubles with reddit when I had selected all options, and when I re-ran it without the porn blockers, I could use both.

That being said, URL blocking is losing ground to DNS hacks that bypass the former.

The hosts file has 24800 lines and each line contains roughly 9 site urls, so excluding the first 14 lines, that would give ~251-252K blocked sites.

Obviously, the volume of blocked sites will be determined by what options you choose when running the script, but it would be interesting to see how yours differs in line numbers.
Mike P

Regd Linux User #472293
(Daily) Lenovo T560, i7-6600U, 16GB, 2.0TB SSD, MX_ahs
(ManCave) AMD Ryzen 5 5600G, 32G, 8TB mixed, MX_ahs
(Spare)2017 Macbook Air 7,2, 8GB, 256GB SSD, MX_ahs

User avatar
MikeR
Posts: 267
Joined: Sun Jun 25, 2023 6:42 am

Re: Fine-tuning block-advert.sh

#3 Post by MikeR »

@m_pav
$ dir /etc/hosts
-rw-r--r-- 1 root root 4.8M Aug 11 06:49 /etc/hosts
$ wc -l /etc/hosts
26067 /etc/hosts
Did not include porn and gambling lists
Without the added lines I could not access (some, possibly not all) reddit addresses, or run whatsapp screen app.

Mike
Old RSTS hack
Registered Linux user #542196

Post Reply

Return to “Tips & Tricks by users (not for help)”