终极主机黑名单项目的白名单工具。
ultimate-hosts-blacklist-the-whitelist的Python项目详细描述
这是包含脚本的分支,我们使用该脚本将域或IP白名单到我们的基础结构中。
安装
$ pip3 install --user ultimate-hosts-blacklist-the-whitelist
补充白名单
我们的脚本允许我们将一个或多个文件链接到将用于补充白名单的系统。
特殊标记
如果你已经使用了一个白名单,你已经知道我们通常只列出所有的域,我们想一个一个白名单。
我们的白名单系统也可以做到这一点,但我们可以做更多。
ALL
标记ALL
将告诉系统重新转义并重新检查以下内容的regex。
无效字符
$
- As we automatically append
$
to the end, you should not use this character.
- As we automatically append
\\
- As we automatically escape the given expression, you should not explicitly escape your regular expression when declaring an
ALL
marker.
- As we automatically escape the given expression, you should not explicitly escape your regular expression when declaring an
REG
标记REG
将告诉系统显式检查标记后面的给定regex。
RZD
RZD
标记将告诉系统显式检查给定的字符串和所有可能的tdl。
了解我们的实际工作
如果我们有以下二级白名单:
facebook.com ALL .gov REG face RZD ebay
我们的系统实际上会:
- 删除与
facebook.com
和www.facebook.com
匹配的每一行
- 删除与
ebay.*
匹配的所有行
- 在互补中,将所有
ALL ` or :code:`REG
的行转换为正确的格式。 - 再次检查正则表达式的每一行。
- 在屏幕上打印或保存结果。
在这个例子中,generated正则表达式是:
\.gov$|face|ebay(.*)
注意:易趣组的时间更长,因为我们基于IANA的根区域数据库和公共后缀列表项目构建TDL列表。
这实际上意味着我们的白名单:
- 以
.gov
结尾的所有元素/行 - 包含单词
face
的所有元素/行
脚本的用法
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)