-
Notifications
You must be signed in to change notification settings - Fork 1
/
checks.php
39 lines (26 loc) · 1 KB
/
checks.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
<?php
#header('Location: http://ipwh.at/');
if ( isset ( $_GET['tr'] ) ) {
header('Content-Type: application/javascript;charset=utf-8');
$cmd = "traceroute " . $_SERVER["REMOTE_ADDR"];
$output = shell_exec ( $cmd );
$result = explode ("\n", $output );
$res = preg_grep('/.* \* \* \*/', $result );
$rdiff = array_diff ( $result, $res );
echo $_GET['tr'] ."(" . json_encode ( $rdiff ) . ")" ;
} elseif ( isset ( $_GET['ping'] ) ) {
header('Content-Type: application/javascript;charset=utf-8');
$cmd = "ping -c 5 -nq " . $_SERVER["REMOTE_ADDR"] ;
$output = shell_exec( $cmd );
$result = explode ("\n", $output );
echo $_GET['ping'] ."(" . json_encode ( $result ) . ")" ;
} elseif ( isset ( $_GET['whois'] ) ) {
header('Content-Type: application/javascript;charset=utf-8');
$cmd = "whois -s " . $_SERVER["REMOTE_ADDR"] ;
$output = shell_exec( $cmd );
$result = explode ("\n", $output );
echo $_GET['whois'] ."(" . json_encode ( $result ) . ")" ;
} else {
header('Location: http://ipwh.at/');
}
?>