Skip to content

Small script I use for merging hostfiles from different sources. Made for PiHole or Adguard Home.

License

Notifications You must be signed in to change notification settings

Bastiaantjuhh/hostfile-merge

Repository files navigation

hostfile-merge

Small script I use for merging hostfiles from different sources. Made for PiHole or Adguard Home.

This script is made to use as a Cronjob. I host this script under a subdomain on a public webhosting so that not only I but also other AdGoard Home devices I serve can use the same list and I dont need to update all manualy but on one central place.

Works with PiHole and Adguard Home.

Table of content

Install & Usage

Use GitHub actions

No documentation for this method. See .github/workflows/main.yml for the details

Docker

  1. Edit Cron.php and ad you're lists to the array. Example:
    $blacklists = [
        __DIR__ . "/custom_blacklist.txt",
        "https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt",
        "https://adaway.org/hosts.txt",
    ];
    
    $whitelist = [
        __DIR__ . "/custom_whitelist.txt"
    ];
  2. run docker-compose up -d

PHP and Apache

  1. Clone or download the repo to a publicly accessible place like a Apache or NGINX webserver with PHP installed.
  2. Edit Cron.php and ad you're lists to the array. Example:
    $blacklists = [
        __DIR__ . "/custom_blacklist.txt",
        "https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt",
        "https://adaway.org/hosts.txt",
    ];
    
    $whitelist = [
        __DIR__ . "/custom_whitelist.txt"
    ];
  3. Custom domains can be added to the custom_blacklist.txt and custom_whitelist.txt located in the Custom directory.
  4. Make a cron job so that the script refresh the lists for example every day or every hour.
  5. Enter the URL of the whitelist and blacklist in either PiHole or Adguard Home.
  6. In the .github/workflows directory there is a GitHub Actions file called main.yml this file makes it posible to automatic build the files for us every day.

Credits

Repository summary

Description Status
License GitHub
Commits GitHub commit activity
Language GitHub top language
Open issues GitHub issues
Closed issues GitHub closed issues
Pull requests GitHub pull requests
Closed pull requests GitHub closed pull requests

License

This project is licensed under the MIT License. You are encouraged to embed the project into your other projects, as long as the license permits.

MIT License

Copyright (c) 2024 Bastiaan de Hart

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

Small script I use for merging hostfiles from different sources. Made for PiHole or Adguard Home.

Topics

Resources

License

Stars

Watchers

Forks

Languages