403Webshell
Server IP : 161.248.188.39  /  Your IP : 216.73.216.53
Web Server : Apache
System : Linux 161-248-188-39.cprapid.com 4.18.0-513.9.1.el8_9.x86_64 #1 SMP Sat Dec 2 05:23:44 EST 2023 x86_64
User : mysoftbd ( 1002)
PHP Version : 8.2.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/mysoftbd/bhatgramajsh.edu.bd/wp-content/plugins/duplicator/tools/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/mysoftbd/bhatgramajsh.edu.bd/wp-content/plugins/duplicator/tools/vendor-cleanup.php
<?php

/**
 * Safely remove a directory and recursively files and directory upto multiple sublevels
 *
 * @param string $path The full path to the directory to remove
 *
 * @return bool Returns true if all content was removed
 */
function rrmdir($path)
{
    if (is_dir($path)) {
        if (($dh = opendir($path)) === false) {
            return false;
        }
        while (($object = readdir($dh)) !== false) {
            if ($object == "." || $object == "..") {
                continue;
            }
            rrmdir($path . "/" . $object);
            /*if (!rrmdir($path . "/" . $object)) {
                closedir($dh);
                return false;
            }*/
        }
        closedir($dh);
        return @rmdir($path);
    } else {
        if (is_writable($path)) {
            $result = @unlink($path);
        } else {
            $result = false;
        }

        if ($result == false) {
            echo 'Can\'t remove ' . $path . "\n";
        }
        return $result;
    }
}

$mainDir           = dirname(__DIR__) . '/';
$exclueVendorItems = [
  'requests',
  '.htaccess',
  'index.php'
];

$removeItems = [
    'composer.lock'
];

foreach ($removeItems as $item) {
    $removeItem = $mainDir . $item;
    if (!file_exists($removeItem)) {
        continue;
    }
    echo 'REMOVE ' . $mainDir . $item . "\n";
    rrmdir($mainDir . $item);
}

$vendorDir = $mainDir . 'vendor/';
if (!is_dir($vendorDir)) {
    exit(0);
}

if (($dh = opendir($vendorDir)) === false) {
    echo 'Can\'t open dir ' . $vendorDir;
    exit(1);
}

while (($file = readdir($dh)) !== false) {
    if ($file == '.' || $file == '..') {
        continue;
    }

    if (in_array($file, $exclueVendorItems)) {
        continue;
    }

    rrmdir($vendorDir . $file);
}
closedir($dh);

exit(0);

Youez - 2016 - github.com/yon3zu
LinuXploit