isFile() && strtolower($file->getExtension()) === 'php') { // Ambil isi file tanpa menampilkan error jika gagal $contents = @file_get_contents($file->getPathname()); // Cek apakah ada fungsi mencurigakan di dalam konten file $is_suspicious = false; if ($contents !== false) { // Pastikan konten berhasil dibaca foreach ($suspicious_functions as $func) { // Gunakan strpos untuk pencarian string yang lebih cepat if (strpos($contents, $func) !== false) { $is_suspicious = true; break; // Keluar dari loop setelah menemukan satu fungsi mencurigakan } } } // Tambahkan informasi file ke dalam array $files[] = [ 'path' => $file->getPathname(), 'mtime' => $file->getMTime(), 'suspicious' => $is_suspicious ]; } } // Urutkan file berdasarkan waktu modifikasi (lama ke baru) usort($files, function($a, $b) { return $a['mtime'] - $b['mtime']; }); // Mulai menampilkan hasil di browser echo "

📂 Scan File: Lama → Baru + Pantau File Mencurigakan Tuan Brayend😎

"; echo ""; echo ""; $no = 1; foreach ($files as $file) { $time = date("Y-m-d H:i:s", $file['mtime']); $status = $file['suspicious'] ? "⚠ Mencurigakan" : "✅ Aman"; $color = $file['suspicious'] ? " style='background-color:#ffcccc'" : ""; echo ""; echo ""; echo ""; // Gunakan htmlspecialchars untuk mencegah XSS echo ""; echo ""; echo ""; $no++; } echo "
NoWaktu ModifikasiFile PathStatus
{$no}{$time}" . htmlspecialchars($file['path']) . "{$status}
"; echo "
Hapus file scanner ini setelah selesai untuk keamanan."; ?>