✘✘ GRAYBYTE WORDPRESS FILE MANAGER ✘✘

​🇳​​🇦​​🇲​​🇪♯➤ premium290.web-hosting.com ​🇻​♯➤ 4.18.0-553.45.1.lve.el8.x86_64 #1 SMP 🇾​♯➤ 2025

𝗛𝗢𝗠𝗘 𝗜𝗗 ♯➤ 63.250.38.37 ♯➤ 𝗔𝗗𝗠𝗜𝗡 𝗜𝗗 216.73.216.150
𝗢𝗣𝗧𝗜𝗢𝗡𝗦 ♯ CRL ♯➤ 𝗢𝗞 ┃ WGT ♯➤ 𝗢𝗞 ┃ SDO ♯➤ 𝗢𝗙𝗙 ┃ PKEX ♯➤ 𝗢𝗙𝗙
𝗗𝗘𝗔𝗖𝗧𝗜𝗩𝗔𝗧𝗘𝗗 ♯➤ 𝗔𝗟𝗟 𝗪𝗢𝗥𝗞𝗜𝗡𝗚....

𝗛𝗢𝗠𝗘
𝗖𝗨𝗥𝗥𝗘𝗡𝗧 𝗙𝗜𝗟𝗘 : /opt/cloudlinux/venv/lib/python3.11/site-packages/clcagefslib/webisolation/crontab//structure.py
# -*- coding: utf-8 -*-
#
# Copyright © Cloud Linux GmbH & Cloud Linux Software, Inc 2010-2025 All Rights Reserved
#
# Licensed under CLOUD LINUX LICENSE AGREEMENT
# http://cloudlinux.com/docs/LICENCE.TXT
#
"""Data structures for crontab representation."""

import logging
import shlex
from dataclasses import dataclass
from typing import Dict, List, Optional, Union

from .constants import ISOLATION_WRAPPER

logger = logging.getLogger(__name__)


@dataclass
class CommentLine:
    """Represents a comment or empty line in crontab."""

    content: bytes


@dataclass
class BeginWebsite:
    """Represents a website cron begin marker."""

    docroot: str


@dataclass
class EndWebsite:
    """Represents a website cron end marker."""

    pass


@dataclass
class ParsedCrontabLine:
    """Represents a parsed crontab entry."""

    schedule: bytes
    command: bytes  # Command with wrapper prefix if present

    def _parse_wrapper_command(self) -> Optional[tuple[str, str]]:
        """
        Parse command to extract docroot and clean command if it has isolation wrapper.

        Returns:
            Optional[tuple[str, str]]: (docroot, clean_command) if wrapper found, None otherwise
        """
        # Quick check: only attempt parsing if command starts with wrapper
        # avoid expensive shlex.split() for non-wrapped command
        command_str = self.command.rstrip(b"\n").decode("utf-8", errors="replace")
        if not command_str.startswith(ISOLATION_WRAPPER):
            return None

        try:
            parts = shlex.split(command_str)

            # Check if command matches expected format:
            # [ISOLATION_WRAPPER, docroot, "bash", "-c", command]
            if (
                len(parts) >= 5
                and parts[0] == ISOLATION_WRAPPER
                and parts[2] == "bash"
                and parts[3] == "-c"
            ):
                docroot = parts[1]
                # The command is everything after "bash -c", which shlex.split() already unescaped
                clean_command = parts[4] if len(parts) == 5 else " ".join(parts[4:])
                return docroot, clean_command
            else:
                # Command starts with wrapper but doesn't match expected format
                logger.error(
                    "Failed to parse wrapper command: command doesn't match expected format. "
                    "Expected: [%s, docroot, 'bash', '-c', command]. Got: %s",
                    ISOLATION_WRAPPER,
                    command_str[:200] if len(command_str) > 200 else command_str,
                )
        except (ValueError, IndexError) as e:
            # shlex.split() failed (e.g., unclosed quotes)
            logger.error(
                "Failed to parse wrapper command with shlex.split(): %s. Command: %s",
                e,
                command_str[:200] if len(command_str) > 200 else command_str,
            )
        return None

    def get_docroot(self) -> Optional[str]:
        """
        Extract docroot from command if it has isolation wrapper prefix.

        Returns:
            Optional[str]: The document root if command has wrapper prefix, None otherwise
        """
        result = self._parse_wrapper_command()
        return result[0] if result else None

    def get_clean_command(self) -> bytes:
        """
        Get command without wrapper prefix.

        Returns:
            bytes: Command without wrapper prefix, or original command if no wrapper
        """
        result = self._parse_wrapper_command()
        if result:
            clean_cmd_str = result[1]
            clean_cmd = clean_cmd_str.encode("utf-8")

            # Preserve line ending (always \n on Linux)
            if self.command.endswith(b"\n"):
                if not clean_cmd.endswith(b"\n"):
                    clean_cmd += b"\n"
            return clean_cmd
        return self.command


# Type alias for crontab entry types
CrontabEntry = Union[ParsedCrontabLine, CommentLine, BeginWebsite, EndWebsite]


@dataclass
class CrontabStructure:
    """Structure representing parsed crontab entries."""

    global_records: List[CrontabEntry]
    docroot_sections: Dict[str, List[CrontabEntry]]


Current_dir [ 𝗡𝗢𝗧 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ] Document_root [ 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ]


[ Back ]
𝗡𝗔𝗠𝗘
𝗦𝗜𝗭𝗘
𝗟𝗔𝗦𝗧 𝗧𝗢𝗨𝗖𝗛
𝗨𝗦𝗘𝗥
𝗦𝗧𝗔𝗧𝗨𝗦
𝗙𝗨𝗡𝗖𝗧𝗜𝗢𝗡𝗦
..
--
23 Jun 2026 7.00 AM
root / root
0755
__pycache__
--
23 Jun 2026 7.00 AM
root / root
0755
__init__.py
0.536 KB
29 May 2026 9.37 AM
root / root
0644
constants.py
0.844 KB
29 May 2026 9.37 AM
root / root
0644
libhooks.py
6.83 KB
29 May 2026 9.37 AM
root / root
0644
parser.py
4.481 KB
29 May 2026 9.37 AM
root / root
0644
processor.py
6.658 KB
29 May 2026 9.37 AM
root / root
0644
structure.py
4.106 KB
29 May 2026 9.37 AM
root / root
0644
utils.py
1.432 KB
29 May 2026 9.37 AM
root / root
0644

✘✘ GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME ✘✘
Static GIF Static GIF