Code Monkey home page Code Monkey logo

adblock's Introduction

adblock

Build Status GoDoc

AdBlockPlus parser, matcher and transparent HTTP/HTTPS proxy

Package documentation can be found at:

http://godoc.org/github.com/pmezard/adblock/adblock

adstop

adstop is an ad-blocking transparent HTTP/HTTPS proxy.

It was designed to run on low power, low memory ARM devices and serve a couple of clients, mostly old smartphones which cannot run adblockers themselves.

Before using it, you have to configure your devices and network to make it accessible as a transparent proxy. One way to achieve this is to install a VPN on the server side and redirect all HTTP/HTTPS traffic to the proxy with routing rules. Then make the client browse through the VPN.

HTTPS filtering requires the proxy to intercept the device traffic and decrypt it. To allow this, you have to generate a certificate and add it to your device.

$ adstop -http localhost:1080 \
	-https localhost:1081     \
	-cache .adstop			  \
	-max-age 24h			  \
	-ca-cert /path/to/ca.cert \
	-ca-key /path/to/ca.key   \
	https://easylist-downloads.adblockplus.org/easylist.txt \
	some_local_list.txt

starts the proxy and makes it listen on HTTP on port 1080, HTTPS on port 1081, fetch and load rules from easylist and a local file, cache easylist in an .adstop/ directory and refresh it every 24 hours.

How does it work?

adstop monitors HTTP/HTTPS requests and responses and if one of these matches a filter, it returns a 404 error to the client. It does not modify response bodies. Rules without options or which options are not based on returned data are applied on requests, the others on responses.

The difficult part is to apply Adblock rules. They were designed to operate in a web browser and were assumed to have access to a lot more of information than a simple web proxy has. adstop supports only a subset of available rules:

  • Rules without options ("$..." suffix) are completely supported
  • The following options are supported:
    • domain=foo.com|bar.com|~baz.com
    • font, image, objects, script, stylesheet are roughly approximated using Content-Type.
    • thirdparty is approximated with the Referrer header.
  • The following options are not-supported, and related rules are discared:
    • document
    • media
    • popup
  • Element hiding rules are ignored.
  • Other options are ignored and rules applied without them.

adblock's People

Contributors

pmezard avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.