终极主机黑名单项目的白名单工具。
ultimate-hosts-blacklist-whitelist-dev的Python项目详细描述
这是终极主机黑名单项目提供的白名单工具。 该脚本主要用于将主题(域、IP、URL)白名单到我们的 但它也可以很容易地在我们的基础设施之外使用。在
终极主机黑名单白名单(UHBW)工具允许您:
- 附加您自己的白名单作为我们白名单的补充。在
uhb_whitelist -f inputfile -o outputfile -w whitelistfile
- 反白名单(反向)只有特定的领域,而仍然使用我们的核心名单。在
- 白名单和反白名单,而仍然使用我们的核心名单。在
uhb_whitelist -f inputfile -o outputfile --anti-whitelist antiwhitelistfile -w whitelistfile
- 覆盖我们的核心白名单,同时仍然应用您自己的个人白名单和反白名单。在
uhb_whitelist -f inputfile -o outputfile --anti-whitelist antiwhitelistfile -w whitelistfile -wc
- 准备一个白名单工具作为Python模块使用。在
安装
$ pip3 install --user ultimate-hosts-blacklist-whitelist
特殊标记
如果您已经尝试过使用白名单,您可能会知道,在 通常,在一个文件中,每行只能添加一个域或URL 想要白名单。在
有了超宽带,你可以做到这一点,但除了单调乏味的方式,超宽带还允许你
使用Regex、RZD
和{
ALL
ALL
标记将告诉系统转义和正则表达式检查
接下来是什么。在
无效字符
$
在- As we automatically append
$
to the end of each line, you should not use this character.
- As we automatically append
\\
在- As we automatically escape any given expression, you should not explicitly
escape your regular expression when declaring an
ALL
marker.
- As we automatically escape any given expression, you should not explicitly
escape your regular expression when declaring an
REG
REG
标记将告诉系统显式检查给定的
跟随标记的正则表达式。在
RZD
RZD
标记将告诉系统显式检查给定的
字符串加上所有可能的TDL。在
反白名单
不喜欢我们的一些规则吗?UHBW允许您指定一个文件,其中包含 不希望应用的规则列表。在
只需使用--anti-whitelist
标志来提供一个或多个反白名单
文件和UHBW会服从你的意愿!在
了解UHBW白名单的工作原理
如果您有自己的白名单,包括以下几行:
facebook.com ALL .gov REG face RZD example
UHBW将执行以下操作:
- 删除匹配
facebook.com
和www.facebook.com
的每一行 - 在互补中,将所有带
ALL
或REG
的行转换为 格式正确。在 - 删除匹配
example.*
的每一行 - 对照正则表达式检查每一行。在下一章中会有更多的介绍。在
- 在屏幕上打印结果或保存到输出文件
-o $output.file
。在
从这个例子中生成的正则表达式将是:
(\.gov$)|(face)|(example(.*))
注意
当我们构造TDL列表时,example
组要长得多
基于根区域数据库,IANA和公共后缀列表
项目。**
这意味着UHBW实际上会列出:
- 以
.gov
结尾的所有元素/行 - 包含单词
face
的所有元素/行 - 以
example
开头的所有可能的TDL组合
文件格式
域/url的输入文件应该是每行一个域/url,并且最好是排序的。在
sort -u inputfile -o inputfile
工具的使用
脚本可以由uhb-whitelist
、uhb_whitelist
或
ultimate-hosts-blacklist-whitelist
。在
usage: ultimate-hosts-blacklist-whitelist [-h] [-a ANTI_WHITELIST [ANTI_WHITELIST ...]] [--all ALL [ALL ...]] [-d] [-df] [-f FILE] [--hierachical-sorting] [-o OUTPUT] [-m] [--no-complement] [-p PROCESSES] [--reg REG [REG ...]] [--rzd RZD [RZD ...]] [--standard-sorting] [-v] [-w WHITELIST [WHITELIST ...]] [-wc] UHBW is a tool to clean up lists or hosts files with the hosted and/or your own whitelist. optional arguments: -h, --help show this help message and exit -a ANTI_WHITELIST [ANTI_WHITELIST ...], --anti-whitelist ANTI_WHITELIST [ANTI_WHITELIST ...] Read the given file override rules from the UHBW hosted whitelist which is used by default. (See also `-wc`) --all ALL [ALL ...] Read the given file(s) and append its rules to the whitelisting schema. Note: The rules injected through this argument will be automatically prefixed with the `ALL` marker. -d, --debug Activate the debug mode. This mode will write the whole processes to stdout. -df, --debug-into-file Activate the logging into a file called `uhb_whitelist_debug` at the current location. -f FILE, --file FILE The file to whitelist/clean. --hierachical-sorting Process a hierarchical sorting when outputing into a file. -o OUTPUT, --output OUTPUT Save the result to the given filename or path. (Can not be the same as input file `-f`) -m, --multiprocessing Activate the usage of multiple core processes. --no-complement Forbid us the generation of complements while parsing the whitelist list. Complements are `www.example.org` if `example.org` is given and vice-versa. -p PROCESSES, --processes PROCESSES The number of (maximal) processes core to use. --reg REG [REG ...] Read the given file(s) and append its rules to the whitelisting schema. Note: The rules injected through this argument will be automatically prefixed with the `REG` marker. --rzd RZD [RZD ...] Read the given file(s) and append its rules to the whitelisting schema. Note: The rules injected through this argument will be automatically prefixed with the `RZD` marker. --standard-sorting Process a sorting when outputing into a file. -v, --version Show the version end exist. -w WHITELIST [WHITELIST ...], --whitelist WHITELIST [WHITELIST ...] Read the given file(s) and append its rules to the whitelisting schema. Note: The rules injected through this argument won't be changed. We follow what you give us. That means that if you give any of our supported rules, they will still be appended to the whitelisting schema. -wc, --without-core Disable the usage of the Ultimate Hosts Blacklist whitelist hosted list. Crafted with ♥ by Nissar Chababy (Funilrys)
贡献者
- 丹尼尔-@dnmTX
- 螺旋藻
许可证
MIT License Copyright (c) 2018, 2019, 2020 Ultimate-Hosts-Blacklist Copyright (c) 2018, 2019, 2020 Nissar Chababy Copyright (c) 2019, 2020 Mitchell Krog 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.
- 项目
标签: