ok

Mini Shell

Direktori : /opt/cloudlinux/venv/lib64/python3.11/site-packages/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/__pycache__/cldetectlib.cpython-311.pyc

�

;G�f�H����ddlZddlZddlZddlZddlZddlmZmZmZddl	m
Z
ddlmZm
Z
dadadadadadadadZdZd	ZdZd
ZdZdZd
ZdZdadadZ dZ!dZ"ej#�$e��reZneZd�Z%d�Z&d=d�Z'd�Z(d�Z)d�Z*d�Z+d�Z,d�Z-d�Z.d�Z/d�Z0d�Z1d �Z2d!�Z3d"�Z4d#�Z5d$�Z6d%�Z7d&�Z8d'�Z9d(�Z:d)�Z;d*�Z<d+�Z=d,�Z>d-�Z?d.�Z@d/�ZAd0�ZBd1�ZCd2�ZDd3�ZEd4�ZFd5�ZGd6�ZHd7�ZId8�ZJd9�ZKd>d<�ZLdS)?�N)�ConfigParser�NoSectionError�
NoOptionError)�cpapi)�
SysCtlConf�SYSCTL_CL_CONF_FILE�0�apachez%/usr/local/lsws/conf/httpd_config.xmlz&/usr/local/lsws/conf/httpd_config.confz/usr/local/lsws/VERSIONz*/usr/lib/systemd/system/postgresql.servicez/etc/rc.d/init.d/postgresqlz/var/lock/cldeploy.lckz/etc/sysconfig/cloudlinuxz/etc/ssh/sshd_configzCloudLinux OS Shared ProzCloudLinux OS SharedzCloudLinux OS Soloc�H�tj�d��rdSdS)Nz/etc/cpanel/ea4/is_ea4TF��os�path�exists���py/cldetectlib.py�is_ea4rMs#��	�w�~�~�.�/�/���t��5rc�:�dadada	tj��}|da|da|dan#t
$rYnwxYw	t
dd���5}|���}tj	d	|��d
}tj	d|��d
}da|�d
|��a	ddd��dS#1swxYwYn#t
$rYnwxYwtj�d��rdadadStj�
d��rdadadStj�d��stj�
d��rdadadStj�
d��rdadadStj�
d��rdadadStj�
d��rdadadStj�d��rdadadStj�d��rd adadSd!S)"N�Unknown�0�name�version�additional_infoz/hsphere/shared/version�utf-8��encodingzRelease:\s+(.+)rzVersion:\s+(.+)�H-Sphere�.T�/lib64/libnss_ng.so�	HostingNG�none�/usr/local/cwpsrv�CentOS_WEB_Panel�'/etc/httpd/conf.d/atomia-pa-apache.conf�!/storage/configuration/cloudlinux�Atomia_agent�/usr/local/CyberCP�
Cyberpanel�
/var/phmgr�PlaneHoster�/usr/local/vesta�Vesta�/etc/virtualmin-license�VirtualminWebmin�/usr/local/webuzo/universal.php�WebuzoF)�CP_NAME�
CP_VERSION�CP_ISP_TYPEr�get_cp_description�	Exception�open�read�re�findallr
r�isfile�isdir)�
panel_data�f�data�releasers     r�getCPr@Ts���
�G��J��K�
��-�/�/�
��V�$���	�*�
� �!2�3�����
�
�
���
����	
�
�+�g�
>�
>�
>�	�!��6�6�8�8�D��j�!3�T�:�:�1�=�G��j�!3�T�:�:�1�=�G� �G�#�/�/�g�/�/�J��
	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	���
�
�
���
����

�w�~�~�+�,�,�����
��t�
�w�}�}�(�)�)��$���
��t�
�w�~�~�?�@�@���G�M�M�=�>�>�� ���
��t�	�w�}�}�)�*�*�����
��t�
�w�}�}�\�"�"�����
��t�
�w�}�}�'�(�(�����
��t�

�w�~�~�/�0�0��$���
��t�	�w�~�~�7�8�8�����
��t��5sF�+4�
A�A�C�AB8�+C�8B<�<C�?B<�C�
C�C�c���	t|dd���5}|���}ddd��n#1swxYwYn#t$r|cYSwxYw|D]�}|���}|�|��rb|�|��}t
|��dkr:|d���|kr|d���cS��|S)N�rrr�r�)r6�	readlines�IOError�strip�
startswith�split�len)�	file_name�
param_name�	separator�default_valr=�content�line�	linePartss        r�get_param_from_filerS�s2���
�)�S�7�
3�
3�
3�	$�q��k�k�m�m�G�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$����	$�	$�	$�	$����������������,�,���z�z�|�|���?�?�:�&�&�	,��
�
�9�-�-�I��I���!�#�#�)�A�,�*<�*<�*>�*>�*�*L�*L� ��|�)�)�+�+�+�+�+���s,�A�5�A�9�A�9�A�A�Ac��trtStj�d��rda�ntj�d��rda�n�tj�d��rda�n�tj�d��stj�d��rd	a�n�tj�d
��rda�nttj�d��rd
a�nQtj�d��rda�n.tj�d��rda�ntj�d��stj�d��rdan�tj�d��rdan�tj�d��rdan�tj�d��rdandtj�d��rdanBtj�d��rdan tj��}|r	|dand atS)!Nz/usr/local/cpanel/cpanel�cPanelz/usr/local/psa/version�Pleskz"/usr/local/directadmin/directadmin�DirectAdminz/usr/local/ispmgr/bin/ispmgrz/usr/local/mgr5�
ISPManagerz/usr/local/interworx�	InterWorxz/hsphere/sharedrrr r"r#r$r%r&r+r,r-r.r)r*r'r(r/r0rr)r1r
rr:r;rr4)r<s r�	getCPNamerZ�s������
�w�~�~�0�1�1�7 ����
����0�	1�	1�3 ����
����<�	=�	=�/ ����
����6�	7�	7�+ �2�7�=�=�IZ�;[�;[�+ ����
����-�	.�	.�' ����
����(�	)�	)�# ����	����-�	.�	.�! ����
����*�	+�	+� �$���	����A�	B�	B� ��w�}�}�@�A�A� � ���	����)�	*�	*� ����	����1�	2�	2� �$���	����|�	$�	$� ����	����+�	,�	,�
 ����	����9�	:�	:�
 �����-�/�/�
��	 � ��(�G�G��G��Nrc�,�ddlm}i}t��}|dkr||d<|dkr|d��}n
|��}|���}d}hd�}|���D]}d}	|D]}
|
j|vrd	}	n�|	s|d
z
}�||d<||d<d
S)z�
    Add server statistics to status_report dict
    :param status_report: dict to add statistics to
    :type status_report: dict
    r)�ClPwdr�cprVi'>4�	iworx-pma�	iworx-web�iworx-horde�iworx-backup�iworx-sqmail�sw-cp-server�
avahi-autoipd�iworx-roundcube�systemd-network�systemd-bus-proxy�exim�admin�cpses�drweb�iworx�lsadm�munin�mysql�nginx�viapmr
�clamav�cpanel�nagios�psaadm�psaftp�dovecot�mailman�polkitd�popuser�varnish�webapps�diradmin�dovenull�firebird�saslauth�	majordomo�	nfsnobody�cpanelhorde�cpanellogin�
cpanelrrdtool�
horde_sysuser�cpanellogaholic�cpanelphpgadmin�cpanelroundcube�cpaneleximfilter�cpanelphpmyadmin�cpanelphppgadmin�cpaneleximscanner�roundcube_sysuser�cpanelconnecttrack�iworx_support_userFTrE�users�clnN)�clcommonr\rZ�get_uid_dict�values�pw_name)�
status_reportr\�res�cp_name�clpwd�dr��	sys_users�
pw_entries�found�entrys           r�add_server_statsr�s���������
�C��k�k�G��)�����D�	��'�����e����������
�����A�
�E�	�	�	�I��h�h�j�j���
����	�	�E��}�	�)�)�����*��	��Q�J�E���C��L��M�%���rc�<�trtStj�t��s.tdtzdz��t
jd��	tdd���}|�	t��|�
dd������d��d	kr)|�
dd�����an�	t��|�
dtd
z��}tj�|��st�t!j|gt jt jd���5}|���\}}ddd��n#1swxYwY|���an#t(t*tf$rd
aYnwxYwtS#t,$r2tdtzdz��t
jd��YdSwxYw)NzError: missing z
 config file.rEF)�
interpolation�strict�
license_check�EMAIL�@����_getemail_scriptT��stdout�stderr�textzroot@localhost.localdomainzError: bad )�CP_ADMIN_EMAILr
rr:�CL_CONFIG_FILE�print�sys�exitrr7�getrH�findrZr1�FileNotFoundError�
subprocess�Popen�PIPE�communicaterrr5)�parser�get_email_script�proc�out�_s     r�getCPAdminEmailr�+s3������
�7�>�>�.�)�)��
��.�0�?�B�C�C�C���������D�%*�,�,�,�����N�#�#�#��:�:�o�w�/�/�5�5�7�7�<�<�S�A�A�R�G�G�#�Z�Z���A�A�G�G�I�I�N�N�
>�����#)�:�:�o�w�I[�?[�#\�#\� ��w�~�~�&6�7�7�,�+�+��%�%�&�%�?�%�?��	���0�
�!�-�-�/�/�F�C��
0�0�0�0�0�0�0�0�0�0�0����0�0�0�0�"%��������"�M�3D�E�
>�
>�
>�!=����
>�����������
�m�n�,��>�?�?�?�������������s\�"BG�6A?F9�5F�
F9�F�F9� F�!F9�8G�9G�G�G�	G�8H�Hc�@�tj�d��S)Nz/etc/cxs)r
rr;rrr�	CXS_checkr�Ps��
�7�=�=��$�$�$rc�v�t��tdkrdStj�d��S)NrUFz&/usr/local/apache/modules/mod_suphp.so)rZr1r
rr:rrr�mod_suPHP_checkr�Vs0��
�K�K�K��(����u�
�7�>�>�B�C�C�Crc���t��tdkrdStdkrdatdkrda	t	jt��jan#t$rYnwxYwdS)NrFrU�nobodyr�httpdT)	rZr2r1�APACHE_UNAME�pwd�getpwnam�pw_gid�
APACHE_GIDr5rrr�get_apache_gidr�_s{��
�K�K�K��S����u��(������*�����
��\�,�/�/�6�
�
���
�
�
���
�����4s�A�
A#�"A#c�:�t��p
t��S)z�
    LiteSpeed can be enterprise or open source, and each of them
    stores config in different formats
    So this checker will search for one of them
    )�detect_enterprise_litespeed�detect_open_litespeedrrr�detect_litespeedr�vs��'�(�(�C�,A�,C�,C�Crc�J�tj�t��S)z*
    Detects LSWS Enterprise presence
    )r
rr:�LITESPEED_CONFIG_FILErrrr�r�s���7�>�>�/�0�0�0rc�J�tj�t��S)z(
    Detects OpenLiteSpeed presence
    )r
rr:�LITESPEED_OPEN_CONFIG_FILErrrr�r��s���7�>�>�4�5�5�5rc���	ttdd���5}|������cddd��S#1swxYwYdS#tt
tf$rYdSwxYw)z\
    Determine Litespeed version.
    Works for both LSWS Enterprise and OpenLiteSpeed.
    rCrrNrA)r6�LITESPEED_VERSION_FILEr7rHr��OSErrorrG)r=s r�get_litespeed_versionr��s���
�
�(�#��
@�
@�
@�	$�A��6�6�8�8�>�>�#�#�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$����	$�	$�	$�	$�	$�	$���w��0�����r�r����s3�A�&A�A�A�A�A�A�A4�3A4c�J�tj�t��S�N)r
rr:�POSTGRE_SERVER_FILErrr�detect_postgresqlr��s��
�7�>�>�-�.�.�.rc��t��tdkrdS	tdd���5}|���}ddd��n#1swxYwY|�d��d�d��d	�d
��d���S#t$rYdSwxYw)
NrWFz,/usr/local/directadmin/conf/directadmin.confrrz	admindir=rE�
r�/r�ri)rZr1r6r7rJrHr5)r=r�s  r�detect_DA_adminr��s���
�K�K�K��-����u��
�@�7�
S�
S�
S�	�WX��&�&�(�(�C�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	��y�y��%�%�a�(�.�.�t�4�4�Q�7�=�=�c�B�B�2�F�L�L�N�N�N�������w�w����s5�B9�A�B9�A�B9�A�A!B9�9
C�Cc�T�tj�t��sdS	t	td���5}t|�����}ddd��n#1swxYwYtj�d|����S#t$rYdSwxYw)NFrr�/proc/)	r
rr:�CL_SETUP_LOCK_FILEr6�intr7r;r5)r=�pids  r�check_CL_installingr��s���
�7�>�>�,�-�-���u��
�$�w�
7�
7�
7�	 �1��a�f�f�h�h�-�-�C�	 �	 �	 �	 �	 �	 �	 �	 �	 �	 �	 ����	 �	 �	 �	 ��w�}�}�^�c�^�^�,�,�,�������u�u����s4�B�"A,� B�,A0�0B�3A0�4$B�
B'�&B'c��tj�d��sdS	tjd��jadS#t$rYdSwxYw)Nz/usr/local/nagiosFrtT)r
rr;r�r�r��
NAGIOS_GIDr5rrr�
get_nagiosr��s\��
�7�=�=�,�-�-���u���\�(�+�+�2�
��t�������u�u����s�>�
A�Ac�0�tddd��}|dkS)Nz//usr/local/directadmin/custombuild/options.conf�
cloudlinux�=�yes)rS)�check_results r�da_check_optionsr��s!��&�'X�Zf�hk�l�l�L��5� � rc�~�ttd���}|�d��}|�t|��n|S)z/get fs.enforce_symlinksifowner from sysctl confF)�config_file�mute_errorszfs.enforce_symlinksifowner)rrr�r�)�sysctl�values  r�get_symlinksifownerr��s<��
�$7�U�
K�
K�
K�F��J�J�3�4�4�E��*�3�u�:�:�:��5rc�:�t�t��tSr�)�SUEXEC_ENABLED�detect_suEXEC_suPHPrrr�get_suEXEC_statusr��s���������rc�:�t�t��tSr�)�
SUPHP_ENABLEDr�rrr�get_suPHP_statusr��s���������rc�B�dadat��}|�dSd|vad|vadS)NF�
suexec_module�suphp_module)r�r��get_apache_modules)�moduless rr�r��s;��
�N��M� �"�"�G�����$��/�N�"�g�-�M�M�Mrc��d}	tj|dgtjtjd���5}|���\}}ddd��n#1swxYwYg}|�d��}|dd�D]b}|s�	|����d��d}n#t$rd	}YnwxYw|d	kr�M|�|���c|S#ttf$rYdSwxYw)
Nz/usr/sbin/httpdz-MTr�r�rE� rrA)
r�r�r�r�rJrH�
IndexError�appendr�rG)�bin_execr�r�r�rrQ�mods       rr�r��ss�� �H��
�
�
�t���?��?��	
�
�
�	(�
��%�%�'�'�F�C��
	(�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(����	(�	(�	(�	(����i�i��o�o������G�	 �	 �D��
��
��j�j�l�l�(�(��-�-�a�0�����
�
�
�����
�����b�y�y���N�N�3���������W������t�t����sX�.C'�A�
C'�A�C'�A�)C'�-B6�5C'�6C�C'�C�!C'�'C<�;C<c��tj|ddtjdd���5}|���dcddd��S#1swxYwYdS)z0
    Executes command with bash interpreter
    Tz	/bin/bashr�)�shell�
executabler�r��bufsizerN)r�r�r�r�)�commandr�s  r�executers���
�	������
��

�
�
�%�
����!�!�!�$�%�%�%�%�%�%�%�%�%�%�%�%����%�%�%�%�%�%s�A�A�Ac�r�	t��r8tdt|t��dz��zdz��}n4tdt|t����zdz��}|�d��dkS#t
$rYdSttf$rYdSwxYw)Nz/usr/bin/strings �_ea4z | grep jailz
jail errorr�F)rr�strrZr��KeyErrorrGr�)�location�results  r�check_binary_has_jailr#s���
��8�8�	`��0�3�x�	���f�@T�7U�3V�3V�V�Yg�g�h�h�F�F��0�3�x�	���7L�3M�3M�M�P^�^�_�_�F��{�{�<�(�(�B�.�.�������t�t��W������u�u����s�BB�
B6�"B6�5B6c��	td��}|�d��dkS#ttf$rYdSwxYw)Nz/usr/sbin/sshd -T | grep usepamz
usepam yesr�)rr�rGr�)rs r�check_SSHd_UsePAMr2sS����:�;�;���{�{�<�(�(�B�.�.���W������t�t����s�'*�?�?c�4�t�t��dSdSr�)r1rZrrr�init_cp_namer:s�����������rc�4�t��tdkS)NrW�rr1rrr�is_darAs���N�N�N��m�#�#rc�4�t��tdkS)NrXrrrr�
is_ispmanagerrGs���N�N�N��l�"�"rc�,�t��tSr�)rr3rrr�ispmanager5_typerNs���N�N�N��rc��tdkS)N�Master)r3rrr�ispmanager5_is_masterr!Ts
���(�"�"rc�4�t��tdkS)NrUrrrr�	is_cpanelr#Ys���N�N�N��h��rc�4�t��tdkS)NrVrrrr�is_pleskr%_s���N�N�N��g��rc�4�t��tdkS)NrYrrrr�is_internetworxr'e����N�N�N��k�!�!rc�4�t��tdkS)Nrrrrr�
is_hspherer*ks���N�N�N��j� � rc�4�t��tdkS)Nr rrrr�is_hostingngr,qr(rc�4�t��tdkS)Nrrrrr�
is_unknownr.ws���N�N�N��i��rc�P�tj��}td|�d�d���5}|D]a}|�d��rJ|�d��d���}t
|��ccddd��S�b	ddd��n#1swxYwYd	S)
zD
    Returns 0 if there is no openvz, otherwise returns node id
    r�z/statusrrzenvID:�:rENr)r
�getpidr6rIrJrHr�)r�r=rQ�env_ids    r�	is_openvzr3|s��
�)�+�+�C�	
�#�s�#�#�#�g�	6�	6�	6�#�!��	#�	#�D����x�(�(�
#����C����+�1�1�3�3���6�{�{�"�"�	#�#�#�#�#�#�#�#�
#�	#�#�#�#�#�#�#�#�#�#�#�#����#�#�#�#�

�1s�AB�
B�B�"Bc�@�tj�d��S)Nz/usr/sbin/cagefsctlrrrr�is_cagefs_installedr5�s��
�7�>�>�/�0�0�0rr�Tc�\�t|||d���}|�|S|���dvS)N)rO)�true�1r��on)rS�lower)rLrMrNrO�
config_vals     r�get_boolean_paramr<�s=��$�Y�
�I�SW�X�X�X�J����������!;�;�;r)NrA)r�T)Mr
r�r8r�r��configparserrrrr�r�clcommon.sysctlrrr1r2r3r�r�r�r�r�r�r�r��POSTGRE_SYSTEMD_PATH�POSTGRE_INITD_PATHr�r��USEPAM_FILEr�r��!SHARED_PRO_EDITION_HUMAN_READABLE�SHARED_EDITION_HUMAN_READABLE�SOLO_EDITION_HUMAN_READABLErr:rr@rSrZr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrrrr!r#r%r'r*r,r.r3r5r<rrr�<module>rEs���B
�	�	�	�
�
�
�
�	�	�	�	�����
�
�
�
�D�D�D�D�D�D�D�D�D�D�������;�;�;�;�;�;�;�;���
�
�����
�
�
�
���?��E��2����C��2��-��,��$�����
�$>�!� 6��2���7�>�>�&�'�'�-�.���,�����Y�Y�Y�z���� ?�?�?�D$�$�$�P!�!�!�J%�%�%�D�D�D����.D�D�D�1�1�1�6�6�6�
�
�
�/�/�/�

�
�
�	�	�	�	�	�	�!�!�!�
6�6�6�������.�.�.����>%�%�%� ���������$�$�$�#�#�#����#�#�#�
������"�"�"�!�!�!�"�"�"� � � �


�

�

�1�1�1�<�<�<�<�<�<r

Zerion Mini Shell 1.0