[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@13.59.88.8: ~ $
�

=�Dg�=��<�ddlZddlZddlZddlZddlZddlmZddlmZm	Z	m
Z
mZmZddl
mZddlmZddlmZGd�de��ZGd	�d
e��Zdeded
eeeffd�Zded
efd�Zdeeefd
efd�Zded
efd�Zdeeefd
efd�Zdeeefd
efd�Zd/dede
eed
e	efd�Zd�Zdefd�Zd�Z d�Z!dedefd �Z"d!ed"ed
e
efd#�Z#d!ed
e
efd$�Z$d0d&�Z%d'�Z&d1d)ed*efd+�Z'd/d*efd,�Z(d/d*efd-�Z)d.�Z*dS)2�N)�Path)�Union�Iterable�Optional�Tuple�List)�Enum)�ClPwd)�get_rhn_systemid_valuec��eZdZdZdZdZdS)�
PluginTypez2
    Plugin types that are currently detected
    zobject-cachezadvanced-cacheN)�__name__�
__module__�__qualname__�__doc__�OBJECT_CACHE�ADVANCED_CACHE���s/builddir/build/BUILD/imunify360-venv-2.4.0/opt/imunify360/venv/lib/python3.11/site-packages/clcommon/clwpos_lib.pyr
r
s$��������"�L�%�N�N�Nrr
c��eZdZdZdZdZdZdS)�	WpPluginszj
    Static WP plugin names, that are not detected
    dynamically from drop-in files, dir names, etc
    �Unknownz	WP Rocket�AccelerateWPN)rrrr�UNKNOWN�	WP_ROCKET�
ACCELERATE_WPrrrrrs)���������G��I�"�M�M�Mrr�line�is_multiline_comment�returnc�
�|r[d|vrdS|�d��}t|d|�d��\}}t||dzd�d��\}}||z|fSd|vr!|�d��}|d|�dfSd|vr!|�d��}|d|�dfSd	|vrU|�d	��}t|d|�d��\}}t||dzd�d��\}}||z|fS|dfS)
z�
    Yep, this bicycle is needed to handle different comment types in .php file
    https://www.php.net/manual/en/language.basic-syntax.comments.php
    and ensure that needed line is not under comment
    z*/)�TNT�Fz//�#z/*)�find�
clean_comment)rr�pos�part1�_�part2s      rr&r&'s;���7��t����8��)�)�D�/�/�C�$�T�$�3�$�Z��6�6�H�E�1�*7��S�1�W�X�X���*N�*N�'�E�'��5�=�"6�6�6��t�|�|��i�i��o�o���D�S�D�z�5� � �
�d�{�{��i�i��n�n���D�S�D�z�5� � ��t�|�|��i�i��o�o�� ��d�s�d��U�3�3���q�&3�D��q����N�D�&I�&I�#��#��u�}�2�2�2���;�r�filec�~�tj�|��}tj�|��S�N)�os�path�realpath�isfile)r+�
realpath_files  r�
_is_real_filer3Gs+���G�$�$�T�*�*�M�
�7�>�>�-�(�(�(r�abs_pathc�X�	tj�|d��}tj�|��rt	|��rdSn#t
$rYnwxYwtj�|tj��}tj�|d��}tj�|d��}tj�|��ot	|��}tj�|��o|ot	|��S)a&
    WordPress looks for wp-config.php file in the
    (1) WordPress root and (2) one directory above the root.

    Check that there is no wp-settings.php file in the second case.
    This check helps when there is a nested installation, e.g
    / is WordPress and /wp_path/ is WordPress.
    �
wp-config.phpTzwp-settings.php)r.r/�join�existsr3�OSError�pardir)r4�
wp_config_php�abs_path_level_up�wp_config_php_level_up�wp_settings_php�wp_settings_php_existss      r�_check_wp_config_phpr@Ls��
�����X��?�?�
�
�7�>�>�-�(�(�	�]�=�-I�-I�	��4����
�
�
���
��������X�r�y�9�9���W�\�\�*;�_�M�M���g�l�l�#4�6G�H�H�O��W�^�^�O�<�<�_���A_�A_��
�7�>�>�0�1�1�1�%�%�1��/�0�0�1s�AA�
A �A �dirc�~�tj�|��}tj�|��Sr-)r.r/r0�isdir)rA�realpath_dirs  r�_is_real_dirrEfs+���7�#�#�C�(�(�L�
�7�=�=��&�&�&rc��tj�|d��}dtj|��vot	|��S)z.
    Check wp-includes exists and is dir.
    zwp-includes)r.r/r7�listdirrE)r4�wp_includess  r�_check_wp_includesrIks;���'�,�,�x��7�7�K��B�J�x�0�0�0�N�\�+�5N�5N�Nrc���	tj�|��sdSn#t$rYdSwxYw	t	|��ot|��S#t$rYnwxYwdS)z�
    Checks whether passed directory is a wordpress directory
    by checking presence of wp-includes folder and wp-config.php file.
    F)r.r/r8r9r@rI)r4s r�
is_wp_pathrKss���
��w�~�~�h�'�'�	��5�	�������u�u�����
�#�H�-�-�N�2D�X�2N�2N�N���
�
�
���
�����5s�$�
2�2�A�
A!� A!�doc_root�excludesc#�<K�tj�|��sdSt|��rdV�t	|�����D]C}|���s�|rt|��|vr�+t|��r	|jV��DdS)z�
    Returns folder with wordpress
    Empty string is wp is in docroot dir

    :param doc_root:
        root path to start search from
    :param excludes:
        list of paths that must be excluded from search, e.g. subdomains
    Nr")	r.r/r8rKr�iterdir�is_dir�str�name)rLrMr/s   r�
find_wp_pathsrS�s������7�>�>�(�#�#�����(���������X���&�&�(�(�����{�{�}�}�	���	��D�	�	�X�-�-���d���	��)�O�O�O���rc�4�tjd|�d|�d���}t|dd���5}d}	|���}|sn7t	||��\}}|�|��r	d	d	d	��dS�N	d	d	d	��n#1swxYwYdS)
z8
    Looks for defined php variable with true value
    z^\s*define\s*\(\s*((\'z\')|(\"z\"))\s*,\s*true\s*\)\s*;�utf-8�ignore��encoding�errorsFTN)�re�compile�open�readliner&�match)�varr/�r�frr�cleaned_lines       r�_is_php_define_var_foundrc�s��	�
�V�S�V�V��V�V�V�W�W�A�	
�d�W�X�	6�	6�	6��!�$��	��:�:�<�<�D��
��1>�t�EY�1Z�1Z�.�L�.��w�w�|�$�$�
����������	���������������������5s�AB
�?B
�
B�B�wordpress_pathc��|�d��}tj�|��sdSt	d|��S)z�
    Detects whether plugin is really enabled,
    cause not all plugins are enabled 'on load'
    # https://kevdees.com/what-are-wordpress-drop-in-plugins/
    r6F�WP_CACHE)�joinpathr.r/r8rc)rd�	wp_configs  r�is_advanced_cache_enabledri�sB���'�'��8�8�I�
�7�>�>�)�$�$���u�#�J�	�:�:�:rc�f�t|���!td|��rtjjSdS)z�
    They are advising to check whether WP_ROCKET_ADVANCED_CACHE is defined
    to ensure plugin is working
    https://docs.wp-rocket.me/article/134-advanced-cache-error-message
    N�WP_ROCKET_ADVANCED_CACHE)�accelerate_wp_pluginrcrr�value)�drop_in_paths r�wp_rocket_pluginro�s6���L�)�)�1�$�%?��N�N�2��"�(�(��4rc���t|dd���5}d|���vrtjjcddd��S	ddd��n#1swxYwYdS)zB
    Checking if the plugin folder name exists in the drop-in
    rUrVrWz/clsopN)r\�readrrrm)rnras  rrlrl�s���
�l�W�X�	>�	>�	>�1�!��q�v�v�x�x����*�0�1�1�1�1�1�1�1�1��1�1�1�1�1�1�1�1�1�1�1����1�1�1�1��4s�'A�A�A�plugin_typec��|�d��}|�|�d���}tj�|��sdS|tjjkrt|��sdS|�d��}t||��p=t|��p.t|��pt|��ptj
j}|S)a
    Looking for object-cache.php or advanced-cache.php in wordpress folder
    If found - tries to find 'plugin-owner' of <-cache>.php by
    content comparison
    If cannot be found -> tries to read <-cache>.php headers looking for Plugin name: <Plugin>
    z
wp-contentz.phpN�plugins)rgr.r/r8r
rrmri�$get_wp_cache_plugin_by_scanning_dirs�get_wp_cache_plugin_by_headerrlrorr)rdrr�wp_content_dir�activated_cache�plugins_dir�plugin_names      r�get_wp_cache_pluginr{�s���$�,�,�\�:�:�N�$�-�-��.B�.B�.B�C�C�O�
�7�>�>�/�*�*���t��j�/�5�5�5�>W�Xf�>g�>g�5��t� �)�)�)�4�4�K�6���T�T�-�2�?�C�C�-�)�/�:�:�-�&�o�6�6�-��&�,�	��r�activated_pluginryc�Z�|���}tj�|��sdS|���D]`}tj|��D]I\}}}|j|vr:t|��|jz}|���|kr|jccS�J�adS)zT
    Scanning plugins/* dir and looking for similar <object/advanced_cache>.php
    N)�
read_bytesr.r/r8rO�walkrRr)r|ry�activated_plugin_bytes�plugin�root�dirs�files�plugin_object_cache_paths        rruru�s���.�8�8�:�:��
�7�>�>�+�&�&���t��%�%�'�'�'�'��!#�����	'�	'��D�$���$��-�-�+/��:�:�8H�8M�+M�(�+�6�6�8�8�<R�R�R�!�;�&�&�&�&�&��		'�
�4rc��tj�|��sdSd}tjdtj��}t
|dd���5}t|��D]P}|���}|�	|��}|�#|�
d��ccddd��S�Q	ddd��n#1swxYwYdS)zS
    Looking for Plugin name: <Some name> in <object/advanced.php>
    headers
    N�z-^.*plugin name:\s*(?P<plugin_name>[\w ]+)\s*$rUrVrWrz)r.r/r8rZr[�
IGNORECASEr\�ranger]�search�group)r|�max_top_lines_countr`rar)rr^s       rrvrv�s,��
�7�>�>�*�+�+���t���
�
�C�R�]�S�S�A�	
����	B�	B�	B�2�a��*�+�+�	2�	2�A��:�:�<�<�D��H�H�T�N�N�E�� ��{�{�=�1�1�1�1�2�2�2�2�2�2�2�2�!�	2�2�2�2�2�2�2�2�2�2�2�2����2�2�2�2��4s�AC�5C�C�
C�object_cachec�r�g}	t���|��}n#tj$rgcYSwxYwtj�|dd��}tj�|��sgS	t|dd���5}|���}ddd��n#1swxYwYtj
|��}n#t$rgcYSwxYw|�di���di��}	|D]%}
|
|	vr||	|
vr|�
|
���&|S)	z?
    Filter user`s wp paths with paths with enabled module
    z.clwposzclwpos_config.jsonrUrVrWN�docroots�public_html)r
�get_homedir�NoSuchUserExceptionr.r/r7r8r\rq�json�loads�	Exception�get�append)�user�
user_wp_pathsr��paths_with_enabled_module�home�configra�conf�data�modules_data�wp_paths           r� get_wp_paths_with_enabled_moduler�s���!#����w�w�"�"�4�(�(�����$�����	�	�	������W�\�\�$�	�+?�
@�
@�F�
�7�>�>�&�!�!���	��
�&�7�8�
<�
<�
<�	���6�6�8�8�D�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	��z�$�����������	�	�	������8�8�J��+�+�/�/�
�r�B�B�L� �6�6���l�"�"�v��g�1F�'F�'F�%�,�,�W�5�5�5��$�$sB�!&�:�:�C�B3�'C�3B7�7C�:B7�;C�C"�!C"c	��g}tj�d��s|�d��tj�d��s|�d��tj�d��s|�d��|r?gd�|z}t	j|ddd	�
��}t
jd|j|j	��tj�d��s:t	jdd
gddd	�
��}t
jd|j|j	��t	jgd�ddd	�
��}t
jd|j|j	��td��}|rRt	jddd|�dd��gddd	�
��}t
jd|j|j	��dSdS)N�/usr/bin/cloudlinux-awp-adminz
accelerate-wpz /usr/sbin/cloudlinux-ssa-managerzalt-php-ssaz/usr/sbin/cloudlinux-xray-agentzalt-php-xray)�yum�installz-yTF)�capture_output�text�checkz:Installing AccelerateWP packages captured out: %s, err: %sz/usr/share/clos_ssa/ssa_enabledz
enable-ssaz(Activation SSA captured out: %s, err: %s)z /usr/sbin/cloudlinux-autotracing�enablez--allz0Activation autotracing captured out: %s, err: %s�	system_idz!/usr/sbin/cloudlinux-xray-managerzenable-user-agentz--system_idzID-r"z1Activation xray manager captured out: %s, err: %s)r.r/r8r��
subprocess�run�logging�debug�stdout�stderrr�replace)�packages�install_command�procr�s    r�install_accelerate_wpr�/s����H�
�7�>�>�9�:�:�)�����(�(�(�
�7�>�>�<�=�=�'����
�&�&�&�
�7�>�>�;�<�<�(�����'�'�'��n�2�2�2�X�=���~�o�d��UZ�[�[�[���
�R�TX�T_�ae�al�m�m�m�
�7�>�>�;�<�<�\��~�A�<�P�-1��E�K�K�K���
�@�$�+�t�{�[�[�[��>�?�?�?��
��	���D��M�D�d�k�SW�S^�_�_�_�&�{�3�3�I��e��~�
0�2E�}�V_�Vg�Vg�hm�oq�Vr�Vr�s����	
�
�
��	�
�I�4�;�X\�Xc�d�d�d�d�d�e�erF�async_set_suite�sourcec�t�t��tj�d��rdSgd�}|dkr|�ddg��|r-tj|t
jt
j���dStj|ddd���}tj
d	|j|j��dS)
zh
    1. Installs needed packages
    2. Enables autotracing
    3. Allows AccelerateWP Free for all
    z8/var/clwpos/admin/allowed_for_all_site_optimization.flagN)r��	set-suite�--allowed-for-all�--suites�
accelerate_wp�BILLING_OVERRIDE�--source)r�r�T�r�r�r�z6Activation AccelerateWP Free captured out: %s, err: %s)
r�r.r/r8�extendr��Popen�PIPEr�r�r�r�r�)r�r��commandr�s    r�configure_accelerate_wpr�Us�������	�w�~�~�P�Q�Q���� � � �G��#�#�#����
�$6�7�8�8�8��j�����?��?�	
�	
�	
�	
�	
�	
��~�g�T�$�T�R�R�R���
�N�PT�P[�]a�]h�i�i�i�i�irc��t��tj�d��rdSgd�}|dkr|�gd���tj|ddd���}tjd|j	|j
��dS)Nz3/var/clwpos/admin/allowed_for_all_object_cache.flag)r�r��--visible-for-allr��accelerate_wp_premiumr��r�r�z--preserve-user-settingsTr�z9Activation AccelerateWP Premium captured out: %s, err: %s�r�r.r/r8r�r�r�r�r�r�r�)r�r�r�s   r�configure_accelerate_wp_premiumr�us�������	�w�~�~�K�L�L����(�(�(�G��#�#�#����S�S�S�T�T�T��>�'��d��N�N�N�D��M�M�t�{�\`�\g�h�h�h�h�hrc���t��tj�d��rdSgd�}|dkr|�ddg��tj|ddd���}tjd|j	|j
��gd�}|dkr|�gd	���tj|ddd���}tjd
|j	|j
��dS)Nz*/var/clwpos/admin/allowed_for_all_cdn.flag)r�r�r�r��accelerate_wp_cdnr�r�Tr�z5Activation AccelerateWP CDN captured out: %s, err: %s)r�r�r�r��accelerate_wp_cdn_pror�z9Activation AccelerateWP CDN PRO captured out: %s, err: %sr�)r��command_cdnr��command_cdn_pros    r�configure_accelerate_wp_cdnr��s
������	�w�~�~�B�C�C����(�(�(�K��#�#�#����J�(:�;�<�<�<��>�+�T�$�T�R�R�R�D��M�I�4�;�X\�Xc�d�d�d�0�0�0�O��#�#�#����[�[�[�\�\�\��>�/��d�QU�V�V�V�D��M�M�t�{�\`�\g�h�h�h�h�hrc�&�|sdStjddgddd���j}tj|��}||�d��krdStjddd|dd	gddd���}t
jd
|j|j��dS)Nr�zget-optionsTr��upgrade_urlzset-optionsz
--upgrade-urlz--suiter�zBSetting AccelerateWP Premium upgrade url captured out: %s, err: %s)	r�r�r�r�r�r�r�r�r�)r��options_json�optionsr�s    r�configure_upgrade_urlr��s��������>�#B�M�"R�#'�,0�"&�(�(�(�)/���j��&�&�G��g�k�k�-�0�0�0�0����>�:�(�*�&�$�2�4�!%�)-�#�%�%�%�D��M�V��+�t�{�,�,�,�,�,rr-)r�)FN)+r�rZr.r�r��pathlibr�typingrrrrr�enumr	�clcommon.clpwdr
�clcommon.utilsrr
rrQ�boolr&r3r@rErIrKrSrcrirorlr{rurvr�r�r�r�r�r�rrr�<module>r�s�������	�	�	�	�	�	�	�	���������������9�9�9�9�9�9�9�9�9�9�9�9�9�9������� � � � � � �1�1�1�1�1�1�&�&�&�&�&��&�&�&�#�#�#�#�#��#�#�#����4��E�#�t�)�<L�����@)��)��)�)�)�)�
1�5��d��#3�1��1�1�1�1�4'�c�'�d�'�'�'�'�
O��s�D�y�!1�O�d�O�O�O�O���s�D�y�)��d�����(��C��8�D��I�+>��(�SV�-�����6���$;�d�;�;�;�;�	�	�	�������3�����.
�4�
�d�
�W_�`c�Wd�
�
�
�
� �D��X�c�]�����(%�%�%�%�:#e�#e�#e�Lj�j�T�j�3�j�j�j�j�@i�i�C�i�i�i�i�,!i�!i��!i�!i�!i�!i�H,�,�,�,�,r

Filemanager

Name Type Size Permission Actions
__init__.cpython-311.pyc File 1.54 KB 0644
clcagefs.cpython-311.pyc File 15.5 KB 0644
clcaptain.cpython-311.pyc File 4.31 KB 0644
clconfig.cpython-311.pyc File 3.19 KB 0644
clconfpars.cpython-311.pyc File 16.37 KB 0644
clcustomscript.cpython-311.pyc File 1.85 KB 0644
cldebug.cpython-311.pyc File 1.29 KB 0644
clemail.cpython-311.pyc File 2.42 KB 0644
clexception.cpython-311.pyc File 1.7 KB 0644
clfunc.cpython-311.pyc File 11.95 KB 0644
clhook.cpython-311.pyc File 6.16 KB 0644
cllog.cpython-311.pyc File 2.78 KB 0644
cloutput.cpython-311.pyc File 846 B 0644
clproc.cpython-311.pyc File 8.93 KB 0644
clpwd.cpython-311.pyc File 11.97 KB 0644
clquota.cpython-311.pyc File 1.79 KB 0644
clsec.cpython-311.pyc File 1.55 KB 0644
clwpos_lib.cpython-311.pyc File 20.95 KB 0644
const.cpython-311.pyc File 293 B 0644
evr_utils.cpython-311.pyc File 5.06 KB 0644
features.cpython-311.pyc File 6.08 KB 0644
group_info_reader.cpython-311.pyc File 6.46 KB 0644
lock.cpython-311.pyc File 1.97 KB 0644
mail_helper.cpython-311.pyc File 7.2 KB 0644
mysql_lib.cpython-311.pyc File 10.01 KB 0644
php_conf_reader.cpython-311.pyc File 11.29 KB 0644
sysctl.cpython-311.pyc File 10.42 KB 0644
ui_config.cpython-311.pyc File 4.69 KB 0644
utils.cpython-311.pyc File 40.28 KB 0644
utils_cmd.cpython-311.pyc File 4.19 KB 0644