"Directory tidak ditemukan: $dir"]) . "\n"; flush(); return; } $iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS) ); $totalFiles = 0; $scannedFiles = 0; // Hitung total file PHP dulu untuk progress foreach ($iterator as $file) { if ($file->isFile()) { $ext = strtolower(pathinfo($file->getFilename(), PATHINFO_EXTENSION)); if (in_array($ext, $allowedExt)) { $totalFiles++; } } } // Kirim info total file echo json_encode(['total' => $totalFiles]) . "\n"; flush(); // Reset iterator $iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS) ); foreach ($iterator as $file) { if ($file->isFile()) { $ext = strtolower(pathinfo($file->getFilename(), PATHINFO_EXTENSION)); if (!in_array($ext, $allowedExt)) continue; $scannedFiles++; $path = $file->getRealPath(); $content = @file_get_contents($path); if ($content !== false) { $found = []; foreach ($patterns as $pattern) { if (stripos($content, $pattern) !== false) { $found[] = htmlspecialchars($pattern); } } if (!empty($found)) { // Kirim hasil langsung ke client echo json_encode([ 'type' => 'result', 'file' => $path, 'patterns' => $found, 'size' => filesize($path), 'modified' => date('Y-m-d H:i:s', filemtime($path)) ]) . "\n"; flush(); } } // Kirim progress update setiap 10 file if ($scannedFiles % 10 == 0) { echo json_encode([ 'type' => 'progress', 'scanned' => $scannedFiles, 'total' => $totalFiles ]) . "\n"; flush(); } } } // Kirim sinyal selesai echo json_encode(['type' => 'complete']) . "\n"; flush(); } // Handle AJAX request untuk streaming if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] === 'XMLHttpRequest') { header('Content-Type: text/event-stream'); header('Cache-Control: no-cache'); header('X-Accel-Buffering: no'); // Nonaktifkan buffering nginx if (isset($_POST['action']) && $_POST['action'] === 'scan_stream') { $scanDir = isset($_POST['directory']) ? $_POST['directory'] : __DIR__; $patterns = getPatterns(); scanDirectoryStream($scanDir, $patterns, $allowedExtensions); exit; } // Action: delete if (isset($_POST['action']) && $_POST['action'] === 'delete' && isset($_POST['files'])) { header('Content-Type: application/json'); $files = json_decode($_POST['files'], true); $deleted = []; $failed = []; foreach ($files as $file) { $file = realpath($file); if ($file && is_file($file)) { if (unlink($file)) { $deleted[] = $file; } else { $failed[] = $file; } } else { $failed[] = $file; } } echo json_encode(['deleted' => $deleted, 'failed' => $failed]); exit; } exit; } ?> Shell Scanner - Live Result

Shell Scanner LIVE

Deteksi dan hapus web shell dengan cepat - Hasil langsung muncul saat scan

Konfigurasi Scan

Hasil akan langsung muncul saat file ditemukan, tidak perlu menunggu scan selesai.
Memulai scan...