uBO medium mode in Adguard browser extension

Jan Willy

Level 13
Thread author
Verified
Top Poster
Well-known
Jul 5, 2019
607
IMHO is a great advantage of uBO the use of dynamic rules besides static rules. It makes it possible to use uBO in so called Medium Mode (MM) or Hard Mode (HM).
View Blocking mode · gorhill/uBlock Wiki

When Google Manifest 3 (MV3) enters into force next year, most probably the dynamic rules will no longer work in Chromium based browsers. The absence of those rules in uBO Lite, that is intended to cooperate with MV3, points in that direction.

Can we simulate MM and HM in uBO Lite? In any case not at this moment. uBO Lite doesn’t offer the possibility to add custom rules.
But Adguard experimental browser extension MV3 does. The rules are very simple:

HM = ||*^$third-party
MM = ||*^$script,subdocument,third-party

Especially HM will break many sites. And even in MM one has to whitelist many third party sites. It’s not difficult but not as easy as in uBO. And it can start to irritate after a while.

Example of a site-specific whitelist rule in HM (example.com = third party):
@@example.com^$third-party

If you want to whitelist the third party only on a specific first party site, the whitelist rule in HM is:
@@example.com^$third-party,domain=firstparty.com

With these examples it’s easy to think of rules for MM.

A complicating factor is that Adguard MV3 still doesn’t log events. For now the most practical approach to this problem is, to use the MM rule and in advance to whitelist most common domainextensions. The blocking rule is then focussed on unusual and possible suspected third parties. I would regard this as a kind of backstop and not as a replacement of third party filterlists (such as https://raw.githubusercontent.com/Kees1958/W3C_annual_most_used_survey_blocklist/master/EU_US+most_used_ad_and_tracking_networks.txt).

An example of such a softened MM blocking rule:
||*^$script,subdocument,third-party,denyallow=com|eu|inf|io|ms|net|nl|org

Domainextension .nl is from my country.

If you want to whitelist a blocked domainextension there are two possibilities.

1.Add the domainextension to aforementioned rule.

2.Make a separate whitelist rule just for that case. E.g. regarding the domainextension .video (yes this really exists). An example:
@@.video$script,subdocument,third-party,domain=firstparty.com

As I said, Adguard MV3 still doesn’t log events. Besides above-described practical approach I use for the time being also the authentic Adguard browser extension, that also accepts the filter rules, to view the log.

For the here discussed solution I was strongly inspired by the thread “uBlock0rigin in Medium mode for Lighter and Stronger Protection, with Less websites breakage and hassle”
 
Last edited:
F

ForgottenSeer 97327

@Jan Willy THANKS!

Great tutorial (y), you inspired me to add this (although a bit differently, because I am on AGv4 and AGv4 seems to ignore generic * rules)

/http:\/\/.*/$script,subdocument,important
/https:\/\/.*/$script,subdocument,third-party,denyallow=com|eu|inf|io|edu|ms|net|nl|org
 

Jan Willy

Level 13
Thread author
Verified
Top Poster
Well-known
Jul 5, 2019
607
@Jan Willy THANKS!

Great tutorial (y), you inspired me to add this (although a bit differently, because I am on AGv4 and AGv4 seems to ignore generic * rules)

/http:\/\/.*/$script,subdocument,important
/https:\/\/.*/$script,subdocument,third-party,denyallow=com|eu|inf|io|edu|ms|net|nl|org
Thanks for your compliment. In my OP I stated that I use for the time being also the authentic Adguard browser extension, that also accepts the filter rules. And those rules work well, e.g.:

AG filter rules.jpg


A request from a third party site with a not whitelisted domainextension (.cloud) is blocked.
Edit: the first party site ad.nl is not broken.
Nevertheless, your rules work in the same way.
 
Last edited:
F

ForgottenSeer 97327

@JanWilly

1670672843534.png

I was playing with your rules and it generic * block did not seem to work WITHOUT domain or denyallow limitation (making the rules specific). So your rules work, but the test also showed why I was set on the wrong foot.

By the way: I am now also using the EU-US blocklist you are using. Do you also use his (Kees1958) param blocklist?

I have found a nice little blocklist for some Dutch news websites (link) and I am also using his (LennyFox) blocklist for youtube

Thanks for your tips (y)
 
Last edited by a moderator:
  • Like
Reactions: Nevi and oldschool

Jan Willy

Level 13
Thread author
Verified
Top Poster
Well-known
Jul 5, 2019
607
@JanWilly


I was playing with your rules and it generic * block did not seem to work WITHOUT domain or denyallow limitation (making the rules specific). So your rules work, but the test also showed why I was set on the wrong foot.

By the way: I am now also using the EU-US blocklist you are using. Do you also use his (Kees1958) param blocklist?

I have found a nice little blocklist for some Dutch news websites (link) and I am also using his (LennyFox) blocklist for youtube

Thanks for your tips (y)
You didn't use the complete rule. You forgot to add the circumflex ^ after *. Here you see that the Hard Mode rule works well:

AG filter rules.jpg


I know the filters from Kees1958 and Lenny Fox. It's a pity that they don't contribute to this forum anymore. I've learned much from them.

Instead of Kees1958 URL tracking parameters I use Adguard URL Tracking Protection and DandelionSprout's LegitimateURLShortener. Both lists cover 85% from the much smaller Kees1958 URL tracking parameters.

In my OP I linked to the extended version from Kees1958 EU US most used ads & trackers networks (third-party blocking only). But I prefer the smaller version, that suits with Google MV3:

From Lenny Fox's filters I only use https://raw.githubusercontent.com/LennyFox/Blocklists/master/videos.txt
But thanks for the tip.
 
F

ForgottenSeer 97327

@Jan Willy

Maybe you learned from them, but now I learn from you :)


Thanks for pointing me to the short Kees1958 version. I am using Firefox on my Android phone and have disconnect anti-tracking enabled.

LennyFox videos is the same as the youtube list (title is videos, but only has youtube rules).

I am using Kees1958 param (both in phone and desktop). I had two (now obsolete) reasons to use Kees1958 para. List

1. Kees1958 param used to look more organized than the AdGuard param filter version. I say usef, because AG now also labels and groups the rules in the same way like Kees1958 does.

2. Kees1958 is smaller and is Dutch, so I assumed also beingwould less likely cause any conflicts. But after 1.5 year of using param blocklist, I never ran into website breakage.
 
F

ForgottenSeer 97327

@ Jan Willy (y)(y)(y)

Since december 10th using your tip and have not added a single exception.

!
! Blokkeer third-party javascript en iframes behalve op een aantal Country codes en generieke Top Level Domains
!
! NL = Nederland
! BE = België
! DE = Duitsland
! UK = Groot Britannië
! EU = Europa
! com = commerciële organisaties
! org = non-profit organisaties
! net = netwerk organisaties
! inf = informatie webservices
! io = input/output webservices
! ms = Microsoft websites
!
||*$third-party,script,subdocument,denyallow=NL|BE|DE|UK|EU|com|org|net|inf|io|ms
 

Jan Willy

Level 13
Thread author
Verified
Top Poster
Well-known
Jul 5, 2019
607
This thread is only intended to give a guideline for simulating uBO's medium mode in AG browserextension. It doesn't serve any other goal. I emphasize this because elsewhere in this forum is given a broader interpretation of the custom rules in this thread, sometimes called Jan Willy's easy medium mode. Of course anyone is free to interprete and use the rules in the way he/she wants, even if it doesn't add benefit. But I have absolutely nothing to do with that.
 
F

ForgottenSeer 97327

This thread is only intended to give a guideline for simulating uBO's medium mode in AG browserextension. It doesn't serve any other goal. I emphasize this because elsewhere in this forum is given a broader interpretation of the custom rules in this thread, sometimes called Jan Willy's easy medium mode. Of course anyone is free to interprete and use the rules in the way he/she wants, even if it doesn't add benefit. But I have absolutely nothing to do with that.
I will never call it Jan Willy's easy medium mode again! :)
 
  • Like
Reactions: Jan Willy

Alexai

Level 3
Aug 12, 2023
149
Jan, but how is possible this:

HM = ||*^$third-party
MM = ||*^$script,subdocument,third-party

It seems to me that MM rules include HM. No?
 
  • Like
Reactions: Jan Willy

Jan Willy

Level 13
Thread author
Verified
Top Poster
Well-known
Jul 5, 2019
607
Jan, but how is possible this:

HM = ||*^$third-party
MM = ||*^$script,subdocument,third-party

It seems to me that MM rules include HM. No?
HM (Hard Mode) blocks all third party elements. Not only scripts and subdocuments (= MM), but also f.i. fonts, objects, XMLHttpRequests and Websockets.
An educational post about the possibilities of uBO:
 

Alexai

Level 3
Aug 12, 2023
149
HM (Hard Mode) blocks all third party elements. Not only scripts and subdocuments (= MM), but also f.i. fonts, objects, XMLHttpRequests and Websockets.
MM has got third-party like HM :confused:
AFAIK this rule will not work in AG for Windows. Just try it and you will see.
with the double || adguarDesktop doesn't like . How can I see?
Sorry, I'm so ignorant :confused:
 

Jan Willy

Level 13
Thread author
Verified
Top Poster
Well-known
Jul 5, 2019
607
MM has got third-party like HM :confused:

with the double || adguarDesktop doesn't like . How can I see?
Sorry, I'm so ignorant :confused:
I don't want to be arrogant, but you have to consider if you are the right person to "play" with custom rules. For most people the default settings are sufficient. Besides that, this thread isn't intended to discuss custom rules in AG for Windows. Nevertheless, if you want to learn more about the AG syntax, view How to create your own ad filters | AdGuard Knowledge Base
 
F

ForgottenSeer 107474

Although AdGuard has developed a core (shared) engine for all applications (DNS, desktop and extension), there are still differences because of software capabilities/limitations related to the architectural differences where the engine is used.
 

Jan Willy

Level 13
Thread author
Verified
Top Poster
Well-known
Jul 5, 2019
607
this thread isn't intended to discuss custom rules in AG for Windows
This I said before. Now I make an exception. Also in AG for Windows (desktop version) it's possible to make an uBO-like softened MM blocking rule. I show an example:
||*^$script,subdocument,third-party,to=~be|~com|~de|~eu|~inf|~io|~ms|~net|~nl|~org|~uk|~us
Thanks to @LennyFox who suggested this and to @Alexai who tried this out first.
 

About us

  • MalwareTips is a community-driven platform providing the latest information and resources on malware and cyber threats. Our team of experienced professionals and passionate volunteers work to keep the internet safe and secure. We provide accurate, up-to-date information and strive to build a strong and supportive community dedicated to cybersecurity.

User Menu

Follow us

Follow us on Facebook or Twitter to know first about the latest cybersecurity incidents and malware threats.

Top