관리-도구
편집 파일: cleaner.cpython-311.opt-1.pyc
� ��g� � � � d Z ddlZddlZddlZddlmZ ddlmZmZ ddl m Z ddlmZ ddl mZ ej e� � Z G d� d � � 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)�suppress)�Malware�MalwareSignatures)�MDS_PATH)�MDSDetachedCleanupDir)�storage_pathc �F � e Zd Zd� Zed� � � Zed� � � Zd� ZdS )�MalwareDatabaseCleanerc � � |st d� � �|st d� � �|| _ || _ || _ t | j � � | _ d S )Nz'Cannot instantiate cleaner without pathz,Cannot instantiate cleaner without app names)� ValueError� cleanup_id�path�app_namer �work_dir)�selfr r r s �U/opt/imunify360/venv/lib/python3.11/site-packages/imav/malwarelib/scan/mds/cleaner.py�__init__zMalwareDatabaseCleaner.__init__$ s\ � �� H��F�G�G�G�� M��K�L�L�L�$����� � �� �-�d�o�>�>�� � � � c �6 � t | j | j � � S )N)r r r �r s r r z#MalwareDatabaseCleaner.storage_path. s � ��D�I�t�}�5�5�5r c � � dt dd| j dt j dt | j j � � d| j dt | j j � � d| j d | j d t j dt t j � � gS )Nz/opt/ai-bolit/wrapperz--cleanz--pathz--avdbz --report-filez --detachedz --progressz --backup-filez --app-namez --procudbz--db-timeout)r r r �MDS_AI_BOLIT_HOSTER�strr �report_filer � progress_filer r �MDS_PROCU_DBr �MDS_DB_TIMEOUTr s r �cmdzMalwareDatabaseCleaner.cmd2 s� � � $�����I���1���� �)�*�*���O���� �+�,�,������M���*����&�'�'�+ � r c � �V K � | j 5 | j j � d�� � 5 }| j j � d�� � 5 }t � d| j � � t t � � 5 t j | j � � d d d � � n# 1 swxY w Y t j | j d||t | j � � d��� d {V �� d d d � � n# 1 swxY w Y d d d � � n# 1 swxY w Y d d d � � d S # 1 swxY w Y d S )N�w)�modezRunning MDS Cleaner with: %sT)�start_new_session�stdout�stderr�cwd)r �log_file�open�err_file�logger�infor r �FileNotFoundError�os�unlinkr �asyncio�create_subprocess_execr )r �l_f�e_fs r �startzMalwareDatabaseCleaner.startL s9 � � � � �]� � ���'�,�,�� -� � � ��d�m�,�1�1�s�1�;�;� �?B����:�D�H�E�E�E��/�0�0� 1� 1��I�d�/�0�0�0�1� 1� 1� 1� 1� 1� 1� 1� 1� 1� 1���� 1� 1� 1� 1� �4��X�&*����D�M�*�*�� � � � � � � � � � � � � � � � � � � � ���� � � � � � � � � � � � � � � ���� � � � � � � � � � � � � � � � ���� � � � � � s| �!D�!D�5C/�B' �C/�'B+ �+C/�.B+ �/4C/�#D�/C3�3D�6C3�7D�:D�D � D� D �D�D"�%D"N)�__name__� __module__�__qualname__r �propertyr r r2 � r r r r # sh � � � � � �?� ?� ?� �6� 6� �X�6� � � � �X� �2� � � � r r )�__doc__r. �loggingr, � contextlibr � defence360agent.contracts.configr r �imav.malwarelib.scan.mdsr �!imav.malwarelib.scan.mds.detachedr � imav.malwarelib.scan.mds.restorer � getLoggerr3 r) r r7 r r �<module>r@ s� ��� �* ���� ���� � � � � � � � � � � G� G� G� G� G� G� G� G� -� -� -� -� -� -� C� C� C� C� C� C� 9� 9� 9� 9� 9� 9� �� �8� $� $��9� 9� 9� 9� 9� 9� 9� 9� 9� 9r