Skip to main content

The whitelisting tool of the Ultimate Hosts Blacklist project.

Project description

This is the branch which contain the script which we use to whitelist domains or IP into our infrastructure.

Installation

$ pip3 install --user ultimate-hosts-blacklist-whitelist

Complementary whitelist

Our script allow us to link one or more file(s) to the system which will be used in complementary of our whitelist list.

Special markers

If you already used a whitelist list you already know that we generaly only list all domains we want to whitelist one by one.

It’s also possible to do that with our whitelisting system but we can do more.

ALL

The ALL marker will tell the system to escape and regex check againt what follows.

INVALID characters

  • $

    • As we automatically append $ to the end, you should not use this character.

  • \\

    • As we automatically escape the given expression, you should not explicitly escape your regular expression when declaring an ALL marker.

REG

The REG marker will tell the system to explicitly check for the given regex which follows the marker.

RZD

The RZD marker will tell the system to explicitly check for the given string plus all possible TDL.

Understanding what we actually do

If we have the following secondary whitelist list:

facebook.com
ALL .gov
REG face
RZD example

our system will actually :

  • Remove every line which match facebook.com and www.facebook.com

  • Remove everyline which match example.*

  • In complementary convert all lines with ALL ` or :code:`REG to the right format.

  • Check every line again the regular expression.

  • Print or save on screen the results.

The genereated regular expression will be in this example:

\.gov$|face|ebay(.*)

NOTE: The ebay group is much longer as we construct the list of TDL based on the Root Zone Database of the IANA and the Public Suffix List project.

Which actually means that we whitelist:

  • all elements/lines which ends with .gov

  • all elements/lines which contain the word face

Usage of the script

The sript can be called as uhb-whitelist, uhb_whitelist (which is kept for historical reason) and ultimate-hosts-blacklist-whitelist.

usage: uhb_whitelist [-h] [-f FILE] [-w WHITELIST [WHITELIST ...]] [-wc]
                 [-o OUTPUT] [-v]

The tool to clean a list or a hosts file with the Ultimate Hosts Blacklist
whitelist list or your own.

optional arguments:
    -h, --help            show this help message and exit
    -f FILE, --file FILE  Read the given file and remove all element to
                            whitelist.
    -w WHITELIST [WHITELIST ...], --whitelist WHITELIST [WHITELIST ...]
                            Read the given file and append its data to the our
                            whitelist list.
    -wc, --without-core   Disable the usage of the Ultimate Hosts Blacklist
                            whitelist list.
    -o OUTPUT, --output OUTPUT
                            Save the result to the given filename or path.
    -v, --version         Show the version end exist.

Crafted with ♥ by Nissar Chababy (Funilrys)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

File details

Details for the file ultimate_hosts_blacklist_whitelist-3.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ultimate_hosts_blacklist_whitelist-3.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 30123995218cd82d59eec0639348a50b950ed3ad2be6ad1ff20ac6dbc0c8f34b
MD5 6b8d74d9edaf7bb1503f7d92309ae0fc
BLAKE2b-256 8f0e71bac87e3c78316729a1748986975f1899f8620e953f8cfc61ab4811b165

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page