forked from ryananicholson/which-reality
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
52 lines (44 loc) · 1.14 KB
/
index.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
47
48
49
50
51
52
<html>
<head>
<title>Oh geez... What reality am I in?</title>
</head>
<body>
<h1> Server Information</h1>
<?php
function command_exist($cmd) {
$return = shell_exec(sprintf("which %s", escapeshellarg($cmd)));
return !empty($return);
}
if (command_exist("uname")) {
$OS_NAME = exec("uname -r");
$OS_VER = "";
}
echo "Kernel version: " . $OS_NAME . " " . $OS_VER . "<br/>";
if (command_exist("apache2")) {
$WEBPROG = exec("apache2 -V | grep ^Server\ version");
if ($WEBPROG == "") {
$WEBPROG = "Web Server: Apache (Undetermined version)";
}
} elseif (command_exist("httpd")) {
$WEBPROG = exec("httpd -V | grep ^Server\ version");
if ($WEBPROG == "") {
$WEBPROG = "Web Server: Apache (Undetermined version)";
}
} elseif (command_exist("nginx")) {
$WEBPROG = exec("nginx -V | grep ^nginx\ version");
if ($WEBPROG == "") {
$WEBPROG = "Web Server: NGINX (Undetermined version)";
}
}
echo $WEBPROG . "<br/>";
echo "PHP Version: " . phpversion() . "<br/>";
?>
<h1> Running Processes </h1>
<?php
exec("ps -ef", $output);
foreach($output as $i) {
echo $i . "<br/>";
}
?>
</body>
</html>