| 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 : |
<?php
/**
* URL-/HTTP-/TLS-Sicherheitsanalyse → GET /api/v1/urlcheck.php?url=https://example.com
*
* Redirect-Kette, Statuscodes, HTTPS/HSTS, Zertifikat, Security-Header, Ladezeit.
* SSRF-sicher (siehe lib/httpcheck.php).
*
* @package SafeMyIdent\Api
*/
declare(strict_types=1);
require __DIR__ . '/../lib/boot2.php';
require_once __DIR__ . '/../lib/httpcheck.php';
if (!smi_module_on('url')) {
smi_json_error('URL-Modul ist deaktiviert.', 403);
}
$url = trim((string) ($_GET['url'] ?? ''));
if ($url === '') {
smi_json_error('Bitte eine URL angeben.', 422);
}
if (strlen($url) > 2048) {
smi_json_error('URL ist zu lang.', 422);
}
// Schema ergänzen, falls fehlt.
if (!preg_match('#^https?://#i', $url)) {
$url = 'https://' . $url;
}
$cls = smi_classify_input($url);
if ($cls['type'] !== 'url') {
smi_json_error($cls['error'] ?: 'Keine gültige URL.', 422);
}
// Vorprüfung: Host muss öffentlich auflösbar sein.
$pin = smi_http_pin($url);
if (!$pin['ok']) {
smi_json_error($pin['error'] ?: 'Ziel wird blockiert.', 422);
}
$cacheKey = 'urlcheck|' . strtolower($url);
$hit = smi_cache_get($cacheKey);
if ($hit !== null) {
smi_json_ok($hit, true);
}
$result = smi_url_analyze($url);
if (!($result['ok'] ?? false)) {
smi_json_error($result['error'] ?? 'Analyse fehlgeschlagen.', 502);
}
smi_cache_set($cacheKey, $result, min(300, (int) ($smi_cfg['cache_ttl'] ?? 900)));
smi_json_ok($result);