From 2b72751113530ecb0217a441f0c03560217ea344 Mon Sep 17 00:00:00 2001 From: "E. S" Date: Fri, 20 Jun 2025 22:01:16 +0300 Subject: [PATCH] update and fix --- composer.json | 2 +- composer.lock | 149 +++++++++++++++++++++--------------- src/ssl_expire_notifier.php | 15 +++- 3 files changed, 103 insertions(+), 63 deletions(-) diff --git a/composer.json b/composer.json index f936c19..a8391ce 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "require": { "ext-openssl": "*", "ext-json": "*", - "io-developer/php-whois": "^4.1" + "datingvip/php-whois": "^4.1" }, "config": { "platform": { diff --git a/composer.lock b/composer.lock index be1e535..f643b29 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "abc998f727883b7b212185e84742fa24", + "content-hash": "fdaab4a8d82e80a5483f0d110540895c", "packages": [ { - "name": "io-developer/php-whois", + "name": "datingvip/php-whois", "version": "4.1.7", "source": { "type": "git", - "url": "https://github.com/io-developer/php-whois.git", - "reference": "6c6cd1d7392d76ba18752cf37227433b50b0bac9" + "url": "https://github.com/DatingVIP/php-whois.git", + "reference": "b54f1b9ad19836913c8868a86113d2d3b9a8d8ef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/io-developer/php-whois/zipball/6c6cd1d7392d76ba18752cf37227433b50b0bac9", - "reference": "6c6cd1d7392d76ba18752cf37227433b50b0bac9", + "url": "https://api.github.com/repos/DatingVIP/php-whois/zipball/b54f1b9ad19836913c8868a86113d2d3b9a8d8ef", + "reference": "b54f1b9ad19836913c8868a86113d2d3b9a8d8ef", "shasum": "" }, "require": { @@ -25,7 +25,7 @@ "ext-json": "*", "ext-mbstring": "*", "php": ">=7.2", - "true/punycode": "^2.1" + "symfony/polyfill-intl-idn": "^1.27" }, "require-dev": { "phpunit/phpunit": "^8.0" @@ -63,42 +63,36 @@ "црщшы" ], "support": { - "issues": "https://github.com/io-developer/php-whois/issues", - "source": "https://github.com/io-developer/php-whois/tree/4.1.7" + "source": "https://github.com/DatingVIP/php-whois/tree/4.1.7" }, - "time": "2022-06-14T10:29:24+00:00" + "time": "2025-02-17T12:46:10+00:00" }, { - "name": "symfony/polyfill-mbstring", - "version": "v1.26.0", + "name": "symfony/polyfill-intl-idn", + "version": "v1.32.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e" + "url": "https://github.com/symfony/polyfill-intl-idn.git", + "reference": "9614ac4d8061dc257ecc64cba1b140873dce8ad3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e", - "reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/9614ac4d8061dc257ecc64cba1b140873dce8ad3", + "reference": "9614ac4d8061dc257ecc64cba1b140873dce8ad3", "shasum": "" }, "require": { - "php": ">=7.1" - }, - "provide": { - "ext-mbstring": "*" + "php": ">=7.2", + "symfony/polyfill-intl-normalizer": "^1.10" }, "suggest": { - "ext-mbstring": "For best performance" + "ext-intl": "For best performance" }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.26-dev" - }, "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -106,7 +100,7 @@ "bootstrap.php" ], "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" + "Symfony\\Polyfill\\Intl\\Idn\\": "" } }, "notification-url": "https://packagist.org/downloads/", @@ -115,25 +109,30 @@ ], "authors": [ { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" + "name": "Laurent Bassin", + "email": "laurent@bassin.info" + }, + { + "name": "Trevor Rowbotham", + "email": "trevor.rowbotham@pm.me" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill for the Mbstring extension", + "description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions", "homepage": "https://symfony.com", "keywords": [ "compatibility", - "mbstring", + "idn", + "intl", "polyfill", "portable", "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.26.0" + "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.32.0" }, "funding": [ { @@ -149,73 +148,103 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:49:31+00:00" + "time": "2024-09-10T14:38:51+00:00" }, { - "name": "true/punycode", - "version": "v2.1.1", + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.32.0", "source": { "type": "git", - "url": "https://github.com/true/php-punycode.git", - "reference": "a4d0c11a36dd7f4e7cd7096076cab6d3378a071e" + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "3833d7255cc303546435cb650316bff708a1c75c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/true/php-punycode/zipball/a4d0c11a36dd7f4e7cd7096076cab6d3378a071e", - "reference": "a4d0c11a36dd7f4e7cd7096076cab6d3378a071e", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/3833d7255cc303546435cb650316bff708a1c75c", + "reference": "3833d7255cc303546435cb650316bff708a1c75c", "shasum": "" }, "require": { - "php": ">=5.3.0", - "symfony/polyfill-mbstring": "^1.3" + "php": ">=7.2" }, - "require-dev": { - "phpunit/phpunit": "~4.7", - "squizlabs/php_codesniffer": "~2.0" + "suggest": { + "ext-intl": "For best performance" }, "type": "library", - "autoload": { - "psr-4": { - "TrueBV\\": "src/" + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { - "name": "Renan Gonçalves", - "email": "renan.saddam@gmail.com" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "A Bootstring encoding of Unicode for Internationalized Domain Names in Applications (IDNA)", - "homepage": "https://github.com/true/php-punycode", + "description": "Symfony polyfill for intl's Normalizer class and related functions", + "homepage": "https://symfony.com", "keywords": [ - "idna", - "punycode" + "compatibility", + "intl", + "normalizer", + "polyfill", + "portable", + "shim" ], "support": { - "issues": "https://github.com/true/php-punycode/issues", - "source": "https://github.com/true/php-punycode/tree/master" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.32.0" }, - "abandoned": true, - "time": "2016-11-16T10:37:54+00:00" + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" } ], "packages-dev": [], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": false, "prefer-lowest": false, "platform": { "ext-openssl": "*", "ext-json": "*" }, - "platform-dev": [], + "platform-dev": {}, "platform-overrides": { "php": "7.4" }, - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } diff --git a/src/ssl_expire_notifier.php b/src/ssl_expire_notifier.php index 2b674cb..3b7f04e 100755 --- a/src/ssl_expire_notifier.php +++ b/src/ssl_expire_notifier.php @@ -21,6 +21,14 @@ if (!file_exists($file)) $now = time(); $config = parse_ini_file($file); +# all TLDs info - here: https://www.iana.org/domains/root/db +$custom_tld_servers = [ + 'in' => 'whois.nixiregistry.in', + 'ws' => 'whois.website.ws', + 'online' => 'whois.nic.online', + 'us' => 'whois.nic.us', +]; + function handle_result(int $type, string $host, int $exp, Logger $logger) { global $now, $config; @@ -118,16 +126,19 @@ function ssl_expire_notifier() { } function whois_expire_notifier() { + global $custom_tld_servers; + $domains = get_top_domains(); foreach ($domains as $domain) { $whois = Factory::get()->createWhois(); - if (preg_match('/\.ws([:]\d+)?$/', $domain)) { - $customServer = new TldServer(".ws", "whois.website.ws", false, Factory::get()->createTldParser()); + if (preg_match('/\.('.implode('|', array_keys($custom_tld_servers)).')([:]\d+)?$/', $domain, $match)) { + $customServer = new TldServer(".".$match[1], $custom_tld_servers[$match[1]], false, Factory::get()->createTldParser()); $whois->getTldModule()->addServers([$customServer]); } $logger = new Logger($domain); + $logger->debug('connecting...'); try { $info = $whois->loadDomainInfo($domain); handle_result(TYPE_WHOIS, $domain, $info->expirationDate, $logger);