2026-01-04 16:06:22 +09:00
|
|
|
<?php
|
|
|
|
|
header('Content-Type: text/plain; charset=utf-8');
|
2026-01-04 16:14:42 +09:00
|
|
|
echo "=== File Search Result ===\n";
|
2026-01-04 16:06:22 +09:00
|
|
|
|
2026-01-04 16:14:42 +09:00
|
|
|
function searchEnv($dir, $depth = 0) {
|
|
|
|
|
if ($depth > 2) return;
|
|
|
|
|
echo "Scanning: $dir\n";
|
|
|
|
|
if (!is_dir($dir)) return;
|
|
|
|
|
|
|
|
|
|
$files = scandir($dir);
|
|
|
|
|
foreach ($files as $file) {
|
|
|
|
|
if ($file === '.' || $file === '..') continue;
|
|
|
|
|
if (strpos($file, '.env') !== false) {
|
|
|
|
|
echo "[FOUND] $dir/$file\n";
|
|
|
|
|
$content = file_get_contents("$dir/$file");
|
|
|
|
|
echo "--- Content of $file ---\n";
|
|
|
|
|
foreach (explode("\n", $content) as $line) {
|
|
|
|
|
if (trim($line) === '') continue;
|
|
|
|
|
if (strpos($line, 'DB_PASS') !== false || strpos($line, 'PASSWORD') !== false) {
|
|
|
|
|
echo explode('=', $line)[0] . "=********\n";
|
|
|
|
|
} else {
|
|
|
|
|
echo $line . "\n";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
echo "------------------------\n";
|
2026-01-04 16:06:22 +09:00
|
|
|
}
|
|
|
|
|
}
|
2026-01-04 16:14:42 +09:00
|
|
|
searchEnv(dirname($dir), $depth + 1);
|
2026-01-04 16:06:22 +09:00
|
|
|
}
|
|
|
|
|
|
2026-01-04 16:14:42 +09:00
|
|
|
searchEnv(__DIR__);
|
2026-01-04 16:12:37 +09:00
|
|
|
|
2026-01-04 16:14:42 +09:00
|
|
|
echo "\n=== Permissions Check ===\n";
|
|
|
|
|
echo "Web User: " . posix_getpwuid(posix_geteuid())['name'] . "\n";
|
|
|
|
|
echo "Directory writable: " . (is_writable(__DIR__) ? "YES" : "NO") . "\n";
|