From 50852d6970358855a967b53398e24c956390c044 Mon Sep 17 00:00:00 2001 From: Metacube Date: Tue, 4 Nov 2025 20:08:24 +0100 Subject: [PATCH 1/2] Add HyperTracer 3D experience in route2 --- route.php | 513 +++++++++++++++++++++++++++++++++++++ route2.php | 722 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1235 insertions(+) create mode 100644 route.php create mode 100644 route2.php diff --git a/route.php b/route.php new file mode 100644 index 0000000..932c9f4 --- /dev/null +++ b/route.php @@ -0,0 +1,513 @@ +&1'; + $rawOutput = shell_exec($command); + if ($rawOutput === null) { + $error = 'Traceroute konnte nicht ausgeführt werden. Ist das Kommando verfügbar?'; + } else { + $traceData = parseTraceroute($rawOutput); + if (empty($traceData)) { + $error = 'Keine Hops gefunden. Prüfen Sie den Hostnamen oder versuchen Sie es später erneut.'; + } + } + } +} + +if (empty($traceData)) { + $traceData = getSampleTrace(); + if ($error === '') { + $error = 'Es werden Beispieldaten angezeigt. Starten Sie eine Abfrage, um echte Traceroute-Daten zu sehen.'; + } +} + +function parseTraceroute(string $raw): array +{ + $lines = preg_split('/\r?\n/', trim($raw)); + if (!$lines) { + return []; + } + + $hops = []; + foreach ($lines as $line) { + if (preg_match('/^\s*\d+\s+/', $line) !== 1) { + continue; + } + + preg_match_all('/(\d+\.\d+)\s+ms/', $line, $latencyMatches); + $latencies = array_map('floatval', $latencyMatches[1] ?? []); + $avgLatency = !empty($latencies) ? array_sum($latencies) / count($latencies) : null; + + if (preg_match('/^\s*(\d+)\s+([0-9\.\*]+)/', $line, $parts) !== 1) { + continue; + } + + $hopNumber = (int) $parts[1]; + $ip = $parts[2]; + if ($ip === '*') { + $ip = 'Zeitüberschreitung'; + } + + $hops[] = [ + 'hop' => $hopNumber, + 'ip' => $ip, + 'avgLatency' => $avgLatency, + 'raw' => trim($line), + ]; + } + + return $hops; +} + +function getSampleTrace(): array +{ + return [ + ['hop' => 1, 'ip' => '192.168.0.1', 'avgLatency' => 1.2, 'raw' => '1 192.168.0.1 1.123 ms 1.234 ms 1.301 ms'], + ['hop' => 2, 'ip' => '10.12.34.1', 'avgLatency' => 9.4, 'raw' => '2 10.12.34.1 9.123 ms 9.567 ms 9.400 ms'], + ['hop' => 3, 'ip' => '172.16.5.4', 'avgLatency' => 18.7, 'raw' => '3 172.16.5.4 18.432 ms 18.913 ms 18.787 ms'], + ['hop' => 4, 'ip' => '203.0.113.5', 'avgLatency' => 32.9, 'raw' => '4 203.0.113.5 32.113 ms 33.441 ms 33.212 ms'], + ['hop' => 5, 'ip' => '93.184.216.34', 'avgLatency' => 48.2, 'raw' => '5 93.184.216.34 48.112 ms 48.501 ms 48.032 ms'], + ]; +} + +function generatePositions(array $trace): array +{ + $positions = []; + $radius = 25; + $spacing = 10; + foreach ($trace as $index => $hop) { + $angle = $index * 0.9; + $positions[] = [ + 'x' => cos($angle) * $radius, + 'y' => $index * $spacing, + 'z' => sin($angle) * $radius, + ]; + } + return $positions; +} + +$positions = generatePositions($traceData); +?> + + + + + + 3D Traceroute Visualisierung + + + +
+

3D Traceroute Explorer

+

Visualisieren Sie Netzwerkpfade im dreidimensionalen Raum und erkunden Sie die einzelnen Hops.

+
+
+
+ + +
+ +
+ + + + + + diff --git a/route2.php b/route2.php new file mode 100644 index 0000000..66a4032 --- /dev/null +++ b/route2.php @@ -0,0 +1,722 @@ +&1'; + $rawOutput = shell_exec($command); + if ($rawOutput === null) { + $error = 'Traceroute konnte nicht ausgeführt werden. Ist das Kommando verfügbar?'; + } else { + $traceData = parseTraceroute($rawOutput); + if (empty($traceData)) { + $error = 'Keine Hops gefunden. Prüfen Sie den Hostnamen oder versuchen Sie es später erneut.'; + } + } + } +} + +if (empty($traceData)) { + $traceData = getSampleTrace(); + if ($error === '') { + $error = 'Es werden Beispieldaten angezeigt. Starten Sie eine Abfrage, um echte Traceroute-Daten zu sehen.'; + } +} + +$positions = generateGalaxyLayout(count($traceData)); +$traceWithPositions = array_map(function ($hop, $index) use ($positions) { + return $hop + [ + 'position' => $positions[$index] ?? ['x' => 0, 'y' => 0, 'z' => 0], + ]; +}, $traceData, array_keys($traceData)); + +function parseTraceroute(string $raw): array +{ + $lines = preg_split('/\r?\n/', trim($raw)); + if (!$lines) { + return []; + } + + $hops = []; + foreach ($lines as $line) { + if (!preg_match('/^\s*(\d+)\s+(.+)/', $line, $parts)) { + continue; + } + + $hopNumber = (int) $parts[1]; + $rest = $parts[2]; + + preg_match('/([0-9a-fA-F:\.\-]+|\*)/', $rest, $ipMatch); + $ip = $ipMatch[1] ?? '*'; + $ip = $ip === '*' ? 'Zeitüberschreitung' : $ip; + + preg_match_all('/(\d+\.\d+)\s+ms/', $rest, $latencyMatches); + $latencies = array_map('floatval', $latencyMatches[1] ?? []); + $avgLatency = !empty($latencies) ? round(array_sum($latencies) / count($latencies), 2) : null; + + $hops[] = [ + 'hop' => $hopNumber, + 'ip' => $ip, + 'avgLatency' => $avgLatency, + 'raw' => trim($line), + ]; + } + + return $hops; +} + +function getSampleTrace(): array +{ + return [ + ['hop' => 1, 'ip' => '192.168.0.1', 'avgLatency' => 1.23, 'raw' => '1 192.168.0.1 1.12 ms 1.20 ms 1.38 ms'], + ['hop' => 2, 'ip' => '10.12.34.1', 'avgLatency' => 9.87, 'raw' => '2 10.12.34.1 9.44 ms 9.90 ms 10.29 ms'], + ['hop' => 3, 'ip' => '172.16.5.4', 'avgLatency' => 18.54, 'raw' => '3 172.16.5.4 18.12 ms 18.45 ms 18.71 ms'], + ['hop' => 4, 'ip' => '198.51.100.12', 'avgLatency' => 27.42, 'raw' => '4 198.51.100.12 27.03 ms 27.54 ms 27.68 ms'], + ['hop' => 5, 'ip' => '203.0.113.5', 'avgLatency' => 36.18, 'raw' => '5 203.0.113.5 35.82 ms 36.19 ms 36.52 ms'], + ['hop' => 6, 'ip' => '93.184.216.34', 'avgLatency' => 48.91, 'raw' => '6 93.184.216.34 48.44 ms 48.90 ms 49.39 ms'], + ]; +} + +function generateGalaxyLayout(int $count): array +{ + $positions = []; + $radiusStep = 28; + $angleOffset = pi() * (3 - sqrt(5)); // Golden angle + $heightStep = 12; + + for ($i = 0; $i < $count; $i++) { + $radius = ($i + 1) * 4 + ($i % 2 === 0 ? $radiusStep : $radiusStep * 0.6); + $angle = $i * $angleOffset; + $y = ($i - $count / 2) * $heightStep; + + $positions[] = [ + 'x' => cos($angle) * $radius, + 'y' => $y, + 'z' => sin($angle) * $radius, + ]; + } + + return $positions; +} +?> + + + + + + HyperTracer 3D + + + + + + +
+

HyperTracer 3D

+
+ + + +
+
+
+ +
+ +
+
Hop 1:
+
+
+ WebGL konnte nicht initialisiert werden. Bitte verwenden Sie einen modernen Browser oder aktivieren Sie WebGL. +
+
+
+ + + From fbe95175885ff58e7af2bcb2c9065b1d4c54abe1 Mon Sep 17 00:00:00 2001 From: Metacube Date: Sun, 9 Nov 2025 12:29:52 +0100 Subject: [PATCH 2/2] Add canvas-based traceroute visualization --- route3.php | 673 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 673 insertions(+) create mode 100644 route3.php diff --git a/route3.php b/route3.php new file mode 100644 index 0000000..8640f33 --- /dev/null +++ b/route3.php @@ -0,0 +1,673 @@ +&1'; + $rawOutput = shell_exec($command); + if ($rawOutput === null) { + $error = 'Traceroute konnte nicht ausgeführt werden. Ist das Kommando verfügbar?'; + } else { + $traceData = parseTraceroute($rawOutput); + if (empty($traceData)) { + $error = 'Keine Hops gefunden. Prüfen Sie den Hostnamen oder versuchen Sie es später erneut.'; + } + } + } +} + +if (empty($traceData)) { + $traceData = getSampleTrace(); + if ($error === '') { + $error = 'Es werden Beispieldaten angezeigt. Starten Sie eine Abfrage, um echte Traceroute-Daten zu sehen.'; + } +} + +$positions = generateHelixLayout(count($traceData)); +$traceWithPositions = array_map(function ($hop, $index) use ($positions) { + return $hop + [ + 'position' => $positions[$index] ?? ['x' => 0, 'y' => 0, 'z' => 0], + ]; +}, $traceData, array_keys($traceData)); + +function parseTraceroute(string $raw): array +{ + $lines = preg_split('/\r?\n/', trim($raw)); + if (!$lines) { + return []; + } + + $hops = []; + foreach ($lines as $line) { + if (!preg_match('/^\s*(\d+)\s+(.+)/', $line, $parts)) { + continue; + } + + $hopNumber = (int) $parts[1]; + $rest = $parts[2]; + + preg_match('/([0-9a-fA-F:\.\-]+|\*)/', $rest, $ipMatch); + $ip = $ipMatch[1] ?? '*'; + $ip = $ip === '*' ? 'Zeitüberschreitung' : $ip; + + preg_match_all('/(\d+\.\d+)\s+ms/', $rest, $latencyMatches); + $latencies = array_map('floatval', $latencyMatches[1] ?? []); + $avgLatency = !empty($latencies) ? round(array_sum($latencies) / count($latencies), 2) : null; + + $hops[] = [ + 'hop' => $hopNumber, + 'ip' => $ip, + 'avgLatency' => $avgLatency, + 'raw' => trim($line), + ]; + } + + return $hops; +} + +function getSampleTrace(): array +{ + return [ + ['hop' => 1, 'ip' => '192.168.0.1', 'avgLatency' => 1.23, 'raw' => '1 192.168.0.1 1.12 ms 1.20 ms 1.38 ms'], + ['hop' => 2, 'ip' => '10.12.34.1', 'avgLatency' => 9.87, 'raw' => '2 10.12.34.1 9.44 ms 9.90 ms 10.29 ms'], + ['hop' => 3, 'ip' => '172.16.5.4', 'avgLatency' => 18.54, 'raw' => '3 172.16.5.4 18.12 ms 18.45 ms 18.71 ms'], + ['hop' => 4, 'ip' => '198.51.100.12', 'avgLatency' => 27.42, 'raw' => '4 198.51.100.12 27.03 ms 27.54 ms 27.68 ms'], + ['hop' => 5, 'ip' => '203.0.113.5', 'avgLatency' => 36.18, 'raw' => '5 203.0.113.5 35.82 ms 36.19 ms 36.52 ms'], + ['hop' => 6, 'ip' => '93.184.216.34', 'avgLatency' => 48.91, 'raw' => '6 93.184.216.34 48.44 ms 48.90 ms 49.39 ms'], + ]; +} + +function generateHelixLayout(int $count): array +{ + $positions = []; + $radius = 160; + $heightStep = 70; + $angleStep = pi() / 3; + + for ($i = 0; $i < $count; $i++) { + $angle = $i * $angleStep; + $y = ($i - ($count - 1) / 2) * $heightStep; + $positions[] = [ + 'x' => cos($angle) * $radius, + 'y' => $y, + 'z' => sin($angle) * $radius, + ]; + } + + return $positions; +} +?> + + + + + + HyperTracer Canvas Edition + + + + + + +
+

HyperTracer — Canvas Flight Deck

+
+ + +
+
+ + + +
+ + +
+ + + +