관리-도구
편집 파일: malware.cpython-311.opt-1.pyc
� ��g�� � � � d Z ddlZddlZddlZddlZddlZddlZddlZddlm Z ddl mZ ddlm Z ddlmZmZmZmZmZmZmZmZmZmZ ddlmZ ddlmZmZmZmZm Z m!Z!m"Z" dd l#m$Z$m%Z%m&Z& dd l'm(Z( ddl)m*Z* ddl+m,Z, dd l-m.Z. ddl/m0Z0m1Z1 ddl2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z: ddl;m<Z<m=Z= ddl>m?Z?m@Z@mAZAmBZBmCZCmDZDmEZEmFZFmGZGmHZHmIZImJZJmKZKmLZLmMZMmNZNmOZOmPZPmQZQmRZRmSZSmTZTmUZUmVZV ddlWmXZXmYZYmZZZm[Z[m\Z\ ddl]m^Z^ ddl_m`Z` ddlambZb ddlcmdZd ddlemfZf erddlgmhZh eei� � Zjeekelejm f Zm ed� � Zn edeZe^� � Zod� Zpd� Zqd� Zrdekdeekekf fd �Zs G d!� d"� � Ztd#� Zu G d$� d%� � Zv G d&� d'et� � ZwdS )(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)�defaultdict)� getLogger)�Path) �Callable� Collection�Dict�Iterable�List� TYPE_CHECKING�Tuple�TypeVar�Union�cast)�IntegrityError)�Core� HackerTrap�MyImunifyConfig�UserType�"choose_use_backups_start_from_date�choose_value_from_config� should_try_autorestore_malicious)�MS_CONFIG_DEFAULT_ACTION_EDIT�has_permission�myimunify_protection_enabled)�g)�run_in_executor)� web_server)� hosting_panel)�ModsecVendorsError�PanelException)�COPY_TO_MODSEC_MAXTRIES�LazyLock�atomic_rewrite�base64_decode_filename�base64_encode_filename�log_failed_to_copy_to_modsec�retry_on� safe_sequence)�MalwareCleanupRevert�MalwareCleanupTask)�ADDED_TO_IGNORE�CLEANUP�CLEANUP_DONE�CLEANUP_ON_SCHEDULE�CLEANUP_REMOVED�DELETED_FROM_IGNORE�FAILED_TO_CLEANUP�FAILED_TO_DELETE_FROM_IGNORE�FAILED_TO_IGNORE�FAILED_TO_RESTORE_FROM_BACKUP�FAILED_TO_RESTORE_ORIGINAL�FAILED_TO_STORE_ORIGINAL�FOUND�MalwareEvent�MalwareEventPostponed�MalwareHitStatus�MalwareScanResourceType�MalwareScanType�NOTIFY�REQUIRES_MYIMUNIFY_PROTECTION�RESTORED_FROM_BACKUP�RESTORED_ORIGINAL�SUBMITTED_FOR_ANALYSIS�UNABLE_TO_CLEANUP)�MalwareHistory� MalwareHit�MalwareHitAlternate�MalwareIgnorePath�MalwareScan)�MalwareDatabaseHitInfo)� restore_files�� hash_path)�submit_in_background)� detected_hook)� RestoreReport�T�HitInfoTypec �� � � t j � � � d� fd� � � }t j � � � d� fd� � � }t j � � � r|n|S )z8Decorator responsible for logging malware events into DBNc � �� ���������� � ��� ��K � �| f����pt j ���� � �d� |��� d {V ���t t j � � ���� � ���������� fd�� � � d {V �� �S )N� �path� file_owner� file_user� initiator�app_name� resource_type�db_host�db_port�db_name�scan_idc �T �� t j � j �� � �������� ����� � S )N��eventrT rX rY rU rV rW �causerZ r[ r\ � table_name�table_field� table_row_infr] )rC � save_event�title)rX ra rZ r\ r[ rU rV rW rT rY �resultr] rc rb rd s ����������������S/opt/imunify360/venv/lib/python3.11/site-packages/imav/malwarelib/subsys/malware.py�<lambda>z?update_malware_history.<locals>.async_wrapper.<locals>.<lambda>� sH �� �N�-��l��!�+�%�#�#�����%�'�+��� � � � )r �ROOTr �asyncio�get_event_loop��clsrT rU rV rW ra rY rX rZ r[ r\ rb rc rd r] �kwargsrg �coros `````````````` @�rh � async_wrapperz-update_malware_history.<locals>.async_wrapper� s" ����������������� � � �&