« Back to History
auth_scanner.php
|
20260722_120325.php
Initial Domain Snapshot
Copy Code
<?php /** * auth_scanner.php * Scan ERP pages for authentication/bootstrap patterns. */ declare(strict_types=1); $root = __DIR__; // ERP root $ignoreDirs = [ 'vendor', 'node_modules', '.git', 'cache', 'logs', 'tmp', ]; $stats = [ 'legacy_auth' => [], 'page_acl' => [], 'preload' => [], 'tenant_boot' => [], 'no_auth' => [], ]; $it = new RecursiveIteratorIterator( new RecursiveDirectoryIterator($root) ); foreach ($it as $file) { if (!$file->isFile()) continue; if (strtolower($file->getExtension()) !== 'php') continue; $path = $file->getPathname(); foreach ($ignoreDirs as $dir) { if (strpos($path, DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR) !== false) { continue 2; } } $code = file_get_contents($path); $legacy = strpos($code, "modules/auth/auth.php") !== false || strpos($code, "require_login(") !== false; $acl = strpos($code, "page_acl.php") !== false || strpos($code, "page_require_access(") !== false; $preload = strpos($code, "core/preload.php") !== false; $tenant = strpos($code, "tenant_bootstrap.php") !== false; if ($legacy) { $stats['legacy_auth'][] = $path; } if ($acl) { $stats['page_acl'][] = $path; } if ($preload) { $stats['preload'][] = $path; } if ($tenant) { $stats['tenant_boot'][] = $path; } if (!$legacy && !$acl && !$preload && !$tenant) { $stats['no_auth'][] = $path; } } echo "<pre>"; foreach ($stats as $title => $files) { echo "\n====================================================\n"; echo strtoupper($title)." : ".count($files)."\n"; echo "====================================================\n\n"; foreach ($files as $f) { echo str_replace($root.'/', '', $f).PHP_EOL; } } echo "\n====================================================\n"; echo "TOTAL PHP FILES SCANNED : "; $total = 0; foreach ($stats as $files) { $total += count($files); } echo $total; echo "\n====================================================\n";