관리-도구
편집 파일: restore_from_backup.cpython-311.opt-1.pyc
� ��g� � �� � d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl m Z mZmZ ddl mZ ddlmZ dd lmZ dd lmZ ddlmZ eej d� � � Z G d� de e� � 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> � )�partial)�Dict)� inactivity)�MessageType)�MessageSink� MessageSource�expect)�MalwareHitStatus)� MalwareHit)� MalwareAction)�Scope)�MalwareActionIm360�status)� attributec �j � e Zd ZdZej Zd� Zd� Zd� Z e ej � � de fd�� � ZdS )�RestoreFromBackupPluginz5A plugin that handles RestoreFromBackupTask messages.c �$ � d\ | _ | _ d S )N)NN)�_loop�_sink)�selfs �U/opt/imunify360/venv/lib/python3.11/site-packages/imav/plugins/restore_from_backup.py�__init__z RestoreFromBackupPlugin.__init__. s � �!+��� �D�J�J�J� c � � K � || _ d S �N)r )r �loops r �create_sinkz#RestoreFromBackupPlugin.create_sink1 � � � � ��� � � r c � � K � || _ d S r )r )r r �sinks r � create_sourcez%RestoreFromBackupPlugin.create_source4 r r �messagec � �T K � |� d� � }|sdS |� d� � }t j |t j � � t j � d� � 5 i }|� |g � � � |� � g g }}|� � � D ]�\ }}t j ||| j �� � � d{V ��}|� d� |� � � D � � � � |� d� |� � � D � � � � ��t j |� � t |� � } | � � � D ]\ } }t j || � � � ddd� � dS # 1 swxY w Y dS )a� Restores hits in RestoreFromBackupTask message from backup. - sets restore_from_backup_started status for received hits in the database. - successfully restored files are removed from the database. - statuses in the database are reverted from restore_from_backup_started to its original value for files that failed to restore. �hitsN� initiator�restore_from_backup)r$ r% r c �&