Major WHOIS server update

This commit is contained in:
Pinga 2023-08-07 12:01:41 +03:00
parent 43800b9c15
commit 9fa131f52b
2 changed files with 48 additions and 42 deletions

View file

@ -49,6 +49,7 @@ CREATE TABLE IF NOT EXISTS `registry`.`reserved_domain_names` (
CREATE TABLE IF NOT EXISTS `registry`.`registrar` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`iana_id` int(5) DEFAULT NULL,
`clid` varchar(16) NOT NULL,
`pw` varchar(64) NOT NULL,
`prefix` char(2) NOT NULL,

View file

@ -57,19 +57,15 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) {
// Perform the WHOIS lookup
try {
$query = "SELECT *,
DATE_FORMAT(`crdate`, '%d-%b-%Y %T') AS `crdate`,
DATE_FORMAT(`update`, '%d-%b-%Y %T') AS `update`,
DATE_FORMAT(`exdate`, '%d-%b-%Y %T') AS `exdate`
DATE_FORMAT(`crdate`, '%Y-%m-%dT%H:%i:%sZ') AS `crdate`,
DATE_FORMAT(`update`, '%Y-%m-%dT%H:%i:%sZ') AS `update`,
DATE_FORMAT(`exdate`, '%Y-%m-%dT%H:%i:%sZ') AS `exdate`
FROM `registry`.`domain` WHERE `name` = :domain";
$stmt = $pdo->prepare($query);
$stmt->bindParam(':domain', $domain, PDO::PARAM_STR);
$stmt->execute();
if ($f = $stmt->fetch(PDO::FETCH_ASSOC)) {
if ($f['crdate']) $f['crdate'] .= ' UTC';
if ($f['update']) $f['update'] .= ' UTC';
if ($f['exdate']) $f['exdate'] .= ' UTC';
$query2 = "SELECT `tld` FROM `domain_tld` WHERE `id` = :tldid";
$stmt2 = $pdo->prepare($query2);
$stmt2->bindParam(':tldid', $f['tldid'], PDO::PARAM_INT);
@ -77,7 +73,7 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) {
$tld = $stmt2->fetch(PDO::FETCH_ASSOC);
$query3 = "SELECT `name`,`whois_server`,`url`,`abuse_email`,`abuse_phone` FROM `registrar` WHERE `id` = :clid";
$query3 = "SELECT `name`,`iana_id`,`whois_server`,`url`,`abuse_email`,`abuse_phone` FROM `registrar` WHERE `id` = :clid";
$stmt3 = $pdo->prepare($query3);
$stmt3->bindParam(':clid', $f['clid'], PDO::PARAM_INT);
$stmt3->execute();
@ -86,12 +82,13 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) {
$res = "Domain Name: ".strtoupper($f['name'])
."\nRegistry Domain ID: ".$f['id']
."\nCreated On: ".$f['crdate']
."\nLast Updated On: ".$f['update']
."\nExpiration Date: ".$f['exdate']
."\nRegistrar: ".$clidF['name']
."\nRegistrar WHOIS Server: ".$clidF['whois_server']
."\nRegistrar URL: ".$clidF['url']
."\nUpdated Date: ".$f['update']
."\nCreation Date: ".$f['crdate']
."\nRegistry Expiry Date: ".$f['exdate']
."\nRegistrar: ".$clidF['name']
."\nRegistrar IANA ID: ".$clidF['iana_id']
."\nRegistrar Abuse Contact Email: ".$clidF['abuse_email']
."\nRegistrar Abuse Contact Phone: ".$clidF['abuse_phone'];
@ -101,10 +98,10 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) {
$stmt4->execute();
while ($f2 = $stmt4->fetch(PDO::FETCH_ASSOC)) {
$res .= "\nStatus: ".$f2['status'];
$res .= "\nDomain Status: " . $f2['status'] . " https://icann.org/epp#" . $f2['status'];
}
$query5 = "SELECT contact.identifier,contact_postalInfo.name,contact_postalInfo.org,contact_postalInfo.street1,contact_postalInfo.street2,contact_postalInfo.street3,contact_postalInfo.city,contact_postalInfo.sp,contact_postalInfo.pc,contact_postalInfo.cc,contact.voice,contact.voice_x,contact.fax,contact.fax_x,contact.email
$query5 = "SELECT contact.identifier,contact_postalInfo.name,contact_postalInfo.org,contact_postalInfo.street1,contact_postalInfo.street2,contact_postalInfo.street3,contact_postalInfo.city,contact_postalInfo.sp,contact_postalInfo.pc,contact_postalInfo.cc,contact.voice,contact.fax,contact.email
FROM contact,contact_postalInfo WHERE contact.id=:registrant AND contact_postalInfo.contact_id=contact.id";
$stmt5 = $pdo->prepare($query5);
$stmt5->bindParam(':registrant', $f['registrant'], PDO::PARAM_INT);
@ -114,20 +111,18 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) {
$res .= "\nRegistry Registrant ID: ".$f2['identifier']
."\nRegistrant Name: ".$f2['name']
."\nRegistrant Organization: ".$f2['org']
."\nRegistrant Street1: ".$f2['street1']
."\nRegistrant Street2: ".$f2['street2']
."\nRegistrant Street3: ".$f2['street3']
."\nRegistrant Street: ".$f2['street1']
."\nRegistrant Street: ".$f2['street2']
."\nRegistrant Street: ".$f2['street3']
."\nRegistrant City: ".$f2['city']
."\nRegistrant State/Province: ".$f2['sp']
."\nRegistrant Postal Code: ".$f2['pc']
."\nRegistrant Country: ".$f2['cc']
."\nRegistrant Phone: ".$f2['voice']
."\nRegistrant Phone Ext.: ".$f2['voice_x']
."\nRegistrant FAX: ".$f2['fax']
."\nRegistrant FAX Ext.: ".$f2['fax_x']
."\nRegistrant Fax: ".$f2['fax']
."\nRegistrant Email: ".$f2['email'];
$query6 = "SELECT contact.identifier,contact_postalInfo.name,contact_postalInfo.org,contact_postalInfo.street1,contact_postalInfo.street2,contact_postalInfo.street3,contact_postalInfo.city,contact_postalInfo.sp,contact_postalInfo.pc,contact_postalInfo.cc,contact.voice,contact.voice_x,contact.fax,contact.fax_x,contact.email
$query6 = "SELECT contact.identifier,contact_postalInfo.name,contact_postalInfo.org,contact_postalInfo.street1,contact_postalInfo.street2,contact_postalInfo.street3,contact_postalInfo.city,contact_postalInfo.sp,contact_postalInfo.pc,contact_postalInfo.cc,contact.voice,contact.fax,contact.email
FROM domain_contact_map,contact,contact_postalInfo WHERE domain_contact_map.domain_id=:domain_id AND domain_contact_map.type='admin' AND domain_contact_map.contact_id=contact.id AND domain_contact_map.contact_id=contact_postalInfo.contact_id";
$stmt6 = $pdo->prepare($query6);
$stmt6->bindParam(':domain_id', $f['id'], PDO::PARAM_INT);
@ -137,20 +132,18 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) {
$res .= "\nRegistry Admin ID: ".$f2['identifier']
."\nAdmin Name: ".$f2['name']
."\nAdmin Organization: ".$f2['org']
."\nAdmin Street1: ".$f2['street1']
."\nAdmin Street2: ".$f2['street2']
."\nAdmin Street3: ".$f2['street3']
."\nAdmin Street: ".$f2['street1']
."\nAdmin Street: ".$f2['street2']
."\nAdmin Street: ".$f2['street3']
."\nAdmin City: ".$f2['city']
."\nAdmin State/Province: ".$f2['sp']
."\nAdmin Postal Code: ".$f2['pc']
."\nAdmin Country: ".$f2['cc']
."\nAdmin Phone: ".$f2['voice']
."\nAdmin Phone Ext.: ".$f2['voice_x']
."\nAdmin FAX: ".$f2['fax']
."\nAdmin FAX Ext.: ".$f2['fax_x']
."\nAdmin Fax: ".$f2['fax']
."\nAdmin Email: ".$f2['email'];
$query7 = "SELECT contact.identifier,contact_postalInfo.name,contact_postalInfo.org,contact_postalInfo.street1,contact_postalInfo.street2,contact_postalInfo.street3,contact_postalInfo.city,contact_postalInfo.sp,contact_postalInfo.pc,contact_postalInfo.cc,contact.voice,contact.voice_x,contact.fax,contact.fax_x,contact.email
$query7 = "SELECT contact.identifier,contact_postalInfo.name,contact_postalInfo.org,contact_postalInfo.street1,contact_postalInfo.street2,contact_postalInfo.street3,contact_postalInfo.city,contact_postalInfo.sp,contact_postalInfo.pc,contact_postalInfo.cc,contact.voice,contact.fax,contact.email
FROM domain_contact_map,contact,contact_postalInfo WHERE domain_contact_map.domain_id=:domain_id AND domain_contact_map.type='billing' AND domain_contact_map.contact_id=contact.id AND domain_contact_map.contact_id=contact_postalInfo.contact_id";
$stmt7 = $pdo->prepare($query7);
$stmt7->bindParam(':domain_id', $f['id'], PDO::PARAM_INT);
@ -160,20 +153,18 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) {
$res .= "\nRegistry Billing ID: ".$f2['identifier']
."\nBilling Name: ".$f2['name']
."\nBilling Organization: ".$f2['org']
."\nBilling Street1: ".$f2['street1']
."\nBilling Street2: ".$f2['street2']
."\nBilling Street3: ".$f2['street3']
."\nBilling Street: ".$f2['street1']
."\nBilling Street: ".$f2['street2']
."\nBilling Street: ".$f2['street3']
."\nBilling City: ".$f2['city']
."\nBilling State/Province: ".$f2['sp']
."\nBilling Postal Code: ".$f2['pc']
."\nBilling Country: ".$f2['cc']
."\nBilling Phone: ".$f2['voice']
."\nBilling Phone Ext.: ".$f2['voice_x']
."\nBilling FAX: ".$f2['fax']
."\nBilling FAX Ext.: ".$f2['fax_x']
."\nBilling Fax: ".$f2['fax']
."\nBilling Email: ".$f2['email'];
$query8 = "SELECT contact.identifier,contact_postalInfo.name,contact_postalInfo.org,contact_postalInfo.street1,contact_postalInfo.street2,contact_postalInfo.street3,contact_postalInfo.city,contact_postalInfo.sp,contact_postalInfo.pc,contact_postalInfo.cc,contact.voice,contact.voice_x,contact.fax,contact.fax_x,contact.email
$query8 = "SELECT contact.identifier,contact_postalInfo.name,contact_postalInfo.org,contact_postalInfo.street1,contact_postalInfo.street2,contact_postalInfo.street3,contact_postalInfo.city,contact_postalInfo.sp,contact_postalInfo.pc,contact_postalInfo.cc,contact.voice,contact.fax,contact.email
FROM domain_contact_map,contact,contact_postalInfo WHERE domain_contact_map.domain_id=:domain_id AND domain_contact_map.type='tech' AND domain_contact_map.contact_id=contact.id AND domain_contact_map.contact_id=contact_postalInfo.contact_id";
$stmt8 = $pdo->prepare($query8);
$stmt8->bindParam(':domain_id', $f['id'], PDO::PARAM_INT);
@ -183,17 +174,15 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) {
$res .= "\nRegistry Tech ID: ".$f2['identifier']
."\nTech Name: ".$f2['name']
."\nTech Organization: ".$f2['org']
."\nTech Street1: ".$f2['street1']
."\nTech Street2: ".$f2['street2']
."\nTech Street3: ".$f2['street3']
."\nTech Street: ".$f2['street1']
."\nTech Street: ".$f2['street2']
."\nTech Street: ".$f2['street3']
."\nTech City: ".$f2['city']
."\nTech State/Province: ".$f2['sp']
."\nTech Postal Code: ".$f2['pc']
."\nTech Country: ".$f2['cc']
."\nTech Phone: ".$f2['voice']
."\nTech Phone Ext.: ".$f2['voice_x']
."\nTech FAX: ".$f2['fax']
."\nTech FAX Ext.: ".$f2['fax_x']
."\nTech Fax: ".$f2['fax']
."\nTech Email: ".$f2['email'];
$query9 = "SELECT `name` FROM `domain_host_map`,`host` WHERE `domain_host_map`.`domain_id` = :domain_id AND `domain_host_map`.`host_id` = `host`.`id`";
@ -209,7 +198,23 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) {
$counter++;
}
$res .= "\nDNSSEC: Unsigned";
$query_dnssec = "SELECT EXISTS(SELECT 1 FROM `secdns` WHERE `domain_id` = :domain_id)";
$stmt_dnssec = $pdo->prepare($query_dnssec);
$stmt_dnssec->bindParam(':domain_id', $f['id'], PDO::PARAM_INT);
$stmt_dnssec->execute();
$dnssec_exists = $stmt_dnssec->fetchColumn();
if ($dnssec_exists) {
$res .= "\nDNSSEC: signedDelegation";
} else {
$res .= "\nDNSSEC: unsigned";
}
$res .= "\nURL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf/";
$currentTimestamp = date('Y-m-d\TH:i:s\Z');
$res .= "\n>>> Last update of WHOIS database: {$currentTimestamp} <<<";
$res .= "\n";
$res .= "\nFor more information on Whois status codes, please visit https://icann.org/epp";
$res .= "\n\n";
$res .= "Access to {$tld['tld']} WHOIS information is provided to assist persons in"
."\ndetermining the contents of a domain name registration record in the"