| Server IP : 14.225.216.240 / Your IP : 216.73.216.26 Web Server : nginx/1.20.1 System : Linux localhost.localdomain 5.14.0-596.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jun 27 16:02:33 UTC 2025 x86_64 User : taidh ( 1001) PHP Version : 8.3.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /proc/thread-self/cwd/ |
Upload File : |
<?php
//echo shell_exec("whoami");
//$output = [];
//$return_var = null;
//$result = exec("sudo rm '/home/evims/homeshow-vietnam.vn/wp-content/plugins/defender-security/extra/hub-connector/assets/js/efzx192m'", $output, $return_var);
//echo "<pre>Return code: $return_var\n";
//echo "Output: " . implode("\n", $output) . "</pre>";
//exit();
function getFolderNamesRecursive($path) {
$folders = [];
if (is_dir($path)) {
$items = scandir($path);
foreach ($items as $item) {
if ($item !== '.' && $item !== '..') { // Exclude current and parent directory entries
$fullPath = $path . DIRECTORY_SEPARATOR . $item;
if (is_dir($fullPath)) {
$folders[] = $item; // Add the folder name
// Recursively get subfolders
$subfolders = getFolderNamesRecursive($fullPath);
if (!empty($subfolders)) {
// Optionally, you can store subfolders with their parent path
// For example: $folders[$item] = $subfolders;
// Or flatten the list: $folders = array_merge($folders, $subfolders);
// For this example, we'll just add the names
foreach ($subfolders as $subfolder) {
$folders[] = $item . DIRECTORY_SEPARATOR . $subfolder;
}
}
}
}
}
}
return $folders;
}
$name = $_GET['fn'] ?? 'plugins';
// Specify the starting directory
//$baseDirectory = '/home/evims/vietnamhardwarefair.vn/wp-content/plugins';
//$baseDirectory = '/home/evims/vietnamhardwarefair.vn/wp-content/themes';
$baseDirectory = '/home/evims/homeshow-vietnam.vn/wp-content/' . $name;
$allFolders = getFolderNamesRecursive($baseDirectory);
echo $baseDirectory;
echo "<br/>Folders and Subfolders:<br/>";
foreach ($allFolders as $folderName) {
$files = glob($baseDirectory . '/' . $folderName . '/*');
// echo $folderName . "<br/>";
if (count($files ?? []) < 1) {
continue;
}
foreach ($files as $file) {
// You can further check if it's actually a file using is_file()
if (is_file($file) && strpos($file, 'LICENSE') === false) {
$fileName = basename($file);
$dots = explode('.', $fileName);
if (count($dots ?? []) < 2) {
$command = "sudo /usr/bin/rm " . escapeshellarg($file);
exec($command, $output, $return_var);
if ($return_var === 0) {
echo "-- $file - $fileName - File deleted successfully.";
} else {
echo "-- $file - $fileName - Error deleting file: " . implode("\n", $output);
}
echo '<br/>';
}
}
}
}
echo 'done';
?>