承接 slicksky/spam-blacklist-query 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

slicksky/spam-blacklist-query

最新稳定版本:v0.2.6

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:

  1. Test the input domain against Domain Spam Blacklist services (DNSBL URI):
  2. Retrieve mail servers for the given domain (MX records).
  3. Get the list of IPs for each mail servers (A records).
  4. Test each IP against these IP Spam Blacklist services (DNSBL IP):

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:

  1. Config::BLACKLISTS_IP - used to test IPs
  2. Config::BLACKLISTS_URI - used to test domains/subdomains
  3. Config::BLACKLISTS_EXTENDED - mixed list of most popular blacklists
  4. 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.

统计信息

  • 总下载量: 32.05k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 11
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 11
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-01-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固