sales_org 폴더 내 .env 탐색 스캐너 작동
This commit is contained in:
49
fix_env.php
49
fix_env.php
@@ -1,33 +1,34 @@
|
||||
<?php
|
||||
header('Content-Type: text/plain; charset=utf-8');
|
||||
echo "=== Detailed File Listing (ls -al) ===\n";
|
||||
echo "=== Specialized Search in /home/webservice/sales_org ===\n";
|
||||
|
||||
$path = __DIR__;
|
||||
echo "Current Path: $path\n\n";
|
||||
$targetFile = '/home/webservice/sales_org/.env';
|
||||
|
||||
// 현재 디렉토리와 상위 디렉토리 리스트 출력
|
||||
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";
|
||||
$lines = file($f);
|
||||
foreach($lines as $line) {
|
||||
if(strpos($line, 'PASS') !== false) echo explode('=', $line)[0] . "=********\n";
|
||||
else echo $line;
|
||||
if (file_exists($targetFile)) {
|
||||
echo "[EXISTS] Found .env in sales_org!\n";
|
||||
if (is_readable($targetFile)) {
|
||||
$content = file_get_contents($targetFile);
|
||||
echo "--- Content (Masked) ---\n";
|
||||
foreach (explode("\n", $content) as $line) {
|
||||
if (stripos($line, 'DB_') !== false) {
|
||||
if (stripos($line, 'PASS') !== false) echo explode('=', $line)[0] . "=********\n";
|
||||
else echo $line . "\n";
|
||||
}
|
||||
} else {
|
||||
echo "[ERROR] File exists but NOT READABLE by " . `whoami` . "\n";
|
||||
}
|
||||
} else {
|
||||
echo "[NOT FOUND] $f\n";
|
||||
echo "[ERROR] Found but Permission Denied for www-data. Current user: " . `whoami` . "\n";
|
||||
}
|
||||
} else {
|
||||
echo "[NOT FOUND] $targetFile does not exist.\n";
|
||||
}
|
||||
|
||||
echo "\n=== Trying common PHP config files ===\n";
|
||||
$configs = [
|
||||
'/home/webservice/api/lib/mydb.php',
|
||||
'/home/webservice/mng/lib/mydb.php',
|
||||
'/home/webservice/script/pull_sales.sh'
|
||||
];
|
||||
|
||||
foreach($configs as $c) {
|
||||
if(file_exists($c)) echo "[FILE EXISTS] $c\n";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user