This commit is contained in:
flash 2022-09-25 03:49:30 +00:00
parent 5c3e0c0ea1
commit c9bf8adda3
13 changed files with 2344 additions and 0 deletions

1
public/whois/whois-php/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
vendor/

View file

@ -0,0 +1 @@
preset: psr2

View file

@ -0,0 +1,18 @@
cache:
directories:
- vendor
language: php
php:
- 5.6
- 7.0
- 7.1
matrix:
fast_finish: true
before_install:
- composer install
script: ./vendor/bin/phpunit

View file

@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2016 flashwave <https://flash.moe>
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.

View file

@ -0,0 +1,7 @@
# whois-php
[![Build Status](https://api.travis-ci.org/flashwave/whois-php.svg)](https://travis-ci.org/flashwave/whois-php)
[![Style Check](https://styleci.io/repos/42394993/shield)](https://styleci.io/repos/42394993)
[![Latest Version](https://poser.pugx.org/flashwave/whois-php/v/stable)](https://packagist.org/packages/flashwave/whois-php)
[![License](https://poser.pugx.org/flashwave/whois-php/license)](https://packagist.org/packages/flashwave/whois-php)
Whois Query thing in PHP with "portable" class.

View file

@ -0,0 +1,30 @@
{
"name": "flashwave/whois-php",
"description": "Whois client library for PHP",
"keywords": ["flashwave", "whois", "php"],
"type": "library",
"license": "MIT",
"support": {
"email": "me@flash.moe",
"issues": "https://github.com/flashwave/whois-php/issues",
"source": "https://github.com/flashwave/whois-php"
},
"authors": [
{
"name": "Julian van de Groep",
"email": "me@flash.moe",
"homepage": "https://flash.moe"
}
],
"autoload": {
"psr-4": {
"Whois\\": "src/Whois/"
}
},
"require": {
"php": ">=5.6"
},
"require-dev": {
"phpunit/phpunit": "5.5.*"
}
}

1327
public/whois/whois-php/composer.lock generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false">
<testsuites>
<testsuite name="Application Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>
</phpunit>

View file

@ -0,0 +1,234 @@
<?php
namespace Whois;
class Client
{
/**
* Container for the Servers class.
*
* @var Servers
*/
private $servers;
/**
* Constructor.
*
* @param Servers $servers Class containing the Whois servers.
*/
public function __construct(Servers $servers = null)
{
// Check if $servers is null
if ($servers == null) {
// Assign the standard Servers class
$servers = Servers::class;
}
// Apply the servers
$this->servers = new $servers;
}
/**
* Loop up a target (ip/domain) on whois
*
* @param string $target The target domain/ip.
*
* @throws WhoisException if the given target doesn't validate as an IP or domain.
*
* @return Result The response from the whois server
*/
public function lookup($target)
{
// Check if IP
if (filter_var($target, FILTER_VALIDATE_IP)) {
return $this->lookupIP($target);
}
// Check if domain
if ($this->verifyDomainName($target)) {
return $this->lookupDomain($target);
}
// Throw an error if both are false
throw new WhoisException('The target supplied does not appear to be a valid IP or domain name.');
}
private function lookupDomain($target)
{
// Make target completely lowercase
$target = strtolower($target);
// Split the dots
$targetSplit = explode('.', $target);
// Create server variable
$server = null;
// Select a server
while (count($targetSplit)) {
// Glue array
$tld = implode('.', $targetSplit);
// Check if it exists in the tld servers variable
if (array_key_exists($tld, $this->servers->tld)) {
$server = $this->servers->tld[$tld];
break;
}
// Remove first entry
array_shift($targetSplit);
}
// If we get here and $server is still null throw an exception
if ($server === null) {
throw new WhoisException('No whois server found for this domain.');
}
// Create a Result object
$result = new Result();
// Set the domain
$result->target = $target;
// Set the type
$result->type = 'domain';
// Create responses container
$responses = [];
// Query the server
$response = $this->query($target, $server);
// Process the data if anything was returned
if ($response) {
// Add the response to the array
$responses[$server] = $response;
// Check if there's a secondary whois server
if ($position = strpos(strtolower($response), 'whois server:')) {
// Grab the uri from the response
preg_match("/whois server: (.*)/", strtolower($response), $matches);
// Check if it's not the same server
if (isset($matches[1]) && trim(strtolower($server)) !== trim($matches[1])) {
// Set the secondary server
$second = trim($matches[1]);
// Do a query
$response = $this->query($target, $second);
// Check if that was something
if ($response) {
// Add it to the responses
$responses[$second] = $response;
}
}
}
}
// Set the count
$result->count = count($responses);
// Set the responses
$result->responses = array_reverse($responses);
// Return the result
return $result;
}
/**
* Whois an IP address.
*
* @param string $address The IP address to query.
*
* @return Result The whois results.
*/
private function lookupIP($address)
{
// Create the responses storage array
$responses = [];
// Query every server in the IP list
foreach ($this->servers->ip as $server) {
// Check if we haven't queried this server yet
if (array_key_exists($server, $responses)) {
continue;
}
// Query the server
$responses[$server] = $this->query($address, $server);
}
// Create a result object
$result = new Result();
// Set target
$result->target = $address;
// Set the type
$result->type = 'ip';
// Set response count
$result->count = count($responses);
// Set responses
$result->responses = array_reverse($responses);
// Return the Result object
return $result;
}
/**
* Validates a domain name.
*
* @param string $domain The string to validate as a domain.
*
* @return bool will be positive if the string is a domain.
*/
private function verifyDomainName($domain)
{
return (preg_match("/^([a-z\d](-*[a-z\d])*)(\.([a-z\d](-*[a-z\d])*))*$/i", $domain) // Valid chars check
&& preg_match("/^.{1,253}$/", $domain) // Overall length check
&& preg_match("/^[^\.]{1,63}(\.[^\.]{1,63})*$/", $domain)); // Length of each label
}
/**
* Query the whois server.
*
* @param string $target The target IP/domain.
* @param string $server The server to be queried.
* @param int $port The port for the whois server.
* @param int $timeout The timeout.
*
* @throws WhoisException if the socket failed to open.
*
* @return string The response from the whois server.
*/
private function query($target, $server, $port = 43, $timeout = 5)
{
// Create the socket
$sock = @fsockopen($server, $port, $errno, $errstr, $timeout);
// Check for errors
if (!$sock) {
// Throw an exception with the error string
throw new WhoisException($errstr);
}
// Write the target to the socket
fwrite($sock, $target . "\r\n");
// Create storage variable
$response = '';
// Await output
while ($line = fgets($sock)) {
$response .= $line;
}
// Close the socket
fclose($sock);
// Return the response
return $response;
}
}

View file

@ -0,0 +1,34 @@
<?php
namespace Whois;
class Result
{
/**
* The target whois domain/ip.
*
* @var string
*/
public $target = '';
/**
* The amount of whois results.
*
* @var int
*/
public $count = 0;
/**
* The results in order from last to first
*
* @var array
*/
public $responses = [];
/**
* The result type.
* Possible values are empty, domain and ip.
*
* @var string
*/
public $type = 'empty';
}

View file

@ -0,0 +1,612 @@
<?php
namespace Whois;
class Servers
{
public $tld = [
'abogado' => 'whois.nic.ac',
'ac' => 'whois.nic.ac',
'academy' => 'whois.donuts.co',
'accountants' => 'whois.donuts.co',
'active' => 'whois.afilias-srs.net',
'actor' => 'whois.unitedtld.com',
'actor' => 'whois.unitedtld.com',
'ad' => 'whois.ripe.net',
'ae' => 'whois.nic.ae',
'aero' => 'whois.aero',
'af' => 'whois.nic.af',
'ag' => 'whois.nic.ag',
'agency' => 'whois.donuts.co',
'ai' => 'whois.ai',
'airforce' => 'whois.unitedtld.com',
'al' => 'whois.ripe.net',
'allfinanz' => 'whois.ksregistry.net',
'alsace' => 'whois-alsace.nic.fr',
'am' => 'whois.amnic.net',
'army' => 'whois.rightside.co',
'arpa' => 'whois.iana.org',
'as' => 'whois.nic.as',
'asia' => 'whois.nic.asia',
'associates' => 'whois.donuts.co',
'at' => 'whois.nic.at',
'attorney' => 'whois.rightside.co',
'au' => 'whois.audns.net.au',
'auction' => 'whois.unitedtld.com',
'audio' => 'whois.uniregistry.net',
'autos' => 'whois.afilias-srs.net',
'aw' => 'whois.nic.aw',
'ax' => 'whois.ax',
'az' => 'whois.ripe.net',
'band' => 'whois.rightside.co',
'bar' => 'whois.nic.bar',
'bargains' => 'whois.donuts.co',
'bayern' => 'whois-dub.mm-registry.com',
'be' => 'whois.dns.be',
'beer' => 'whois-dub.mm-registry.com',
'berlin' => 'whois.nic.berlin',
'best' => 'whois.nic.best',
'bg' => 'whois.register.bg',
'bi' => 'whois.nic.bi',
'bike' => 'whois.donuts.co',
'bio' => 'whois.ksregistry.net',
'biz' => 'whois.biz',
'bj' => 'whois.nic.bj',
'black' => 'whois.afilias.net',
'blackfriday' => 'whois.uniregistry.net',
'blue' => 'whois.afilias.net',
'bmw' => 'whois.ksregistry.net',
'bn' => 'whois.bn',
'bnpparibas' => 'whois.afilias-srs.net',
'bo' => 'whois.nic.bo',
'boo' => 'domain-registry-whois.l.google.com',
'boutique' => 'whois.donuts.co',
'br' => 'whois.nic.br',
'brussels' => 'whois.nic.brussels',
'bt' => 'whois.netnames.net',
'budapest' => 'whois-dub.mm-registry.com',
'build' => 'whois.nic.build',
'builders' => 'whois.donuts.co',
'business' => 'whois.donuts.co',
'business' => 'whois.donuts.co',
'bw' => 'whois.nic.net.bw',
'by' => 'whois.cctld.by',
'bz' => 'whois.belizenic.bz',
'bzh' => 'whois-bzh.nic.fr',
'ca' => 'whois.cira.ca',
'cab' => 'whois.donuts.co',
'cal' => 'domain-registry-whois.l.google.com',
'camera' => 'whois.donuts.co',
'camp' => 'whois.donuts.co',
'cancerresearch' => 'whois.nic.cancerresearch',
'capetown' => 'capetown-whois.registry.net.za',
'capital' => 'whois.donuts.co',
'cards' => 'whois.donuts.co',
'care' => 'whois.donuts.co',
'career' => 'whois.nic.career',
'careers' => 'whois.donuts.co',
'casa' => 'whois-dub.mm-registry.com',
'cash' => 'whois.donuts.co',
'cat' => 'whois.cat',
'catering' => 'whois.donuts.co',
'cc' => 'ccwhois.verisign-grs.com',
'cd' => 'whois.nic.cd',
'center' => 'whois.donuts.co',
'ceo' => 'whois.nic.ceo',
'cern' => 'whois.afilias-srs.net',
'cf' => 'whois.dot.cf',
'ch' => 'whois.nic.ch',
'channel' => 'domain-registry-whois.l.google.com',
'cheap' => 'whois.donuts.co',
'christmas' => 'whois.uniregistry.net',
'chrome' => 'domain-registry-whois.l.google.com',
'church' => 'whois.donuts.co',
'ci' => 'whois.nic.ci',
'city' => 'whois.donuts.co',
'ck' => 'whois.nic.ck',
'cl' => 'whois.nic.cl',
'claims' => 'whois.donuts.co',
'cleaning' => 'whois.donuts.co',
'click' => 'whois.uniregistry.net',
'clinic' => 'whois.donuts.co',
'clothing' => 'whois.donuts.co',
'club' => 'whois.nic.club',
'cn' => 'whois.cnnic.net.cn',
'co' => 'whois.co',
'codes' => 'whois.donuts.co',
'coffee' => 'whois.donuts.co',
'college' => 'whois.centralnic.com',
'cologne' => 'whois-fe1.pdt.cologne.tango.knipp.de',
'com' => 'whois.verisign-grs.com',
'community' => 'whois.donuts.co',
'company' => 'whois.donuts.co',
'computer' => 'whois.donuts.co',
'condos' => 'whois.donuts.co',
'construction' => 'whois.donuts.co',
'consulting' => 'whois.unitedtld.com',
'contractors' => 'whois.donuts.co',
'cooking' => 'whois-dub.mm-registry.com',
'cool' => 'whois.donuts.co',
'coop' => 'whois.nic.coop',
'country' => 'whois-dub.mm-registry.com',
'credit' => 'whois.donuts.co',
'creditcard' => 'whois.donuts.co',
'cruises' => 'whois.donuts.co',
'cuisinella' => 'whois.nic.cuisinella',
'cx' => 'whois.nic.cx',
'cymru' => 'whois.nic.cymru',
'cz' => 'whois.nic.cz',
'dad' => 'domain-registry-whois.l.google.com',
'dance' => 'whois.unitedtld.com',
'dating' => 'whois.donuts.co',
'day' => 'domain-registry-whois.l.google.com',
'de' => 'whois.denic.de',
'deals' => 'whois.donuts.co',
'democrat' => 'whois.rightside.co',
'degree' => 'whois.unitedtld.com',
'dental' => 'whois.donuts.co',
'dentist' => 'whois.rightside.co',
'desi' => 'whois.ksregistry.net',
'diamonds' => 'whois.donuts.co',
'diet' => 'whois.uniregistry.net',
'digital' => 'whois.donuts.co',
'direct' => 'whois.donuts.co',
'directory' => 'whois.donuts.co',
'discount' => 'whois.donuts.co',
'dk' => 'whois.dk-hostmaster.dk',
'dm' => 'whois.nic.dm',
'domains' => 'whois.donuts.co',
'durban' => 'durban-whois.registry.net.za',
'dvag' => 'whois.ksregistry.net',
'dz' => 'whois.nic.dz',
'eat' => 'domain-registry-whois.l.google.com',
'ec' => 'whois.nic.ec',
'edu' => 'whois.educause.edu',
'education' => 'whois.donuts.co',
'ee' => 'whois.eenet.ee',
'eg' => 'whois.ripe.net',
'email' => 'whois.donuts.co',
'engineer' => 'whois.rightside.co',
'engineering' => 'whois.donuts.co',
'enterprises' => 'whois.donuts.co',
'equipment' => 'whois.donuts.co',
'es' => 'whois.nic.es',
'esq' => 'domain-registry-whois.l.google.com',
'estate' => 'whois.donuts.co',
'eu' => 'whois.eu',
'eus' => 'whois.eus.coreregistry.net',
'events' => 'whois.donuts.co',
'exchange' => 'whois.donuts.co',
'expert' => 'whois.donuts.co',
'exposed' => 'whois.donuts.co',
'fail' => 'whois.donuts.co',
'farm' => 'whois.donuts.co',
'feedback' => 'whois.centralnic.com',
'fi' => 'whois.ficora.fi',
'finance' => 'whois.donuts.co',
'financial' => 'whois.donuts.co',
'fish' => 'whois.donuts.co',
'fishing' => 'whois-dub.mm-registry.com',
'fitness' => 'whois.donuts.co',
'flights' => 'whois.donuts.co',
'florist' => 'whois.donuts.co',
'flsmidth' => 'whois.ksregistry.net',
'fly' => 'domain-registry-whois.l.google.com',
'fo' => 'whois.nic.fo',
'foo' => 'domain-registry-whois.l.google.com',
'forsale' => 'whois.unitedtld.com',
'foundation' => 'whois.donuts.co',
'fr' => 'whois.nic.fr',
'frl' => 'whois.nic.frl',
'frogans' => 'whois-frogans.nic.fr',
'fund' => 'whois.donuts.co',
'furniture' => 'whois.donuts.co',
'futbol' => 'whois.unitedtld.com',
'gal' => 'whois.gal.coreregistry.net',
'gallery' => 'whois.donuts.co',
'gbiz' => 'domain-registry-whois.l.google.com',
'gd' => 'whois.nic.gd',
'gent' => 'whois.nic.gent',
'gg' => 'whois.channelisles.net',
'gi' => 'whois2.afilias-grs.net',
'gift' => 'whois.uniregistry.net',
'gifts' => 'whois.donuts.co',
'gives' => 'whois.rightside.co',
'gl' => 'whois.nic.gl',
'glass' => 'whois.donuts.co',
'gle' => 'domain-registry-whois.l.google.com',
'global' => 'whois.afilias-srs.net',
'globo' => 'whois.gtlds.nic.br',
'gmail' => 'domain-registry-whois.l.google.com',
'gmx' => 'whois-fe1.gmx.tango.knipp.de',
'google' => 'domain-registry-whois.l.google.com',
'gop' => 'whois-cl01.mm-registry.com',
'gov' => 'whois.nic.gov',
'gq' => 'whois.dominio.gq',
'gr' => 'whois.ripe.net',
'gratis' => 'whois.donuts.co',
'green' => 'whois.afilias.net',
'gripe' => 'whois.donuts.co',
'gs' => 'whois.nic.gs',
'guide' => 'whois.donuts.co',
'guitars' => 'whois.uniregistry.net',
'guru' => 'whois.donuts.co',
'gy' => 'whois.registry.gy',
'hamburg' => 'whois.nic.hamburg',
'haus' => 'whois.unitedtld.com',
'healthcare' => 'whois.donuts.co',
'help' => 'whois.uniregistry.net',
'here' => 'domain-registry-whois.l.google.com',
'hiphop' => 'whois.uniregistry.net',
'hiv' => 'whois.afilias-srs.net',
'hk' => 'whois.hkirc.hk',
'hn' => 'whois.nic.hn',
'holdings' => 'whois.donuts.co',
'holiday' => 'whois.donuts.co',
'homes' => 'whois.afilias-srs.net',
'horse' => 'whois-dub.mm-registry.com',
'host' => 'whois.nic.host',
'hosting' => 'whois.uniregistry.net',
'house' => 'whois.donuts.co',
'how' => 'domain-registry-whois.l.google.com',
'hr' => 'whois.dns.hr',
'ht' => 'whois.nic.ht',
'hu' => 'whois.nic.hu',
'ibm' => 'whois.nic.ibm',
'id' => 'whois.pandi.or.id',
'ie' => 'whois.domainregistry.ie',
'il' => 'whois.isoc.org.il',
'im' => 'whois.nic.im',
'immo' => 'whois.donuts.co',
'immobilien' => 'whois.unitedtld.com',
'in' => 'whois.inregistry.net',
'industries' => 'whois.donuts.co',
'info' => 'whois.afilias.net',
'ing' => 'domain-registry-whois.l.google.com',
'ink' => 'whois.centralnic.com',
'institute' => 'whois.donuts.co',
'insure' => 'whois.donuts.co',
'int' => 'whois.iana.org',
'international' => 'whois.donuts.co',
'investments' => 'whois.donuts.co',
'io' => 'whois.nic.io',
'iq' => 'whois.cmc.iq',
'ir' => 'whois.nic.ir',
'is' => 'whois.isnic.is',
'it' => 'whois.nic.it',
'je' => 'whois.channelisles.net',
'jobs' => 'jobswhois.verisign-grs.com',
'joburg' => 'joburg-whois.registry.net.za',
'jp' => 'whois.jprs.jp',
'juegos' => 'whois.uniregistry.net',
'kaufen' => 'whois.unitedtld.com',
'ke' => 'whois.kenic.or.ke',
'kg' => 'www.domain.kg',
'ki' => 'whois.nic.ki',
'kim' => 'whois.afilias.net',
'kitchen' => 'whois.donuts.co',
'kiwi' => 'whois.nic.kiwi',
'koeln' => 'whois-fe1.pdt.koeln.tango.knipp.de',
'kr' => 'whois.kr',
'krd' => 'whois.aridnrs.net.au',
'kz' => 'whois.nic.kz',
'la' => 'whois.nic.la',
'lacaixa' => 'whois.nic.lacaixa',
'land' => 'whois.donuts.co',
'lawyer' => 'whois.rightside.co',
'lease' => 'whois.donuts.co',
'lgbt' => 'whois.afilias.net',
'li' => 'whois.nic.li',
'life' => 'whois.donuts.co',
'lighting' => 'whois.donuts.co',
'limited' => 'whois.donuts.co',
'limo' => 'whois.donuts.co',
'link' => 'whois.uniregistry.net',
'loans' => 'whois.donuts.co',
'london' => 'whois-lon.mm-registry.com',
'lotto' => 'whois.afilias.net',
'love' => 'whois.nic.love',
'lt' => 'whois.domreg.lt',
'ltda' => 'whois.afilias-srs.net',
'lu' => 'whois.dns.lu',
'luxe' => 'whois-dub.mm-registry.com',
'luxury' => 'whois.nic.luxury',
'lv' => 'whois.nic.lv',
'ly' => 'whois.nic.ly',
'ma' => 'whois.iam.net.ma',
'maison' => 'whois.donuts.co',
'management' => 'whois.donuts.co',
'mango' => 'whois.mango.coreregistry.net',
'market' => 'whois.rightside.co',
'marketing' => 'whois.donuts.co',
'md' => 'whois.nic.md',
'me' => 'whois.nic.me',
'media' => 'whois.donuts.co',
'meet' => 'whois.afilias.net',
'melbourne' => 'whois.aridnrs.net.au',
'meme' => 'domain-registry-whois.l.google.com',
'menu' => 'whois.nic.menu',
'mg' => 'whois.nic.mg',
'miami' => 'whois-dub.mm-registry.com',
'mil' => 'whois.internic.net',
'mini' => 'whois.ksregistry.net',
'mk' => 'whois.marnet.mk',
'ml' => 'whois.dot.ml',
'mn' => 'whois.nic.mn',
'mo' => 'whois.monic.mo',
'mobi' => 'whois.dotmobiregistry.net',
'moda' => 'whois.unitedtld.com',
'moe' => 'whois.nic.moe',
'monash' => 'whois.nic.monash',
'mortgage' => 'whois.rightside.co',
'moscow' => 'whois.nic.moscow',
'motorcycles' => 'whois.afilias-srs.net',
'mov' => 'domain-registry-whois.l.google.com',
'mp' => 'whois.nic.mp',
'ms' => 'whois.nic.ms',
'mu' => 'whois.nic.mu',
'museum' => 'whois.museum',
'mx' => 'whois.mx',
'my' => 'whois.mynic.my',
'mz' => 'whois.nic.mz',
'na' => 'whois.na-nic.com.na',
'name' => 'whois.nic.name',
'navy' => 'whois.rightside.co',
'nc' => 'whois.nc',
'net' => 'whois.verisign-grs.net',
'network' => 'whois.donuts.co',
'new' => 'domain-registry-whois.l.google.com',
'nexus' => 'domain-registry-whois.l.google.com',
'nf' => 'whois.nic.nf',
'ng' => 'whois.nic.net.ng',
'ngo' => 'whois.publicinterestregistry.net',
'ninja' => 'whois.unitedtld.com',
'nl' => 'whois.domain-registry.nl',
'no' => 'whois.norid.no',
'nra' => 'whois.afilias-srs.net',
'nrw' => 'whois.nic.nrw',
'nu' => 'whois.nic.nu',
'nz' => 'whois.srs.net.nz',
'om' => 'whois.registry.om',
'one' => 'whois.nic.one',
'ong' => 'whois.publicinterestregistry.net',
'onl' => 'whois.afilias-srs.net',
'ooo' => 'whois.nic.ooo',
'org' => 'whois.pir.org',
'organic' => 'whois.afilias.net',
'ovh' => 'whois-ovh.nic.fr',
'paris' => 'whois-paris.nic.fr',
'partners' => 'whois.donuts.co',
'parts' => 'whois.donuts.co',
'pe' => 'kero.yachay.pe',
'pf' => 'whois.registry.pf',
'photo' => 'whois.uniregistry.net',
'photography' => 'whois.donuts.co',
'photos' => 'whois.donuts.co',
'physio' => 'whois.nic.physio',
'pics' => 'whois.uniregistry.net',
'pictures' => 'whois.donuts.co',
'pink' => 'whois.afilias.net',
'pizza' => 'whois.donuts.co',
'pl' => 'whois.dns.pl',
'place' => 'whois.donuts.co',
'plumbing' => 'whois.donuts.co',
'pm' => 'whois.nic.pm',
'pohl' => 'whois.ksregistry.net',
'poker' => 'whois.afilias.net',
'post' => 'whois.dotpostregistry.net',
'pr' => 'whois.nic.pr',
'press' => 'whois.nic.press',
'pro' => 'whois.nic.pro',
'prod' => 'domain-registry-whois.l.google.com',
'productions' => 'whois.donuts.co',
'prof' => 'domain-registry-whois.l.google.com',
'properties' => 'whois.donuts.co',
'property' => 'whois.uniregistry.net',
'pt' => 'whois.dns.pt',
'pub' => 'whois.unitedtld.com',
'pw' => 'whois.nic.pw',
'qa' => 'whois.registry.qa',
'quebec' => 'whois.quebec.rs.corenic.net',
're' => 'whois.nic.re',
'recipes' => 'whois.donuts.co',
'red' => 'whois.afilias.net',
'rehab' => 'whois.rightside.co',
'reise' => 'whois.nic.reise',
'reisen' => 'whois.donuts.co',
'rentals' => 'whois.donuts.co',
'repair' => 'whois.donuts.co',
'report' => 'whois.donuts.co',
'republican' => 'whois.rightside.co',
'rest' => 'whois.centralnic.com',
'restaurant' => 'whois.donuts.co',
'reviews' => 'whois.unitedtld.com',
'rich' => 'whois.afilias-srs.net',
'rio' => 'whois.gtlds.nic.br',
'rip' => 'whois.rightside.co',
'ro' => 'whois.rotld.ro',
'rocks' => 'whois.unitedtld.com',
'rodeo' => 'whois-dub.mm-registry.com',
'rs' => 'whois.rnids.rs',
'rsvp' => 'domain-registry-whois.l.google.com',
'ru' => 'whois.ripn.net',
'ruhr' => 'whois.nic.ruhr',
'sa' => 'whois.nic.net.sa',
'saarland' => 'whois.ksregistry.net',
'sarl' => 'whois.donuts.co',
'sb' => 'whois.nic.net.sb',
'sc' => 'whois2.afilias-grs.net',
'sca' => 'whois.nic.scb',
'schmidt' => 'whois.nic.schmidt',
'schule' => 'whois.donuts.co',
'scot' => 'whois.scot.coreregistry.net',
'se' => 'whois.iis.se',
'services' => 'whois.donuts.co',
'sexy' => 'whois.uniregistry.net',
'sg' => 'whois.nic.net.sg',
'sh' => 'whois.nic.sh',
'shiksha' => 'whois.afilias.net',
'shoes' => 'whois.donuts.co',
'si' => 'whois.arnes.si',
'singles' => 'whois.donuts.co',
'sk' => 'whois.sk-nic.sk',
'sm' => 'whois.nic.sm',
'sn' => 'whois.nic.sn',
'so' => 'whois.nic.so',
'social' => 'whois.unitedtld.com',
'software' => 'whois.rightside.co',
'solar' => 'whois.donuts.co',
'solutions' => 'whois.donuts.co',
'soy' => 'domain-registry-whois.l.google.com',
'space' => 'whois.nic.space',
'spiegel' => 'whois.ksregistry.net',
'st' => 'whois.nic.st',
'store' => 'whois.nic.store',
'su' => 'whois.tcinet.ru',
'supplies' => 'whois.donuts.co',
'supply' => 'whois.donuts.co',
'support' => 'whois.donuts.co',
'surf' => 'whois-dub.mm-registry.com',
'surgery' => 'whois.donuts.co',
'sx' => 'whois.sx',
'sy' => 'whois.tld.sy',
'systems' => 'whois.donuts.co',
'tatar' => 'whois.nic.tatar',
'tattoo' => 'whois.uniregistry.net',
'tax' => 'whois.donuts.co',
'tc' => 'whois.meridiantld.net',
'technology' => 'whois.donuts.co',
'tel' => 'whois.nic.tel',
'tf' => 'whois.nic.tf',
'th' => 'whois.thnic.co.th',
'tienda' => 'whois.donuts.co',
'tips' => 'whois.donuts.co',
'tirol' => 'whois.nic.tirol',
'tj' => 'whois.nic.tj',
'tk' => 'whois.dot.tk',
'tl' => 'whois.nic.tl',
'tm' => 'whois.nic.tm',
'tn' => 'whois.ati.tn',
'to' => 'whois.tonic.to',
'today' => 'whois.donuts.co',
'tools' => 'whois.donuts.co',
'top' => 'whois.nic.top',
'town' => 'whois.donuts.co',
'toys' => 'whois.donuts.co',
'tp' => 'whois.nic.tl',
'tr' => 'whois.nic.tr',
'training' => 'whois.donuts.co',
'travel' => 'whois.nic.travel',
'tui' => 'whois.ksregistry.net',
'tv' => 'tvwhois.verisign-grs.com',
'tw' => 'whois.twnic.net.tw',
'tz' => 'whois.tznic.or.tz',
'ua' => 'whois.ua',
'ug' => 'whois.co.ug',
'uk' => 'whois.nic.uk',
'university' => 'whois.donuts.co',
'uol' => 'whois.gtlds.nic.br',
'us' => 'whois.nic.us',
'uy' => 'whois.nic.org.uy',
'uz' => 'whois.cctld.uz',
'vacations' => 'whois.donuts.co',
'vc' => 'whois2.afilias-grs.net',
've' => 'whois.nic.ve',
'vegas' => 'whois.afilias-srs.net',
'ventures' => 'whois.donuts.co',
'vermögensberater' => 'whois.ksregistry.net',
'vermögensberatung' => 'whois.ksregistry.net',
'versicherung' => 'whois.nic.versicherung',
'vet' => 'whois.rightside.co',
'vg' => 'ccwhois.ksregistry.net',
'viajes' => 'whois.donuts.co',
'villas' => 'whois.donuts.co',
'vision' => 'whois.donuts.co',
'vlaanderen' => 'whois.nic.vlaanderen',
'vodka' => 'whois-dub.mm-registry.com',
'vote' => 'whois.afilias.net',
'voting' => 'whois.voting.tld-box.at',
'voto' => 'whois.afilias.net',
'voyage' => 'whois.donuts.co',
'vu' => 'vunic.vu',
'wf' => 'whois.nic.wf',
'wales' => 'whois.nic.wales',
'wang' => 'whois.gtld.knet.cn',
'watch' => 'whois.donuts.co',
'website' => 'whois.nic.website',
'wed' => 'whois.nic.wed',
'wedding' => 'whois-dub.mm-registry.com',
'wf' => 'whois.nic.wf',
'wien' => 'whois.nic.wien',
'wiki' => 'whois.nic.wiki',
'wme' => 'whois.centralnic.com',
'work' => 'whois-dub.mm-registry.com',
'works' => 'whois.donuts.co',
'world' => 'whois.donuts.co',
'ws' => 'whois.website.ws',
'wtc' => 'whois.nic.wtc',
'wtf' => 'whois.donuts.co',
'xxx' => 'whois.nic.xxx',
'xyz' => 'whois.nic.xyz',
'yachts' => 'whois.afilias-srs.net',
'yoga' => 'whois-dub.mm-registry.com',
'youtube' => 'domain-registry-whois.l.google.com',
'yt' => 'whois.nic.yt',
'zip' => 'domain-registry-whois.l.google.com',
'zm' => 'whois.nic.zm',
'zone' => 'whois.donuts.co',
'дети' => 'whois.nic.xn--d1acj3b',
'москва' => 'whois.nic.xn--80adxhks',
'онлайн' => 'whois.online.rs.corenic.net',
'орг' => 'whois.publicinterestregistry.net',
'рус' => 'whois.nic.xn--p1acf',
'рф' => 'whois.tcinet.ru',
'сайт' => 'whois.site.rs.corenic.net',
'укр' => 'whois.dotukr.com',
'қаз' => 'whois.nic.kz',
'الجزائر' => 'whois.nic.dz',
'السعودية' => 'whois.nic.net.sa',
'امارات' => 'whois.aeda.net.ae',
'ایران' => 'whois.nic.ir',
'بازار' => 'whois.bazaar.coreregistry.net',
'سورية' => 'whois.tld.sy',
'شبكة' => 'whois.nic.xn--ngbc5azd',
'عمان' => 'whois.registry.om',
'قطر' => 'whois.registry.qa',
'مليسيا' => 'whois.mynic.my',
'موقع' => 'whois.afilias-srs.net',
'சிங்கப்பூர்' => 'whois.sgnic.sg',
'ไทย' => 'whois.thnic.co.th',
'みんな' => 'domain-registry-whois.l.google.com',
'中信' => 'whois.gtld.knet.cn',
'中国' => 'cwhois.cnnic.cn',
'中國' => 'cwhois.cnnic.cn',
'中文网' => 'whois.afilias-srs.net',
'企业' => 'whois.donuts.co',
'佛山' => 'whois.ngtld.cn',
'公司' => 'whois.ngtld.cn',
'公益' => 'whois.conac.cn',
'台湾' => 'whois.twnic.net.tw',
'台灣' => 'whois.twnic.net.tw',
'商城' => 'whois.gtld.knet.cn',
'在线' => 'whois.afilias-srs.net',
'广东' => 'whois.ngtld.cn',
'我爱你' => 'whois.gtld.knet.cn',
'手机' => 'whois.afilias-srs.net',
'政务' => 'whois.conac.cn',
'新加坡' => 'whois.sgnic.sg',
'新加坡' => 'whois.sgnic.sg',
'游戏' => 'whois.donuts.co',
'移动' => 'whois.afilias.net',
'组织机构' => 'whois.publicinterestregistry.net',
'网络' => 'whois.ngtld.cn',
'集团' => 'whois.gtld.knet.cn',
'香港' => 'whois.hkirc.hk',
];
public $ip = [
'whois.lacnic.net',
'whois.apnic.net',
'whois.arin.net',
'whois.ripe.net',
];
}

View file

@ -0,0 +1,8 @@
<?php
namespace Whois;
use Exception;
class WhoisException extends Exception
{
}

View file

@ -0,0 +1,33 @@
<?php
use PHPUnit\Framework\TestCase;
use Whois\Client as WhoisClient;
class WhoisTest extends TestCase
{
private static $client;
public function testCreate()
{
static::$client = new WhoisClient;
}
public function testDomain()
{
static::$client->lookup('flash.moe');
}
public function testIP()
{
static::$client->lookup('8.8.8.8');
static::$client->lookup('2001:4860:4860::8888');
}
/**
* @expectedException \Whois\WhoisException
*/
public function testException()
{
static::$client->lookup('not a domain');
}
}