| 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
/**
* Einzelwert: Netzwerk/ASN + Hosting-/Tor-Erkennung → GET /api/v1/network.php?ip=<ip>
*
* @package SafeMyIdent\Api
*/
declare(strict_types=1);
require __DIR__ . '/../lib/boot2.php';
require_once __DIR__ . '/../lib/asn.php';
require_once __DIR__ . '/../lib/detect.php';
$ip = trim((string) ($_GET['ip'] ?? ''));
if ($ip === '' || smi_ip_version($ip) === 0 || !smi_ip_is_public($ip)) {
smi_json_error('Bitte eine gültige öffentliche IP angeben.', 422);
}
$cacheKey = 'network|' . $ip;
$hit = smi_cache_get($cacheKey);
if ($hit !== null) {
smi_json_ok($hit, true);
}
$net = ['asn' => '', 'asn_number' => '', 'as_name' => '', 'prefix' => '', 'rir' => '', 'rir_name' => '', 'alloc_date' => '', 'cc' => ''];
if (smi_module_on('asn')) {
$net = smi_asn_lookup($ip);
}
$detect = ['is_hosting' => false, 'provider' => '', 'type' => 'unknown', 'tor' => false];
if (smi_module_on('detect')) {
$d = smi_detect_network($net['as_name'] ?? '', $net['asn_number'] ?? '');
$detect = array_merge($d, ['tor' => smi_is_tor_exit($ip)]);
}
$out = [
'network' => [
'asn' => $net['asn'] ?? '',
'asn_number' => $net['asn_number'] ?? '',
'as_name' => $net['as_name'] ?? '',
'prefix' => $net['prefix'] ?? '',
'rir' => $net['rir'] ?? '',
'rir_name' => $net['rir_name'] ?? '',
'alloc_date' => $net['alloc_date'] ?? '',
'cc' => $net['cc'] ?? '',
],
'detection' => $detect,
];
smi_cache_set($cacheKey, $out, (int) ($smi_cfg['cache_ttl'] ?? 900));
smi_json_ok($out);