�
�h
���dZddlZddlZddlmZddlmZddlm Z ddl
mZddlm
Z
ddlmZee��Zd Zed
��Zd�ZdS)u
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License,
or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Copyright © 2019 Cloud Linux Software Inc.
This software is also available under ImunifyAV commercial license,
see <https://www.imunify360.com/legal/eula>
�N)�Path)� getLogger)�
LicenseCLN)�cPanel)�HostingPanel)�MalwareTunez?https://repo.imunify360.cloudlinux.com/defence360/i360deploy.shz!/var/imunify360/tmp/i360deploy.shc��$K�tjrt�d��dSt ��}tj��}|�d��dks|jtjkrdS t���s�tj�
dd���tj�t"d���5}|���}t�|��d d d ��n#1swxYwYt�d
��t+jdtdd
gd���n3#t.$r&}t�d|��Yd }~dSd }~wwxYwdS)z6
Deploys imunify360 for CPanel installations.
z8No upgrade flag file exists. Skipping imunify360 upgradeT�status�okF)�parents�exist_ok�
)�timeoutNi�z!/usr/libexec/report-command-error�IPLz-y)�start_new_sessionz#Failed to upgrade to imunify360: %r)r�NO_AUTO_UPGRADE�logger�warningrr� get_token�get�NAMEr�TARGET_PATH�exists�parent�mkdir�urllib�request�urlopen�
SOURCE_URL�read�write_bytes�chmod�
subprocess�Popen� Exception�error)�hp�
license_token�response�content�es �I/opt/imunify360/venv/lib/python3.11/site-packages/imav/internals/im360.py�deploy_im360r-&s������"�����F�
�
�
��t� ���B��(�*�*�M�����"�"�d�*�*�b�g���.D�.D��u���!�!�#�#� 1���$�$�T�D�$�A�A�A���'�'�
�B�'�?�?�
1�8�"�-�-�/�/���'�'��0�0�0�
1�
1�
1�
1�
1�
1�
1�
1�
1�
1�
1����
1�
1�
1�
1� ���%� � � � ��
0�+�u�d�K�"�
�
�
�
�
���������:�A�>�>�>��u�u�u�u�u����������4s=�=A E�/D�E�D�E�D� <E�
F
�'F�F
)�__doc__r#�urllib.requestr�pathlibr�loggingr�!defence360agent.contracts.licenser�$defence360agent.subsys.panels.cpanelr�+defence360agent.subsys.panels.hosting_panelr�imav.contracts.configr�__name__rrrr-��r,�<module>r9s�����*��������������������8�8�8�8�8�8�7�7�7�7�7�7�D�D�D�D�D�D�-�-�-�-�-�-�
��8� � ��
N�
��d�6�7�7������r8 |