HEX
Server: LiteSpeed
System: Linux lt-bnk-web1368.main-hosting.eu 5.14.0-611.26.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jan 29 05:24:47 EST 2026 x86_64
User: u362014288 (362014288)
PHP: 8.2.30
Disabled: system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
Upload Files
File: /home/u362014288/domains/graucaturismo.com.br/public_html/wp-admin/network/Aybolit_v2.php
<?php
// WP Emergency Files Helper with self-destruct
// Upload to WordPress root, open in browser, use, then DELETE (or use self-destruct).

$SCRIPT_NAME = basename(__FILE__);
$BASE_DIR    = __DIR__;

// Target files
$targets = [
    'htaccess' => [
        'label' => '.htaccess',
        'path'  => $BASE_DIR . '/.htaccess',
    ],
    'index' => [
        'label' => 'index.php',
        'path'  => $BASE_DIR . '/index.php',
    ],
    'blog_header' => [
        'label' => 'wp-blog-header.php',
        'path'  => $BASE_DIR . '/wp-blog-header.php',
    ],
];

$statusMessages = [];
$selfDestructMessage = '';

// Default contents (точно как в твоём Project)
function default_htaccess()
{
    return <<<HTA
# BEGIN WordPress

RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

HTA;
}

function default_index_php()
{
    return <<<IDX
<?php
/**
 * Front to the WordPress application. This file doesn't do anything, but loads
 * wp-blog-header.php which does and tells WordPress to load the theme.
 *
 * @package WordPress
 */

/**
 * Tells WordPress to load the WordPress theme and output it.
 *
 * @var bool
 */
define( 'WP_USE_THEMES', true );

/** Loads the WordPress Environment and Template */
require __DIR__ . '/wp-blog-header.php';

IDX;
}

function default_wp_blog_header()
{
    return <<<BLOG
<?php
/**
 * Loads the WordPress environment and template.
 *
 * @package WordPress
 */

if ( ! isset( \$wp_did_header ) ) {

	\$wp_did_header = true;

	// Load the WordPress library.
	require_once __DIR__ . '/wp-load.php';

	// Set up the WordPress query.
	wp();

	// Load the theme template.
	require_once ABSPATH . WPINC . '/template-loader.php';

}

BLOG;
}

// Helper: write content with basic error handling
function write_file_result($path, $content)
{
    $dir = dirname($path);
    if (!is_dir($dir)) {
        return "Directory does not exist: " . $dir;
    }

    if (file_put_contents($path, $content) === false) {
        return "Failed to write file: " . $path;
    }

    return "OK";
}

// Handle actions
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $action = isset($_POST['action']) ? $_POST['action'] : '';

    // Self-destruct
    if ($action === 'selfdestruct') {
        $path = __FILE__;
        if (is_writable($path)) {
            $deleted = @unlink($path);
            if ($deleted) {
                $selfDestructMessage = 'This script file has been deleted from the server. Close this tab.';
            } else {
                $selfDestructMessage = 'Failed to delete script. Remove it manually: ' . htmlspecialchars($SCRIPT_NAME, ENT_QUOTES, 'UTF-8');
            }
        } else {
            $selfDestructMessage = 'Script is not writable. Remove it manually: ' . htmlspecialchars($SCRIPT_NAME, ENT_QUOTES, 'UTF-8');
        }
    }

    // Replace content with default (перезапись)
    if (strpos($action, 'replace_') === 0) {
        $key = substr($action, strlen('replace_'));
        if (isset($targets[$key])) {
            $target = $targets[$key];
            $path = $target['path'];

            if ($key === 'htaccess') {
                $content = default_htaccess();
            } elseif ($key === 'index') {
                $content = default_index_php();
            } else {
                $content = default_wp_blog_header();
            }

            $res = write_file_result($path, $content);
            if ($res === 'OK') {
                $statusMessages[] = $target['label'] . ' replaced with default content.';
            } else {
                $statusMessages[] = 'Error for ' . $target['label'] . ': ' . $res;
            }
        }
    }

    // Delete and recreate with SAME default (не пустой!)
    if (strpos($action, 'recreate_') === 0) {
        $key = substr($action, strlen('recreate_'));
        if (isset($targets[$key])) {
            $target = $targets[$key];
            $path = $target['path'];

            if (file_exists($path) && !is_writable($path)) {
                $statusMessages[] = 'Cannot modify ' . $target['label'] . ': file is not writable.';
            } else {
                if (file_exists($path)) {
                    @unlink($path);
                }

                if ($key === 'htaccess') {
                    $content = default_htaccess();
                } elseif ($key === 'index') {
                    $content = default_index_php();
                } else {
                    $content = default_wp_blog_header();
                }

                $res = write_file_result($path, $content);
                if ($res === 'OK') {
                    $statusMessages[] = $target['label'] . ' deleted and recreated with default content.';
                } else {
                    $statusMessages[] = 'Error for ' . $target['label'] . ': ' . $res;
                }
            }
        }
    }
}

// Helper: show file state
function file_state_badge($path)
{
    if (!file_exists($path)) {
        return '<span style="color:#fca5a5;">missing</span>';
    }
    $size = filesize($path);
    return '<span style="color:#a5b4fc;">exists (' . (int)$size . ' bytes)</span>';
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>WP Emergency Files</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style>
        * { box-sizing: border-box; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }
        body {
            margin: 0;
            padding: 16px;
            background: #0f172a;
            color: #e5e7eb;
            display: flex;
            align-items: center;
            justify-content: center;
            min-height: 100vh;
        }
        .card {
            max-width: 520px;
            width: 100%;
            padding: 20px 18px;
            background: #020617;
            border-radius: 12px;
            border: 1px solid #1f2937;
            box-shadow: 0 18px 45px rgba(15,23,42,0.8);
        }
        h1 {
            margin: 0 0 8px;
            font-size: 18px;
        }
        p { margin: 4px 0; font-size: 13px; color: #9ca3af; }
        .danger {
            margin-top: 8px;
            padding: 8px 10px;
            background: #451a1a;
            border-radius: 6px;
            color: #fecaca;
            font-size: 12px;
        }
        table {
            width: 100%;
            margin-top: 14px;
            border-collapse: collapse;
            font-size: 12px;
        }
        th, td {
            padding: 6px 4px;
            text-align: left;
        }
        th {
            color: #9ca3af;
            font-weight: 500;
            border-bottom: 1px solid #1f2937;
        }
        tr + tr td {
            border-top: 1px solid #111827;
        }
        code {
            background: #020617;
            padding: 1px 4px;
            border-radius: 4px;
            font-size: 11px;
        }
        .btn-row {
            display: flex;
            gap: 4px;
            flex-wrap: wrap;
        }
        button {
            border: none;
            cursor: pointer;
            font-size: 11px;
            font-weight: 600;
            border-radius: 999px;
            padding: 6px 10px;
            white-space: nowrap;
        }
        .btn-main {
            background: #38bdf8;
            color: #0f172a;
        }
        .btn-main:hover { background: #0ea5e9; }
        .btn-soft {
            background: #111827;
            color: #e5e7eb;
            border: 1px solid #1f2937;
        }
        .btn-soft:hover { background: #1f2937; }
        .btn-danger {
            background: #b91c1c;
            color: #fee2e2;
        }
        .btn-danger:hover { background: #dc2626; }
        .footer-actions {
            margin-top: 14px;
            display: flex;
            flex-direction: column;
            gap: 8px;
        }
        .status {
            margin-top: 10px;
            padding: 8px 10px;
            border-radius: 6px;
            background: #020617;
            border: 1px solid #1f2937;
            font-size: 12px;
        }
        .status ul {
            margin: 4px 0 0;
            padding-left: 16px;
        }
        .status li { margin: 2px 0; }
        .filename {
            font-size: 11px;
            color: #9ca3af;
            margin-top: 4px;
        }
    </style>
</head>
<body>
<div class="card">
    <h1>WP Emergency Files</h1>
    <p>Quick tools for <code>.htaccess</code>, <code>index.php</code> and <code>wp-blog-header.php</code> in this folder.</p>
    <p class="filename">
        Script file: <code><?php echo htmlspecialchars($SCRIPT_NAME, ENT_QUOTES, 'UTF-8'); ?></code>
    </p>
    <div class="danger">
        After you finish restoring the site, remove this script from the server (or use self-destruct).
    </div>

    <table>
        <tr>
            <th>File</th>
            <th>Status</th>
            <th>Actions</th>
        </tr>
        <?php foreach ($targets as $key => $t): ?>
            <tr>
                <td><code><?php echo htmlspecialchars($t['label'], ENT_QUOTES, 'UTF-8'); ?></code></td>
                <td><?php echo file_state_badge($t['path']); ?></td>
                <td>
                    <div class="btn-row">
                        <form method="post" style="margin:0;">
                            <input type="hidden" name="action" value="<?php echo 'replace_' . htmlspecialchars($key, ENT_QUOTES, 'UTF-8'); ?>">
                            <button class="btn-main" type="submit">Replace with default</button>
                        </form>
                        <form method="post" style="margin:0;">
                            <input type="hidden" name="action" value="<?php echo 'recreate_' . htmlspecialchars($key, ENT_QUOTES, 'UTF-8'); ?>">
                            <button class="btn-soft" type="submit">Delete & recreate (default)</button>
                        </form>
                    </div>
                </td>
            </tr>
        <?php endforeach; ?>
    </table>

    <div class="footer-actions">
        <form method="post" onsubmit="return confirm('Delete this script file (<?php echo htmlspecialchars($SCRIPT_NAME, ENT_QUOTES, 'UTF-8'); ?>) from the server?');">
            <input type="hidden" name="action" value="selfdestruct">
            <button class="btn-danger" type="submit">Self-destruct this script</button>
        </form>
    </div>

    <?php if (!empty($statusMessages) || $selfDestructMessage): ?>
        <div class="status">
            <?php if ($selfDestructMessage): ?>
                <div style="margin-bottom:4px;"><?php echo htmlspecialchars($selfDestructMessage, ENT_QUOTES, 'UTF-8'); ?></div>
            <?php endif; ?>
            <?php if (!empty($statusMessages)): ?>
                <ul>
                    <?php foreach ($statusMessages as $msg): ?>
                        <li><?php echo htmlspecialchars($msg, ENT_QUOTES, 'UTF-8'); ?></li>
                    <?php endforeach; ?>
                </ul>
            <?php endif; ?>
        </div>
    <?php endif; ?>
</div>
</body>
</html>