📁 File Manager
Editing:
/home/u845030939/domains/shahrikin.com/public_html/scan.php
<?php // Start HTML output echo "<!DOCTYPE html><html><head><meta charset='UTF-8'><title>Malware Scan Results</title> <style> body { font-family: Arial, sans-serif; background: #f4f4f4; padding: 20px; } h1 { color: #333; } .result { background: #fff; border-left: 5px solid #ff6f61; padding: 10px 15px; margin: 10px 0; } .alert { color: red; } .ok { color: green; } </style></head><body>"; echo "<h1>🔍 Malware Scan Results</h1>"; $scanRoot = __DIR__; $maliciousPatterns = [ 'eval(base64_decode', 'gzinflate(base64_decode', 'eval(gzinflate', 'shell_exec', 'exec(', 'passthru(', 'system(', 'base64_decode(', 'preg_replace("/.e."/', 'str_rot13', 'php_uname', 'file_put_contents($_POST[', 'eval($code)', 'xor', '$code .=' ]; $obfuscationPatterns = [ '/class\s+_/', '/new\s+_/', '/chr\s*\(\s*hexdec\s*\(/i', '/hex2bin\s*\(/i', '/eval\s*\(\s*null\s*\.\s*null\s*\.\s*\$/i', '/goto\s+[a-z0-9_]+;/i', '/pack\s*\(\s*[\'"]H\*["\']\s*,\s*[\'"][0-9a-f]{500,}["\']\s*\)/i', ]; function scanFiles($dir, $patterns, $obfuscated) { $results = []; $files = scandir($dir); foreach ($files as $file) { if ($file === '.' || $file === '..') continue; $fullPath = $dir . DIRECTORY_SEPARATOR . $file; if (is_dir($fullPath)) { $results = array_merge($results, scanFiles($fullPath, $patterns, $obfuscated)); } elseif (pathinfo($fullPath, PATHINFO_EXTENSION) === 'php') { $contents = @file_get_contents($fullPath); if ($contents === false) continue; foreach ($patterns as $pattern) { if (stripos($contents, $pattern) !== false) { $results[] = "<div class='result alert'>⚠️ Pattern <strong>$pattern</strong> found in: <code>$fullPath</code></div>"; break; } } foreach ($obfuscated as $regex) { if (preg_match($regex, $contents)) { $results[] = "<div class='result alert'>🔥 Obfuscated code matched in: <code>$fullPath</code></div>"; break; } } } } return $results; } $results = scanFiles($scanRoot, $maliciousPatterns, $obfuscationPatterns); if (empty($results)) { echo "<div class='result ok'>✅ No malware patterns found. Your code looks clean.</div>"; } else { foreach ($results as $line) { echo $line; } } echo "<p><strong>📁 Scanned Path:</strong> <code>$scanRoot</code></p>"; echo "<p>✅ Scan complete.</p>"; echo "</body></html>";
Save
Cancel