终极主机黑名单项目的白名单工具。

ultimate-hosts-blacklist-whitelist-dev的Python项目详细描述


这是终极主机黑名单项目提供的白名单工具。 该脚本主要用于将主题(域、IP、URL)白名单到我们的 但它也可以很容易地在我们的基础设施之外使用。在

终极主机黑名单白名单(UHBW)工具允许您:

  • 附加您自己的白名单作为我们白名单的补充。在
uhb_whitelist -f inputfile -o outputfile -w whitelistfile
  • 反白名单(反向)只有特定的领域,而仍然使用我们的核心名单。在
^{pr2}$
  • 白名单和反白名单,而仍然使用我们的核心名单。在
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

托管白名单

托管白名单可以在whitelist找到 这个白名单是由whitelist背后的好人团队维护的 项目。在

补充白名单

UHBW允许您将一个或多个文件链接到将用作 对托管的whitelist的补充,默认情况下下载并使用。在

特殊标记

如果您已经尝试过使用白名单,您可能会知道,在 通常,在一个文件中,每行只能添加一个域或URL 想要白名单。在

有了超宽带,你可以做到这一点,但除了单调乏味的方式,超宽带还允许你 使用RegexRZD和{}

ALL

ALL标记将告诉系统转义和正则表达式检查 接下来是什么。在

无效字符

  • $

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

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

REG

REG标记将告诉系统显式检查给定的 跟随标记的正则表达式。在

RZD

RZD标记将告诉系统显式检查给定的 字符串加上所有可能的TDL。在

反白名单

不喜欢我们的一些规则吗?UHBW允许您指定一个文件,其中包含 不希望应用的规则列表。在

只需使用--anti-whitelist标志来提供一个或多个反白名单 文件和UHBW会服从你的意愿!在

了解UHBW白名单的工作原理

如果您有自己的白名单,包括以下几行:

facebook.com
ALL .gov
REG face
RZD example

UHBW将执行以下操作:

  • 删除匹配facebook.comwww.facebook.com的每一行
  • 在互补中,将所有带ALLREG的行转换为 格式正确。在
  • 删除匹配example.*的每一行
  • 对照正则表达式检查每一行。在下一章中会有更多的介绍。在
  • 在屏幕上打印结果或保存到输出文件-o $output.file。在

从这个例子中生成的正则表达式将是:

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

注意

当我们构造TDL列表时,example组要长得多 基于根区域数据库,IANA和公共后缀列表 项目。**

这意味着UHBW实际上会列出:

  • .gov结尾的所有元素/行
  • 包含单词face的所有元素/行
  • example开头的所有可能的TDL组合

文件格式

域/url的输入文件应该是每行一个域/url,并且最好是排序的。在

sort -u inputfile -o inputfile

工具的使用

脚本可以由uhb-whitelistuhb_whitelistultimate-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)

贡献者

许可证

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.

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
安卓如何在java字符串中获取RATE的值   java ANT在哪里输出编译器错误?   在java中,while循环在何处启动对象   javacom。谷歌。格森。内部的LinkedTreeMap无法强制转换到我的类   java单选按钮。isSelected()方法未返回正确的响应   嵌入式系统中applet中的java相对码基字段   如何在eclipse中将Java应用程序附加到jvm探查器?   java为什么Android应用程序崩溃?   在java中拖放上传后保持文件夹结构   爪哇多领导人选举问题   java Springs RestTemplate如何处理postForEntity()中的错误响应   Java如何用前导零递增整数字符串?   java Android将文本作为图像共享给其他应用程序   Java搜索替换   java isDirectory()不适用于UNIX目录   java我们可以得到显示测试类是否通过或失败的TestNG报告吗   Java类对象排序和分组   简单Java幂递归   java在处理MethodArgumentNotValidException时如何访问请求对象?