sales_org 폴더 내 .env 탐색 스캐너 작동
This commit is contained in:
49
fix_env.php
49
fix_env.php
@@ -1,33 +1,34 @@
|
|||||||
<?php
|
<?php
|
||||||
header('Content-Type: text/plain; charset=utf-8');
|
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__;
|
$targetFile = '/home/webservice/sales_org/.env';
|
||||||
echo "Current Path: $path\n\n";
|
|
||||||
|
|
||||||
// 현재 디렉토리와 상위 디렉토리 리스트 출력
|
if (file_exists($targetFile)) {
|
||||||
echo "--- Files in " . $path . " ---\n";
|
echo "[EXISTS] Found .env in sales_org!\n";
|
||||||
echo shell_exec("ls -al $path") . "\n";
|
if (is_readable($targetFile)) {
|
||||||
|
$content = file_get_contents($targetFile);
|
||||||
echo "--- Files in " . dirname($path) . " ---\n";
|
echo "--- Content (Masked) ---\n";
|
||||||
echo shell_exec("ls -al " . dirname($path)) . "\n";
|
foreach (explode("\n", $content) as $line) {
|
||||||
|
if (stripos($line, 'DB_') !== false) {
|
||||||
echo "\n=== Trying to Read .env directly ===\n";
|
if (stripos($line, 'PASS') !== false) echo explode('=', $line)[0] . "=********\n";
|
||||||
$envFiles = [ $path.'/.env', dirname($path).'/.env', $path.'/.env.php' ];
|
else echo $line . "\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";
|
|
||||||
$lines = file($f);
|
|
||||||
foreach($lines as $line) {
|
|
||||||
if(strpos($line, 'PASS') !== false) echo explode('=', $line)[0] . "=********\n";
|
|
||||||
else echo $line;
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
echo "[ERROR] File exists but NOT READABLE by " . `whoami` . "\n";
|
|
||||||
}
|
}
|
||||||
} else {
|
} 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