Moved hardcoded values to config file
This commit is contained in:
@@ -17,7 +17,7 @@ if ($cmd === '') {
|
||||
}
|
||||
|
||||
// Restrict dangerous commands for safety
|
||||
$blacklist = ['rm', 'shutdown', 'reboot', 'passwd', 'dd', ':(){'];
|
||||
$blacklist = $CONFIG['blacklist_commands'];
|
||||
foreach ($blacklist as $bad) {
|
||||
if (stripos($cmd, $bad) !== false) {
|
||||
echo json_encode(['output' => "⚠️ Command '$bad' not allowed"]);
|
||||
@@ -30,7 +30,7 @@ $descriptor = [
|
||||
1 => ['pipe', 'w'],
|
||||
2 => ['pipe', 'w']
|
||||
];
|
||||
$process = proc_open($cmd, $descriptor, $pipes, '/home');
|
||||
$process = proc_open($cmd, $descriptor, $pipes, $CONFIG['default_dir']);
|
||||
if (is_resource($process)) {
|
||||
$output = stream_get_contents($pipes[1]);
|
||||
$error = stream_get_contents($pipes[2]);
|
||||
|
||||
Reference in New Issue
Block a user