终极主机黑名单项目的白名单工具。
ultimate-hosts-blacklist-whitelist的Python项目详细描述
这是终极主机黑名单项目提供的白名单工具。 它主要用于将主题(域、IP、URL)白名单到我们的基础架构中,但也可以在我们的基础架构之外使用。
实际上,此工具允许您:
- 以摆脱我们的白名单。
- 使用你自己的白名单。
- 使用你自己的白名单和我们的白名单。
- 以摆脱我们白名单中提到的规则之一。
- 准备一个白名单工具作为python模块使用。
安装
$ pip3 install --user ultimate-hosts-blacklist-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。
反白名单
不喜欢我们的规则吗?我们的工具允许您指定一个包含不想应用的规则列表的文件。
只要使用--anti-whitelist
标志告诉我们一个或多个反白名单文件,我们就会申请!
了解我们的实际工作
如果我们有以下二级白名单:
facebook.com ALL .gov REG face RZD example
我们的系统实际上会:
- 删除与
facebook.com
和www.facebook.com
匹配的每一行
- 删除与
example.*
匹配的所有行
- 在互补中,将所有
ALL ` or :code:`REG
的行转换为正确的格式。 - 再次检查正则表达式的每一行。
- 在屏幕上打印或保存结果。
生成的正则表达式将在以下示例中:
(\.gov$)|(face)|(example(.*))
注意
当我们基于IANA的根区域数据库和公共后缀列表项目构建TDL列表时,example
组要长得多。**
这实际上意味着我们的白名单:
- 以
.gov
结尾的所有元素/行 - 包含单词
face
的所有元素/行
- 以
example
开头的所有可能的TDL组合
贡献者
- 丹尼尔-@dnmTX
工具的使用
sript可以称为uhb-whitelist
、uhb_whitelist
和ultimate-hosts-blacklist-whitelist
。
usage: uhb_whitelist [-h] [-a ANTI_WHITELIST [ANTI_WHITELIST ...]] [-d] [-f FILE] [-o OUTPUT] [-m] [-p PROCESSES] [-v] [-w WHITELIST [WHITELIST ...]] [-wc] 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 -a ANTI_WHITELIST [ANTI_WHITELIST ...], --anti-whitelist ANTI_WHITELIST [ANTI_WHITELIST ...] Read the given file and remove the rules (its data) from the whitelist list we are going to use. -d, --debug Activate the debug mode. This mode will write the whole processes to stdout. -f FILE, --file FILE Read the given file and remove all element to whitelist. -o OUTPUT, --output OUTPUT Save the result to the given filename or path. -m, --multiprocessing Activate the usage of multiple processes. -p PROCESSES, --processes PROCESSES The number of (maximal) processes to use. -v, --version Show the version end exist. -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. Crafted with ♥ by Nissar Chababy (Funilrys)
许可证
MIT License Copyright (c) 2018, 2019 Ultimate-Hosts-Blacklist Copyright (c) 2018, 2019 Nissar Chababy Copyright (c) 2019 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.