__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
3
m��i � @ s4 d dl Z d dlmZmZ dd� Zdd� Zdd� ZdS ) � N)�PIPE�Popenc C sf t jjd�std��d} t| dttd�}dd� |j� D �\}}|rPtd|� ���t|d d� jd
��S )z�
Get user count using the common CloudLinux library.
This number is more accurate for systems
with a control panel installed.
z/opt/cloudlinux/venv/binz(CloudLinux virtual environment not foundzZ/opt/cloudlinux/venv/bin/python3 -c "from clcommon.cpapi import cpusers; print(cpusers())"T)�shell�stdout�stderrc S s g | ]}|j � j� �qS � )�decode�strip)�.0�resultr r � /usr/lib/python3.6/statistics.py�
<listcomp> s z.get_users_count_from_cllib.<locals>.<listcomp>z-Failed to get users from CloudLinux library: � z, ���) �os�path�exists�
ValueErrorr r Zcommunicate�len�split)�cmdZprocess�output�errorsr r r �get_users_count_from_cllib s r c C s ddl m} | � }t|j� �S )zY
Fallback method to get the user count
by looking into the /etc/passwd file.
r )�ClPwd)Zup2date_client.clpwdr r Zget_uid_dict)r �pwdr r r �get_users_count_generic s r c C s* y
t � } W n tk
r$ t� } Y nX | S )z�
Get the total count of users on the server.
Tries the CloudLinux library first, falls back to generic method if it fails.
)r � Exceptionr )Zusers_countr r r �count_server_users"