Edit File: plesk_notifications.cpython-311.opt-1.pyc
� ���h� � � � d Z ddlZddlmZ ddlmZ ddlmZmZ ddl m Z ddlmZ ddl mZ ej e� � Zd Zd Zg d�Z G d� d 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> � N)� lru_cache)�Path)� hosting_panel�plesk)�MessageSink)�HooksConfig)�notifierzK/usr/local/psa/admin/plib/modules/imunify360/scripts/send-notifications.phpz@/opt/imunify360/venv/share/imunify360/scripts/send-notifications)�CUSTOM_SCAN_MALWARE_FOUND�USER_SCAN_MALWARE_FOUND�REALTIME_MALWARE_FOUNDc �\ � e Zd Zd� Z ed�� � defd�� � Zdefd�Zd� Zd� Z d S ) �PleskNotificationsHooksc � �$ K � t j � � j t j j k rdS | � � � r2| � � � s| � � � � d{V �� dS dS | � � � � d{V �� dS )zMessageSink methodN) r �HostingPanel�NAMEr �Plesk�is_supported� is_applied� add_hooks�remove_hooks)�self�loops �U/opt/imunify360/venv/lib/python3.11/site-packages/imav/plugins/plesk_notifications.py�create_sinkz#PleskNotificationsHooks.create_sink+ s� � � � ��%�'�'�,���0@�@�@��F������ &��?�?�$�$� '��n�n�&�&�&�&�&�&�&�&�&�&�&� '� '� �#�#�%�%�%�%�%�%�%�%�%�%�%� � )�maxsize�returnc � � t t � � � � � o%t t � � � � � S �N)r �SCRIPT_PATH�exists� HOOK_PATH)r s r r z$PleskNotificationsHooks.is_supported5 s3 � ��K� � �'�'�)�)�F�d�9�o�o�.D�.D�.F�.F�Fr c �� �� t � � � � � }|� di � � �t �fd�t D � � � � sdS t �fd�t D � � � � S )N�rulesc 3 � �K � | ]}|�v V � � d S r � ��.0�event�config_ruless �r � <genexpr>z5PleskNotificationsHooks.is_applied.<locals>.<genexpr>= s( �� � � �=�=�U�5�L�(�=�=�=�=�=�=r Fc 3 � �K � | ];}t �| � d i � � � dg � � v V � �<dS )�SCRIPT�scriptsN)r# �getr( s �r r, z5PleskNotificationsHooks.is_applied.<locals>.<genexpr>@ sg �� � � � � � � ��E�"�&�&�x��4�4�8�8��B�G�G� H� � � � � � r )r r0 �all�EVENTS)r �configr+ s @r r z"PleskNotificationsHooks.is_applied9 s� �� ����"�"�$�$���z�z�'�2�.�.���=�=�=�=�f�=�=�=�=�=� ��5�� � � � � � � � � � � r c � �H K � t � � � � � }dd� |� di � � � � � D � � i}t D ]}||d vri |d |<