diff --git a/homepage/views.php b/homepage/views.php index 67209ea..e190569 100644 --- a/homepage/views.php +++ b/homepage/views.php @@ -51,6 +51,8 @@ body::-webkit-scrollbar { elem.innerHTML = 'Copied!'; const copyText = document.getElementsByTagName("pre")[0].textContent; const textArea = document.createElement('textarea'); + textArea.style.position = 'absolute'; + textArea.style.left = '-100%'; textArea.textContent = copyText; document.body.append(textArea); textArea.select(); @@ -89,7 +91,7 @@ if(isset($_GET['view'])){ if($submittedpwd == $caddypwd && $submitteduser == 'birdnet'){ $url = $_SERVER['SERVER_NAME']."/scripts/adminer.php"; echo "
-
+ @@ -99,8 +101,8 @@ if(isset($_GET['view'])){ -
-
"; + + "; } else { header('WWW-Authenticate: Basic realm="My Realm"'); header('HTTP/1.0 401 Unauthorized'); @@ -184,7 +186,7 @@ if(isset($_GET['view'])){ $submitteduser = $_SERVER['PHP_AUTH_USER']; if($submittedpwd == $caddypwd && $submitteduser == 'birdnet'){ #ACCESS THE WEB TERMINAL - echo ""; + echo ""; } else { header('WWW-Authenticate: Basic realm="My Realm"'); header('HTTP/1.0 401 Unauthorized'); @@ -210,12 +212,20 @@ if(isset($_GET['view'])){ $submitteduser = $_SERVER['PHP_AUTH_USER']; if($submittedpwd == $caddypwd && $submitteduser == 'birdnet'){ $command = $_GET['submit']; - if(isset($command)){ + if(isset($command)){ + $initcommand = $command; + if (strpos($command, "systemctl") !== false) { + $tmp = explode(" ",trim($command)); + $command .= "& sleep 3;sudo systemctl status ".end($tmp); + } $results = shell_exec("$command 2>&1"); + $results = str_replace("FAILURE", "FAILURE", $results); + $results = str_replace("failed", "failed",$results); + $results = str_replace("active (running)", "active (running)",$results); if(strlen($results) == 0) { $results = "This command has no output."; } - echo "
Output of command:`".$command."`
$results
"; + echo "
Output of command:`".$initcommand."`
$results
"; } else { header('WWW-Authenticate: Basic realm="My Realm"'); header('HTTP/1.0 401 Unauthorized');