• Stars
    star
    175
  • Rank 218,059 (Top 5 %)
  • Language
    Shell
  • License
    MIT License
  • Created almost 11 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Block ads and trackers system-wide, before a request is even issued.

Block any outgoing request to ad and tracker servers, system-wide.

Usage

Yes, you'll need to sudo, since you impact DNS resolution for the whole system.

Install or update the blocklist

$ sudo adblock [--force] [on]	# --force to ignore lack of updates

This will merge the blocklist with your current hostsfile, so any local adjustments you had made previously are still active.

Deactivate blocking

Deactivating blocking is useful to access, for example, affiliate links.

$ sudo adblock off

When you deactivate blocking, your original hostsfile is restored, so any local adjustments you had made previously are still active.

Installation

On macOS with brew

If you're on macOS and use Homebrew:

brew install mattisg/mattisg/adblock

The repetition of mattisg is not a typo: the first is the name of the tap, the second the GitHub username to install from.

Other UNIX (GNU/Linux, macOS…)

You can download this repo as a ZIP and install the adblock script anywhere you want, or use this one-liner:

sudo mkdir -p /usr/local/bin && sudo curl -\# https://raw.githubusercontent.com/MattiSG/adblock/master/adblock --output /usr/local/bin/adblock && sudo chmod u+x /usr/local/bin/adblock

Copy and paste the above to a Terminal prompt and press enter.

Tested on:

  • Debian Stretch
  • Debian Jessie
  • OS X Mountain Lion
  • OS X Mavericks
  • OS X Yosemite
  • OS X El Capitan
  • macOS Sierra
  • macOS High Sierra
  • macOS Mojave

It should work as is on many other GNU/Linux flavours.

What does it block?

Ads, shock sites, hijack sites, malware servers, click trackers, popup traps (sites that make you confirm on and on), spam sending servers…

If you still see some ads after installing, please identify the domain that serves them, and send a request to Dan Pollock at [email protected].

How does it work?

This script is a simple wrapper around downloading and installing Pollock’s hosts file.

Dan Pollock maintains a list of servers to block based on community reports. This list is then simply formatted as a hosts file.

A hosts file maps hostnames (i.e. domains) to IPs. It does the same job as a DNS, but the lookup is made entirely locally.

This feature is used to map all the domains to blacklist to the 0.0.0.0 IP meta-address.

Is it enough?

Using such a hosts file ensures adblocking, and a good level of privacy from tracker networks. However, I recommend to complement it with a browser plugin that can block trackers on a site-by-site basis. Privacy Badger or Ghostery are good choices.

Analytics software that tracks your behaviour can be served by each site from its own domain, thus being impossible to block on a DNS level. Moreover, some trackers (most notably, Google Analytics) are so common that some websites break when they are blocked, and they are thus not blocked by the hosts file. In order to prevent them from loading, yet easily load them if a site seems broken, an interactive browser plugin is easier.

License

MIT

More Repositories

1

Watai

Integration testing for the web of components
JavaScript
62
star
2

DotFiles

Aliases, functions and shell utilities.
Shell
25
star
3

jekyll-template

A template for small teams to deploy landing pages and small websites cheap and fast, engage non-technical contributors, and architect information over time.
HTML
15
star
4

livre-blanc-communs-numeriques

Garantir un usage libre, juste et pérenne des outils logiciels qui contribuent au bien commun
CSS
12
star
5

SemWiktionary

Java API to access data from Wiktionary. Specific target is the French Wiktionary.
Java
11
star
6

requirewith

Dependency injection for Node’s require
JavaScript
5
star
7

Dash-MooTools

DEPRECATED MooTools documentation generator for Dash
CSS
5
star
8

NomadConf.org

An unconference in trains to grow your professional nomadic practices.
5
star
9

grand-debat-trolling

[HACKATHON] Détecter les trolls dans les réponses du Grand Débat National
JavaScript
3
star
10

Element.fit

A MooTools script to dynamically adjust an element's text size so it fills parent container.
JavaScript
3
star
11

EjectAll

Eject all mounted Mac OS X disk images or volumes at once.
AppleScript
3
star
12

MSGShellUtils

A compilation of functions, either by me or found on the web, that centralize common functionalities needed in setup, install or cleanup scripts.
Shell
3
star
13

Object.map.js

Array.map for Object in JavaScript. Map both an object’s keys and values.
JavaScript
2
star
14

voting-recommendations-schema

A representation format for voting recommendations.
2
star
15

Node-ConfigLoader

A configuration loader for Node.js focused on handling overrides cascades.
JavaScript
2
star
16

finder-scripts

Various utility scripts to ease navigating in the Mac OS X Finder.
AppleScript
2
star
17

PolytechWarehouse

A student project groups management and assignment hosting system
PHP
2
star
18

deep-sleep

Let your (old) Mac go to hibernation (deep sleep)
AppleScript
2
star
19

MooGIS

Leaflet. MooTools. Geographical analysis with quality code.
JavaScript
2
star
20

Keynote-notes-extractor

Extract all presenter notes from a Keynote (’09, v6) presentation to an HTML file.
XSLT
2
star
21

ProcSI

Datapath simulator. Academic end of term project.
C
2
star
22

surveillance-baits

[HACKATHON] Datavisualization made for the Hack4YourRights 2013 EU Hackathon, aiming at showing what government surveillance looks like around the world.
CSS
2
star
23

decider-mes-impots

Une application web pour orienter le type d'actions que je souhaite que mes impôts financent.
HTML
2
star
24

WebServiceForm

MooTools automatic asynchronous (“AJAX”) form creator. Aims to help you develop frontends to APIs rather than simply getting updates from a server.
JavaScript
1
star
25

Flore

A game for visually impaired children
Java
1
star
26

reencode

A simple wrapper for ffmpeg
Shell
1
star
27

comment-voter

Le guide le plus simple du vote en France.
HTML
1
star
28

WhatNamespace

A directory of XML dialects and their namespaces.
PHP
1
star
29

FenS-calendrier

Futur en Seine festival website events to iCal
JavaScript
1
star
30

JSnow

A realtime ski resort management webapp. Actually, a learning project for Node.js
JavaScript
1
star
31

epicene.info

Normaliser et faciliter l'usage de l'écriture inclusive
JavaScript
1
star
32

Enveloper

Algorithms to calculate a convex envelope
JavaScript
1
star
33

Meio.Autocomplete.Geo

A MooTools plugin based on Meio.Autocomplete that autocompletes a field with Google Local Search results and allows you to retrieve latitude, longitude, city and other info from the user's selection.
JavaScript
1
star
34

wd-element

[DEPRECATED] A promises-oriented wrapper around wd.
JavaScript
1
star
35

alignements-loi

[HACKATHON] Alignement des représentations dans l'écosystème des calculateurs
HTML
1
star