• Stars
    star
    1,789
  • Rank 25,982 (Top 0.6 %)
  • Language
    Shell
  • License
    Apache License 2.0
  • Created almost 5 years ago
  • Updated 3 months ago

Reviews

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

Repository Details

Simple, native and efficient local ad blocker. Only Bash.

Maza ad blocking

🥇 Top 1 in Hacker News

Comments: https://news.ycombinator.com/item?id=22717650

banner

A command to squash all ads in all browsers

sudo maza start

Like Pi-hole but local and using your operating system.

Simple, native and efficient local ad blocker. Bash script compatible with MacOS, Linux, BSD and Windows Subsystem for Linux (WSL).

  • Just bash 🤖.
  • It affects any browser or software installed 😱.
  • You don't have to install any browser extensions or applications 🚫, you just use the tools of your operating system.
  • You update the list of DNS to be blocked with a single command 😎.
  • Pure Opensource ❤️.

demo

Index

📟 Commands

📡 Update database

maza update

🔨 Start

sudo maza start

🛠 Stop

sudo maza stop

⚖️ Status

maza status

⚙️ Install or Update

😥 Requirements

  • bash 4.0 or higher
  • curl
  • Only macOS users, gsed: brew install gnu-sed

Then you do this.

curl -o maza https://raw.githubusercontent.com/tanrax/maza-ad-blocking/master/maza && sudo rm -rf /usr/local/bin/maza && chmod +x maza && sudo mv maza /usr/local/bin

Optional but recommended, make a backup of your hosts file.

sudo cp /etc/hosts /etc/hosts.backup

🤖 Auto update of domains to be blocked

Open your cron.

crontab -e

Add the following line at the end.

@daily maza update

Some users have reported problems creating daemons on MacOS. Fixed with TERM=dumb.

TERM=dumb
@daily maza update

🔪 Uninstall

sudo rm /usr/local/bin/maza && sudo rm -r ~/.config/maza

🚫 Not blocking certain domains

Edit ~/.config/maza/ignore and add the domains you want to ignore.

Example:

ads-twitter.com
ads.twitter.com

By default, the following domains are ignored to avoid problems with the operating system.

localhost
localhost.localdomain
local
broadcasthost
ip6-localhost
ip6-loopback
ip6-localnet
ip6-mcastprefix
ip6-allnodes
ip6-allrouters
ip6-allhosts
0.0.0.0

Finally update Maza to apply the changes.

maza update

🎯 Add custom domains to block

If you want to include your own domains to be blocked, you can add them to ~/.config/maza/custom-domains. They must each be on one line, ignoring end slash or protocol (http or https).

For example:

beauty-tea.com
www.expaqua.cloud
ad.about.com

Then update the database to regenerate the list to include your domains.

maza update

🔒 Alternative DNS list

By default the Yoyo DNS list (Peter Lowe) is used. If you want to use another list, like Steven Black's for example, you must modify the variable in line 7.

Replace this line:

URL_DNS_LIST="https://pgl.yoyo.org/adservers/serverlist.php?showintro=0&mimetype=plaintext"

with this:

URL_DNS_LIST="https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts"

DNSMASQ

Unfortunately the hosts file does not support sub-domains (wildcards), which is necessary to correctly filter all DNS. You will need to install locally a server for that purpose, Maza supports the Dnsmasq format.

MacOS

Linux

MacOS

0 Update Maza

maza update

1 Install

brew install dnsmasq

2 Configure

Edit the file.

/usr/local/etc/dnsmasq.conf

Add the following line at the end.

conf-file=(your user path)/.config/maza/dnsmasq.conf

Example

conf-file=/Users/myuser/.config/maza/dnsmasq.conf

Start DNSMASQ.

sudo brew services stop dnsmasq
sudo brew services start dnsmasq

3 Tell your OS to use your DNS server

Delete the list of macOS DNS servers and add the 3 addresses. The first one will be your local server, and the other 2 belong to OpenDNS, which you can use any other.

127.0.0.1
208.67.222.222
208.67.220.220

network macos

Refresh your DNS cache

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

4 Restart/Start Maza

sudo maza stop
sudo maza start

Linux (Debian/Ubuntu)

0 Update Maza

maza update

1 Install

sudo apt update
sudo apt install dnsmasq

2 Configure

Edit file in path.

/etc/dnsmasq.conf

Add the following line at the end.

conf-file=(your user path)/.config/maza/dnsmasq.conf

Example

conf-file=/home/myuser/.config/maza/dnsmasq.conf

Start DNSMASQ.

sudo systemctl stop dnsmasq
sudo systemctl start dnsmasq
sudo systemctl enable dnsmasq

3 Tell your OS to use your DNS server

3.1 Gnome Shell

In Gnome Shell, open Settings->Network. Click in your connection.

network gnome

Add your local server (dnsmasq), and the other 2 belong to OpenDNS, which you can use any other.

127.0.0.1,208.67.222.222,208.67.220.220

gnome dns

3.2 KDE Plasma

In KDE Plasma, open Settings->Network->Connectios. Click in your connection and tab ip4.

  • Method: Automatic (Only addresses).

Add your local server (dnsmasq), and the other 2 belong to OpenDNS, which you can use any other.

  • DNS Servers: 127.0.0.1,208.67.222.222,208.67.220.220.

kde dns

4 Restart/Start Maza

sudo maza stop
sudo maza start

Bonus: dnsmasq is in charge of solving all DNS

Add in configure file: /usr/local/etc/dnsmasq.conf

no-resolv
server=208.67.222.222
server=208.67.220.220

Bonus: dnsmasq have localhost domains

If you want all your .localhost domains, for example, point to localhost add in configure file: /usr/local/etc/dnsmasq.conf or /etc/dnsmasq.conf.

address=/.localhost/127.0.0.1

💬 Get Help or talk with the community

Jabber/XMPP

Help me continue to improve

Donate using Liberapay

🍓 CREATE YOUR OWN PI-HOLE SERVER WITH MAZA

You can easily create your own DNS server on a Raspberry Pi, VPS or wherever you want, to connect your devices in just 10 commands thanks to Maza. Follow the tutorial.

⚠️ CAUTION

Remember to make a backup copy of /etc/hosts in case of unforeseen circumstances, neither the project nor its author will be responsible for any possible repercussions derived from not carrying out this action.

🧑‍🎨 Credits

Andros Fenollosa

More Repositories

1

terminal-AdvancedNewFile

Fast creation of files and directories. Mimics the operation of AdvancedNewFile (Vim plugin)
Python
262
star
2

RSSPAPER

Generate your own static RSS newspaper that you can embed on your device (PWA support)
CSS
87
star
3

flask-contacts

Example of CRUD with Flask to manage a contact list.
Python
82
star
4

demo-HTML-over-WebSockets-in-Django

Demonstration of how to build a real time application using HTML over WebSockets in Django
Python
39
star
5

guetzli-recursively

Script in Python to convert all the jpeg of a folder recursively with Guetzli
Python
33
star
6

flask-note

PyConES16 workshop where Evernote is replicated through Flask
HTML
31
star
7

standard-notes-to-evernote-or-joplin

Script to convert your Standard Notes notes into an Evernote or Joplin compatible format
Python
30
star
8

wallaviso

Programa tus busquedas y recibe un feed. Se el primero en comprar en Wallapop.
HTML
27
star
9

wp-backup

Snapshot and backups for WordPress in pure Bash
Shell
22
star
10

transfersh-cli

Unofficially Python client to upload files to the transfer.sh service
Python
21
star
11

FFNM

Front-End for the next master
HTML
18
star
12

notion-to-joplin

Script by make a compatible Notion backup in Joplin
Python
14
star
13

wallapop-alert

Notificador de productos nuevos
Python
14
star
14

flask-wallapop-watcher

PyConES17: Vigilante de Wallapop. Workshop where a simple application to monitor prices in Wallapop with Flask
Python
13
star
15

linux-install-firefox-developer-edition

Bash script to install the latest version of Firefox Developer Edition on Linux with desktop integration from Mozilla repository
Shell
12
star
16

soy-un-buen-programador-js

Juego con retos sencillos de JavaScript para probarte a ti mismo que sabes lo que haces
11
star
17

lirve.el

Learn irregular verbs in English with Emacs
Emacs Lisp
11
star
18

complete-HTML5-template-started

Modern and complete HTML5 template to start your web pages
HTML
9
star
19

simplescrollup

Simple plugin in Javascript to animate scrolling when you return to the top of the page
JavaScript
9
star
20

scroll-page-without-moving-point.el

Move the scroll in Emacs without moving the position cursor.
Emacs Lisp
8
star
21

openstreetmap-tag-map

Label to generate the openstreetmap iframe from the country and region.
HTML
7
star
22

workshop-flask-with-vuejs

Taller para la creación de un sencillo API Rest con Flask y su integración con VueJS
CSS
7
star
23

org-share-to-web.el

Share an Org buffer as a web page. In addition, a URL will be created that you can share to view it.
Sass
7
star
24

flask-chat-example

Flask chat example with Socketio and Vuejs
CSS
6
star
25

bash-folders

Small collection of Bash scripts to launch functionalities in folders when new files appear, such as optimizing videos, converting images or battery management.
Shell
6
star
26

short-wave

Send with MailGun your personalized newsletter. Available news from Hacker News and Reddit.
HTML
5
star
27

symbiosis-css

Modern normalize for mobile. Fixes small problems in web pages, PWA or hybrid apps, avoiding common development problems.
CSS
4
star
28

place-image

Download random images in different sizes and content to simplify web development.
Shell
3
star
29

guetzli-recursively-gui

Convert all the jpeg of a folder recursively with Guetzli for Mac OS X
Python
3
star
30

SSE-Fake

Free fake Server-send Events for testing and prototyping.
Python
2
star
31

django-multipage-template-for-html-over-the-wire

Django multipage template for html over the wire
Python
2
star
32

pattern-7-1-with-split-media

Architecture to organize your CSS files.
Sass
2
star
33

ejemplo-de-chat-con-Django

Ejemplo de Chat en Django con Websockets (Channels), asincrono, salas e integrado con el panel Admin.
Python
2
star
34

api-postal-code-spain

Sencilla API para obtener información de los códigos postales de España.
Python
2
star
35

alert-battery-to-maintain-health

Alerts you if your battery is overcharged or discharged to extend its performance and health.
Python
2
star
36

flask-api-example

Ejemplo de como realizar un API Rest sencillo con Flask
Python
2
star
37

pattern-7-1

CSS architecture: Pattern 7-1 with SASS syntax (.sass extension).
Sass
2
star
38

place-image-random

Download random images with no download limit or tokens.
2
star
39

flask-login-example

Flask Example: Login, Signup and Forgot password
HTML
2
star
40

simple-HTML-over-the-Wire-social-network

Simple social network using HTML over the Wire architecture in Django with Channels
Python
2
star
41

view-my-photos

Generates an HTML gallery of photos indicating the folder where they are stored.
Python
2
star
42

shall-I-kill-her

Shall I Kill Her
Lua
2
star
43

auto-video-thumbnail

Watch and resize all the videos you deposit in the folder you need. Optimized for web, perfect for reducing the load of your applications.
Clojure
2
star
44

SublimeFlaskHello

Flask modern snippet for Sublime Text 3
1
star
45

bitbar-offlineimapNotification

Python
1
star
46

hangman-bot

IA to win the game of the Hangman
Python
1
star
47

NotesToMarkDown

Exports the notes of the application Notes for MacOS, Fastmail... in Markdown.
Python
1
star
48

example-css-multilang

Multi-language website using only CSS3
HTML
1
star
49

love2d-tutorial-runner

Example of how to make a runner-style game with Löve2D
Lua
1
star
50

fiableDB

Immutable NoSQL database in a plain file
Python
1
star
51

walphabet

Transform your fonts from TTF or OTF to WOFF2
Python
1
star
52

generate_random_background_pixel

Python
1
star
53

mama-simulator

Un emulador que te envía mensajes recurrentes típicos de madre
Python
1
star
54

api2smtp

Send emails through an Endpoint API
HTML
1
star
55

django-blog-for-html-over-the-wire

Blog built on an architecture HTML over the wire
JavaScript
1
star
56

self-rssingle.el

Emacs Lisp
1
star
57

html-over-websockets-with-django-and-htmx

Simple example of how to make a SPA using only Django. Or in other words, creating a site with HTML architecture over WebSockets that handles HTMX events.
Python
1
star
58

organize-my-photos

Terminal program that organizes and organizes the photographs in folders by year, month and day. #python #terminal
Python
1
star
59

example-of-crud-in-django-with-rest-framework

Example of CRUD in Django with REST FRAMEWORK
Python
1
star