slicksky/spam-blacklist-query
Composer 安装命令:
composer require slicksky/spam-blacklist-query
包简介
Find out if a domain or IP is blacklisted on the most popular spam listing services.
关键字:
README 文档
README
This small package helps you find out if a domain or IP is blacklisted on the most popular spam listing services.
Here's how it works:
- Test the input domain against Domain Spam Blacklist services (DNSBL URI):
- APEWS Level 1 (http://www.apews.org/)
- Scientific Spam URI (https://www.scientificspam.net/)
- SEM URI (https://spameatingmonkey.com/)
- SEM URIed (https://spameatingmonkey.com/)
- SORBS URI (http://www.sorbs.net/)
- SpamHaus Zen (https://www.spamhaus.org/zen/)
- SURBL multi (https://surbl.org/)
- URIBL multi (https://uribl.com/)
- Retrieve mail servers for the given domain (MX records).
- Get the list of IPs for each mail servers (A records).
- Test each IP against these IP Spam Blacklist services (DNSBL IP):
- UCEPROTECT (https://www.uceprotect.net/en/)
- DroneBL (https://dronebl.org/)
- SORBS (http://www.sorbs.net/)
- SpamHaus Zen (https://www.spamhaus.org/zen/)
- SpamCop.net (https://www.spamcop.net/)
- DSBL (https://www.dsbl.org/)
Installation
Run this command in your project's root folder
composer require slicksky/blacklist-spam-query
Usage
require 'vendor/autoload.php'; use SlickSky\SpamBlacklistQuery\Domain; // Test a Domain $sampleDomain = 'google.com'; $domainResults = (new Domain($sampleDomain)) ->query(); // returns Collection // Get the listed records only $listedIps = $domainResults->listed(); // returns Collection // Ask if the domain or any IP records are listed $isListed = $domainResults->isListed(); // returns bool
Customizing blacklist services (DNSBL)
There are 4 sets of Blacklists in the Config class:
- Config::BLACKLISTS_IP - used to test IPs
- Config::BLACKLISTS_URI - used to test domains/subdomains
- Config::BLACKLISTS_EXTENDED - mixed list of most popular blacklists
- Config::BLACKLISTS_FULL - mixed list of all blacklists I've found so far In the Config class, you can customize blacklistsIp and/or blacklistsUri. If you omit any, the internal list will be used. If you want to turn off IP or URI queries, pass an empty array to blacklistsIp or blacklistsUri. Blacklist array template: ['service address' => 'name']
use SlickSky\SpamBlacklistQuery\Config; use SlickSky\SpamBlacklistQuery\Domain; $blacklists = new Config( blacklistsIp: ['dnsbl-1.uceprotect.net' => 'UCEPROTECT'], blacklistsUri: ['zen.spamhaus.org' => 'SpamHaus Zen'], ); $domainResults = (new Domain($sampleDomain, $blacklists)) ->query(); // returns Collection
Further customizations
use SlickSky\SpamBlacklistQuery\Blacklist; use SlickSky\SpamBlacklistQuery\Config; use SlickSky\SpamBlacklistQuery\MxIp; // Test a single IP $ip = new MxIp('8.8.8.8'); // Is this IP valid? $isInvalid = $ip->isInvalid(); // returns bool // Query the IP foreach (Config::BLACKLISTS_IP as $serviceHost => $serviceName) { $isListed = $ip->query( new Blacklist($serviceHost, $serviceName, $ip->reverse()), ); // returns bool } // Get the listed state $isListed = $ip->isListed(); // returns bool // Get the blacklists objects and their results $blacklistsResults = $ip->blacklists; // Collection
Results
SlickSky\SpamBlacklistQuery\Result::__set_state([ 'items' => [ SlickSky\SpamBlacklistQuery\MxRecord::__set_state([ 'host' => 'google.com', 'class' => 'IN', 'ttl' => 377, 'type' => 'MX', 'pri' => 10, 'target' => 'smtp.google.com', 'listed' => false, 'blacklists' => SlickSky\SpamBlacklistQuery\Collection::__set_state([ 'items' => [ SlickSky\SpamBlacklistQuery\Blacklist::__set_state([ 'listed' => false, 'host' => 'dnsbl-1.uceprotect.net', 'name' => 'UCEPROTECT', 'ipReverse' => 'google.com', 'responseTime' => 0.012, ]), ], ]), 'ips' => SlickSky\SpamBlacklistQuery\Collection::__set_state([ 'items' => [ SlickSky\SpamBlacklistQuery\MxIp::__set_state([ 'blacklists' => SlickSky\SpamBlacklistQuery\Collection::__set_state([ 'items' => [ SlickSky\SpamBlacklistQuery\Blacklist::__set_state([ 'listed' => false, 'host' => 'dnsbl-1.uceprotect.net', 'name' => 'UCEPROTECT', 'ipReverse' => '27.2.251.142', 'responseTime' => 0.012, ]), ], ]), 'invalid' => false, 'listed' => false, 'ip' => '142.251.2.27', ]), ], ]), ]), ], ])
License
The Spam Blacklist Query is open-sourced software licensed under the MIT license.
slicksky/spam-blacklist-query 适用场景与选型建议
slicksky/spam-blacklist-query 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 32.46k 次下载、GitHub Stars 达 11, 最近一次更新时间为 2023 年 01 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「spam」 「blacklist」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 slicksky/spam-blacklist-query 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 slicksky/spam-blacklist-query 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 slicksky/spam-blacklist-query 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Simple captcha generator
reCAPTCHA library
Client library for reCAPTCHA with proxy support, a free service that protects websites from spam and abuse.
Yii 2 Validator that validates string contents for count, blacklist and whitelist.
Symfony bundle to monitor AWS SES bounces and complaints. Includes SwiftMailer filters.
Display clickable eMail-Adresses without being spamed
统计信息
- 总下载量: 32.46k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 11
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-01-07