GithubHelp home page GithubHelp logo

apply_my_lists's Introduction

Overview

This program is very personal and probably not useful to anyone besides me. It takes as input a list of malicious domain names. They are considered so because they fall into one of these categories:

  • tracking
  • advertisement
  • malware distribution
  • porn

This list is converted to an input file ready to be used for the “servers-file” directive in the configuration file of dnsmasq. So, the output file will consist of lines with this format:

server=/example.com/

For getting there, the following steps are necessary:

  1. Make the set of domains unique
  2. Remove all domains that are sub-domains of others (they are shadowed anyway, so they would just make the dataset bigger)
  3. Apply a custom blacklist, i.e. add those entries to the input
  4. Apply a whitelist. This is a little bit trickier and explained in a section of its own.

Input file format

Each line in the large blacklist must have the form:

0.0.0.0 example.com

As for the personal black/whitelists, each line contains exactly one domain name. Empty lines and lines starting with # are ignored.

Hardcoded paths

Input

/etc/hosts-blacklist

Output

/etc/servers-blacklist

Blacklist

/tmp/my_blacklist

Whitelist

/tmp/my_whitelist

Applying the whitelist

Each domain on the whitelist removes itself and all of its subdomains from the complete list.

If there are superdomains (for a whitelist entry good.example.com this would be example.com), an additional entry is added to the output of the form:

server=/good.example.com/#

Note the # at the end of the line.

Todos

  • If a whitelisted entry does not start with “*.”, do not remove blacklisted subdomains. For instance, I whitelist werstreamt.es, however, data-c0c484e9be.werstreamt.es should still be blacklisted.

apply_my_lists's People

Contributors

bronger avatar

Watchers

 avatar  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.