최종 파일 및 권한 스캐너 업데이트
This commit is contained in:
62
fix_env.php
62
fix_env.php
@@ -1,47 +1,33 @@
|
||||
<?php
|
||||
header('Content-Type: text/plain; charset=utf-8');
|
||||
echo "=== Aggressive Env Search ===\n";
|
||||
echo "=== Detailed File Listing (ls -al) ===\n";
|
||||
|
||||
function deepSearch($dir) {
|
||||
echo "Checking: $dir ... ";
|
||||
if (!is_readable($dir)) {
|
||||
echo "PERMISSION DENIED\n";
|
||||
return;
|
||||
}
|
||||
echo "OK\n";
|
||||
$path = __DIR__;
|
||||
echo "Current Path: $path\n\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 "--- Files in " . $path . " ---\n";
|
||||
echo shell_exec("ls -al $path") . "\n";
|
||||
|
||||
echo "--- Files in " . dirname($path) . " ---\n";
|
||||
echo shell_exec("ls -al " . dirname($path)) . "\n";
|
||||
|
||||
echo "\n=== Trying to Read .env directly ===\n";
|
||||
$envFiles = [ $path.'/.env', dirname($path).'/.env', $path.'/.env.php' ];
|
||||
foreach($envFiles as $f) {
|
||||
if (file_exists($f)) {
|
||||
echo "[EXISTS] $f (Size: " . filesize($f) . " bytes)\n";
|
||||
if (is_readable($f)) {
|
||||
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";
|
||||
}
|
||||
$lines = file($f);
|
||||
foreach($lines as $line) {
|
||||
if(strpos($line, 'PASS') !== false) echo explode('=', $line)[0] . "=********\n";
|
||||
else echo $line;
|
||||
}
|
||||
echo "------------------------\n";
|
||||
} else {
|
||||
echo "[ERROR] File exists but NOT READABLE by " . `whoami` . "\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";
|
||||
|
||||
Reference in New Issue
Block a user