Adguardhome: Provide a tool/script for converting browser blockers' lists to DNS-level compatible lists

Created on 7 Nov 2019  路  6Comments  路  Source: AdguardTeam/AdGuardHome

https://github.com/AdguardTeam/AdGuardHome/issues/1026#issuecomment-551078519

Here's what we need to do:

  1. [x] A python script (module?) that transforms an adblock-style syntax list to the list that AdGuard Home can understand.
  2. [x] Update the wiki article and mention this new script

Here is how this script should analyze a rule.

  1. Parse the rule, split it into the "pattern" and the "modifiers"
  2. If it is a cosmetic rule, discard it right away
  3. Remove the modifiers we ignore:

    • third-party

    • 3p

    • all

    • document

    • empty

  4. Check the modifiers that are left. If there are any unsupported modifier left, discard the rule.
  5. Currently, we support the following modifiers: important, badfilter
Medium enhancement help wanted

Most helpful comment

It also would be useful to have a script which converts hosts-based file into DNS-level compatible list.
For myself I am using now scary mix of shell scripting and Python.
This script must be able:

  1. to remove any unsupported and non-RFC compatible lines;
  2. replace "0.0.0.0" or "127.0.0.1" or similar to "||";
  3. if top-level domain (TLD) already presented, delete any lines which contains this TLD as a sub-string;
  4. check duplicates among several files and delete any sub-domains if TLD is presented in another file
    I have all but 4 (except that I re-invented wheel by the very ugly way) :)

All 6 comments

Isn't it good to integrate this to adguard home?

Tbh, I don't want people to blindly add browser blocker's lists to AdGuard Home, that's why I want to have a separate tool.

It is targeted at filter lists maintainers who wish to provide hosts blocklists that reuse parts of traditional filter lists.

Got it ^_^

It also would be useful to have a script which converts hosts-based file into DNS-level compatible list.
For myself I am using now scary mix of shell scripting and Python.
This script must be able:

  1. to remove any unsupported and non-RFC compatible lines;
  2. replace "0.0.0.0" or "127.0.0.1" or similar to "||";
  3. if top-level domain (TLD) already presented, delete any lines which contains this TLD as a sub-string;
  4. check duplicates among several files and delete any sub-domains if TLD is presented in another file
    I have all but 4 (except that I re-invented wheel by the very ugly way) :)
Was this page helpful?
0 / 5 - 0 ratings

Related issues

hl2guide picture hl2guide  路  3Comments

alexpovel picture alexpovel  路  3Comments

xenio picture xenio  路  4Comments

ameshkov picture ameshkov  路  3Comments

AnthonyBe picture AnthonyBe  路  3Comments