forked from hybula/lookingglass
-
Notifications
You must be signed in to change notification settings - Fork 0
/
backend.php
46 lines (41 loc) · 1.17 KB
/
backend.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
/**
* Hybula Looking Glass
*
* Does the actual backend work for executed commands.
*
* @copyright 2022 Hybula B.V.
* @license Mozilla Public License 2.0
* @version 0.1
* @since File available since release 0.1
* @link https://github.com/hybula/lookingglass
*/
declare(strict_types=1);
require __DIR__.'/config.php';
require __DIR__.'/LookingGlass.php';
use Hybula\LookingGlass;
LookingGlass::validateConfig();
LookingGlass::startSession();
if ($_SESSION['TARGET'] && $_SESSION['METHOD'] && isset($_SESSION['BACKEND'])) {
unset($_SESSION['BACKEND']);
switch ($_SESSION['METHOD']) {
case 'ping':
LookingGlass::ping($_SESSION['TARGET']);
break;
case 'ping6':
LookingGlass::ping6($_SESSION['TARGET']);
break;
case 'mtr':
LookingGlass::mtr($_SESSION['TARGET']);
break;
case 'mtr6':
LookingGlass::mtr6($_SESSION['TARGET']);
break;
case 'traceroute':
LookingGlass::traceroute($_SESSION['TARGET']);
break;
case 'traceroute6':
LookingGlass::traceroute6($_SESSION['TARGET']);
break;
}
}