Skip to content

Regex rules do not appear to match Adblock Rules #11

Open

Description

@essandess

Is this correct?

Using the example &ad_box_ from the the easylist block, Privoxy shows no matches:

http://config.privoxy.org/show-url-info?url=http%3A%2F%2Ftest.com%2F%26ad_box_

The exact string works, but I believe this should be a substring.

Activity

  1. faxotherapy commented on Jun 3, 2017

    @faxotherapy

    Refer to this website for more info.

  2. essandess commented on Jun 4, 2017

    @essandess
    Author

    Thanks! Does your fork https://github.com/faxotherapy/privoxy-adblock have the fixes described in your post?

  3. faxotherapy commented on Jun 4, 2017

    @faxotherapy

    No, it doesn't. Just retrieve the archive that sits at the bottom of this post and you'll be good.

  4. essandess commented on Jun 4, 2017

    @essandess
    Author

    Thanks again. Those look like useful mods. Do you mind if I ask a few follow-up questions?

    1. Do you know which AdBlock formats are and are not handled by the regex's in this repo and your archive?
    2. Have you tackled corrections to the Privoxy .filter files created by privacy-adblock.sh? For example, the entry corresponding to &ad_box_ doesn't appear correct:
    s@<([a-zA-Z0-9]+)\s+.*id=.?ad_box.*>.*</\1>@@g
    
    1. I'm interested in translating the EasyList blocks into an efficient(ish) Javascript proxy.pac filtering file, which would allow for HTTPS blocks without setting up Privoxy as a SSL intercept. Are you aware of existing code for this?

    Using a proxy.pac in conjunction with Privoxy would cover the board for applications that use TLS versus HTTP and automatic proxy configurations versus not.

  5. faxotherapy commented on Jun 4, 2017

    @faxotherapy
    1. I've never looked at the page you mentioned, but I found it interesting. Thanks for bringing this to my attention. Apparently, the path part in the original conversion script is correct “in the middle”, not at the beginning of a path pattern to block. Just like you mentioned above for &ad_box_; the add-on I offer only turns it to /.*&ad_id. With regard to domain blocking, the add-on removes the backslashes.
    2. I did not tackle the filter part. So, I guess I can leave it to you… 😀Correcting the syntax for both the host and the path side exhausted me.
    3. No, I'm not aware. Not sure whether it's possible to use an auto config file at the same time Privoxy is used. Isn't it either one or the other?

    As Privoxy doesn't see the path side of a HTTPS request—it can only block the host part of a HTTPS request—I use ProxHTTPSProxy to allow Privoxy see it.

  6. essandess commented on Jun 4, 2017

    @essandess
    Author

    Yes, you can use proxy.pac as a front-end filter before passing to the proxy—see osxfortress for an example.

    This works very well, and avoids the pitfalls of an SSL intercepting proxy.

    It is necessary to write the regex rules efficiently as a DFA in JavaScript.

    All these various AdBlock translation issues look like something that bison should cover if anyone ever wrote out the AdBlock grammar. Are you aware of this?

    That would be a lot easier than writing a zillion one-off regex's for every scenario.

  7. faxotherapy commented on Jun 4, 2017

    @faxotherapy

    All these various AdBlock translation issues look like something that bison should cover if anyone ever wrote out the AdBlock grammar. Are you aware of this?

    No, I'm not.

    Certainly, based on what I learnt from your input, there's definitely another approach, much simpler than the overcomplicated translation from the add-on.

  8. essandess commented on Jun 22, 2017

    @essandess
    Author

    I've created an EasyList to filtering proxy.pac file in the repo easylist-pac-privoxy.

    It's quite efficient and runs on mobile devices. Comments welcome.

  9. essandess commented on Jul 19, 2017

    @essandess
    Author

    The forked repo adblock2privoxy, is a full-feature implementation of EasyList rules in Privoxy, complete with element hiding.

    This is a clever, efficient, and effective implementation: Privoxy handles the domain and path blocking rules using efficient and correct regular expressions, and Privoxy inserts targeted EasyList-based CSS files to handle element hiding.

    In addition to Privoxy, this approach requires a simple (nginx) web server for the CSS files. I've posted an example nginx .conf configuration file that hosts these on the LAN over port 8119.

    I'd encourage anyone interested in achieving network layer EasyList tracker and ad blocking to take a look at this approach.

  10. Redback812 commented on Aug 8, 2017

    @Redback812

    It be great if this could run from a router with DD-WRT O/S, which is a nix in itself, since DD-WRT has privoxy running on the system, all this work would need is a slight modification. If the system internal flash is to small , then a USB 3 stick could do the job.

  11. essandess commented on Aug 8, 2017

    @essandess
    Author

    It would be straightforward to get adblock2privoxy on DD-WRT.

    You'd simply need to copy over the privoxy configuration and CSS files, and
    must install nginx on DD-WRT, or use its native (lighttpd?) webserver to serve the CSS files that are used for element blocks.

    Regular updates could be rsync'd to the router.

    Here's an updating daemon example for macOS: com.github.essandess.adblock2privoxy.plist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions