klkvsk / whoeasy
通过WHOIS轻松查找域名、IP地址和AS号码。
Requires
- php: >=8.1
Suggests
- ext-curl: *
This package is auto-updated.
Last update: 2024-09-09 10:43:53 UTC
README
通过WHOIS查找域名、IP地址和AS号码。将答案解析成结构化数据。使用代理来对抗速率限制。
安装
通过composer安装(直到1.0,建议使用dev-master而不是发行版本,因为存在bug)
composer install klkvsk/whoeasy=dev-master
使用方法
主要的Whois
类是一个工厂,并提供简写方法。
// get raw text answer $rawText = \Klkvsk\Whoeasy\Whois::getRaw("example.com"); // or with parsing $answer = \Klkvsk\Whoeasy\Whois::getParsed("example.com"); echo $answer->result->registrar->name;
您可以扩展Whois
来自定义工厂,或者您可以直接利用WhoisClient
和WhoisParser
。
Whoeasy易于扩展。您可以添加自己的客户端适配器、解析器、服务器配置、代理提供程序等。
内置的客户端适配器包括
- CurlTelnet - 如果已安装ext-curl,则为默认。支持curl支持的任何代理。
- Socket - 回退,使用
stream_socket_client
。仅支持HTTP(s)-tunnel代理。
WHOIS服务器注册表
默认情况下,客户端将为您的查询选择合适的服务器。服务器列表将自动从https://github.com/rfc1036/whois生成 - 大多数Linux发行版中的默认whois
工具。这是每个tld的正确WHOIS服务器的最新来源。
CLI工具
Whoeasy可以用作命令行工具
$ vendor/bin/whoeasy -h Usage: whoeasy [options] <domain> Options: -s, --server <server> use specified whois server -f, --format <format> output format -v, --verbose show debug output and traces -h, --help show this message Formats: w, raw raw response t, text clean text response (comments removed) r, result structured result object [default] f, fields parsed key-value pairs g, groups key-value pairs split in blocks
待办事项
- 使用RDAP作为替代适配器
- 用自己解析模板替换Novutec解析模板
第三方库
将解析到单个格式结构是基于Novutec WhoisParser
问题
请通过https://github.com/klkvsk/whoeasy/issues报告任何问题
许可和版权
版权(c)2023 Misha Kulakovsky (https://github.com/klkvsk)
根据Apache License 2.0(“许可证”);除非遵守许可证或书面同意,否则不得使用此文件。您可以在以下位置获得许可证副本:
https://apache.ac.cn/licenses/LICENSE-2.0
除非适用法律要求或书面同意,否则在许可证下分发的软件按“原样”提供,不提供任何明示或暗示的保证或条件。请参阅许可证了解具体管理许可证许可和限制的条款。