Giter Club home page Giter Club logo

pihole-regex's Introduction

Regex Filters for Pi-hole

This is a custom regex filter file for use with Pi-hole v4+ (FTLDNS).

There is also an optional regex filter for Facebook which will be separate to the installer and each entry will need to be added manually.

All commands will need to be entered via Terminal (PuTTY or your SSH client of choice) after logging in.

Why use the installer?

The installer will determine whether you are using the Pi-hole database or the older style regex.list, then evaluate your current regular expressions and act accordingly. It has been created to make life easier.

Installer Requirements

This script requires Python 3.6+ in order to run correctly. It has been written and tested for Raspbian Buster and Ubuntu Server.

If you experience syntax errors due to the use of f-strings, this is likely because your installed version of Python is below 3.6.

Why is root (sudo) required by the installer?

At the time of the scripts creation, it is necessary to run as root in order to modify files in /etc/pihole (regex.list and gravity.db)

Can I use these regexps without using the installer?

Yes, you can. You can enter them one by one in the Pi-hole web interface.

[OPTIONAL] Back up your existing regex list

If you are using the new Pi-hole DB

sudo cp /etc/pihole/gravity.db /etc/pihole/gravity.db.bak

If you are using the older style regex.list:

sudo cp /etc/pihole/regex.list /etc/pihole/regex.list.bak

Installation

curl -sSl https://raw.githubusercontent.com/mmotti/pihole-regex/master/install.py | sudo python3

OPTIONAL: Keeping regexps up-to-date

The following instructions will create a cron job to run each morning at 02:45 (adjust the time to suit your needs):

  1. Edit the root user's crontab (sudo crontab -u root -e)

  2. Enter the following:

SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
45 2 * * * /usr/bin/curl -sSl https://raw.githubusercontent.com/mmotti/pihole-regex/master/install.py | /usr/bin/python3
  1. Save changes

Removal

curl -sSl https://raw.githubusercontent.com/mmotti/pihole-regex/master/uninstall.py | sudo python3

Removing the cron job (if you created one)

If this script is the only thing you've added to the root user's crontab, you can run:

sudo crontab -u root -r

Otherwise, run:

sudo crontab -u root -e and remove the three lines listed above in the install instructions.

pihole-regex's People

Contributors

kyle95wm avatar mmotti avatar wally3k avatar

Watchers

 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.