OwlCyberSecurity - MANAGER
Edit File: restore_from_backup.cpython-311.opt-1.pyc
� ����N�6h{ ����������������������������d�Z�ddlmZ�ddlmZ�ddlmZ�ddlmZ�ddl m Z mZmZ�ddl mZ�ddlmZ�dd lmZ�dd lmZ��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�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_sink0���������������� � � r���c����������������������K����||�_���������d�S�r���)r���)r���r����sinks��� r���� create_sourcez%RestoreFromBackupPlugin.create_source3���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������������������&�����g�|�]\��}}|j����������|��S����� successful��.0�hit�events��� r���� <listcomp>z?RestoreFromBackupPlugin.restore_from_backup.<locals>.<listcomp>X���s$������O�O�O�Z�S�%�e�>N�O�S�O�O�Or���c������������������&�����g�|�]\��}}|j����������|��S�r'���r(���r*���s��� r���r.���z?RestoreFromBackupPlugin.restore_from_backup.<locals>.<listcomp>\���s5������������&�C��$�/�������r���)�getr���� set_statusr ����RESTORE_FROM_BACKUP_STARTEDr����track�task� setdefault�extend�itemsr���r%���r����delete_instances�_group_by_status)r���r!���r#���r$���� to_restore�restored�failed� init_hits�results�original_statusr����failed_hitss��� r���r%���z+RestoreFromBackupPlugin.restore_from_backup6���s2�����������{�{�6�"�"���� ��F��K�K��,�,� ����"�>� �� �� ��� � "� "�#8� 9� 9�� ;�� ;��J��!�!�)�R�0�0�7�7��=�=�=�!�2�f�H�(2�(8�(8�(:�(:�� �� �$� �9� -� A�"�'���!��!��!������������������O�O�7�=�=�?�?�O�O�O�������� � ����*1�-�-�/�/�������������� �'��1�1�1�.�v�6�6�O�'6�'<�'<�'>�'>�� ;�� ;�#����%�k�6�:�:�:�:� ;�7 ;�� ;�� ;�� ;�� ;�� ;�� ;�� ;�� ;�� ;�� ;�� ;����� ;�� ;�� ;�� ;�� ;�� ;s����/D F�F!�$F!N)�__name__� __module__�__qualname__�__doc__r ����IM360�SCOPEr���r���r ���r ���r����RestoreFromBackupTaskr���r%���r'���r���r���r���r���(���s���������������?�?��K�E�,��,��,�������������V�K�-�.�.�0;���0;��0;��0;��/�.�0;��0;��0;r���r���N)rD���� functoolsr����typingr����defence360agent.apir����"defence360agent.contracts.messagesr����!defence360agent.contracts.pluginsr���r���r ����imav.malwarelib.configr ����imav.malwarelib.modelr����imav.malwarelib.subsys.malwarer����defence360agent.utilsr ����group_by_attributer9���r���r'���r���r����<module>rR������s#�������*�������������������������*��*��*��*��*��*��:��:��:��:��:��:�������������������� �4��3��3��3��3��3��,��,��,��,��,��,��8��8��8��8��8��8��'��'��'��'��'��'��7�:�8�H�M�M�M���?;��?;��?;��?;��?;�k�=��?;��?;��?;��?;��?;r���