최종 파일 및 권한 스캐너 업데이트

This commit is contained in:
2026-01-04 16:16:29 +09:00
parent a5bc2198eb
commit e26ba7ef3a

View File

@@ -1,47 +1,33 @@
<?php <?php
header('Content-Type: text/plain; charset=utf-8'); header('Content-Type: text/plain; charset=utf-8');
echo "=== Aggressive Env Search ===\n"; echo "=== Detailed File Listing (ls -al) ===\n";
function deepSearch($dir) { $path = __DIR__;
echo "Checking: $dir ... "; echo "Current Path: $path\n\n";
if (!is_readable($dir)) {
echo "PERMISSION DENIED\n";
return;
}
echo "OK\n";
$files = scandir($dir); // 현재 디렉토리와 상위 디렉토리 리스트 출력
foreach ($files as $file) { echo "--- Files in " . $path . " ---\n";
if ($file === '.' || $file === '..') continue; echo shell_exec("ls -al $path") . "\n";
$path = $dir . DIRECTORY_SEPARATOR . $file; echo "--- Files in " . dirname($path) . " ---\n";
echo shell_exec("ls -al " . dirname($path)) . "\n";
// .env 라는 글자가 포함된 모든 파일 검색 echo "\n=== Trying to Read .env directly ===\n";
if (strpos($file, '.env') !== false && is_file($path)) { $envFiles = [ $path.'/.env', dirname($path).'/.env', $path.'/.env.php' ];
echo "\n[!!! FOUND !!!] Path: $path\n"; foreach($envFiles as $f) {
if (file_exists($f)) {
echo "[EXISTS] $f (Size: " . filesize($f) . " bytes)\n";
if (is_readable($f)) {
echo "--- Content (Masked) ---\n"; echo "--- Content (Masked) ---\n";
$content = file_get_contents($path); $lines = file($f);
foreach (explode("\n", $content) as $line) { foreach($lines as $line) {
if (trim($line) === '') continue; if(strpos($line, 'PASS') !== false) echo explode('=', $line)[0] . "=********\n";
$parts = explode('=', $line, 2); else echo $line;
$key = trim($parts[0]); }
if (stripos($key, 'PASS') !== false || stripos($key, 'PW') !== false) {
echo "$key=********\n";
} else { } else {
echo $line . "\n"; echo "[ERROR] File exists but NOT READABLE by " . `whoami` . "\n";
}
}
echo "------------------------\n";
} }
} else {
echo "[NOT FOUND] $f\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";