Files
sam-sales/fix_env.php

48 lines
1.5 KiB
PHP
Raw Normal View History

<?php
header('Content-Type: text/plain; charset=utf-8');
echo "=== Aggressive Env Search ===\n";
function deepSearch($dir) {
echo "Checking: $dir ... ";
if (!is_readable($dir)) {
echo "PERMISSION DENIED\n";
return;
}
echo "OK\n";
$files = scandir($dir);
foreach ($files as $file) {
if ($file === '.' || $file === '..') continue;
$path = $dir . DIRECTORY_SEPARATOR . $file;
// .env 라는 글자가 포함된 모든 파일 검색
if (strpos($file, '.env') !== false && is_file($path)) {
echo "\n[!!! FOUND !!!] Path: $path\n";
echo "--- Content (Masked) ---\n";
$content = file_get_contents($path);
foreach (explode("\n", $content) as $line) {
if (trim($line) === '') continue;
$parts = explode('=', $line, 2);
$key = trim($parts[0]);
if (stripos($key, 'PASS') !== false || stripos($key, 'PW') !== false) {
echo "$key=********\n";
} else {
echo $line . "\n";
}
}
echo "------------------------\n";
}
}
}
// 현재 경로, 상위 경로, 상위의 상위 경로까지 검색
$current = __DIR__;
deepSearch($current);
deepSearch(dirname($current));
deepSearch(dirname(dirname($current)));
echo "\n=== System Info ===\n";
echo "Current User: " . `whoami`;
echo "Document Root: " . $_SERVER['DOCUMENT_ROOT'] . "\n";