관리-도구
편집 파일: hooks.cpython-311.opt-1.pyc
� IMg� � � � d Z ddlZddlZddlmZmZmZ ddlmZ ddl m Z mZmZ ej e� � Zd� Zd� Zedee d ed efd�� � Zedee d ed efd�� � Ze eeeiZd ed eee egef fd�ZdS )a This module contains hook, which are called on feature management permission changes. Note that hooks are not executed automatically, developer is responsible to obtain specific hook using get_hook() function and call it. To add hook, create function with name equal to feature name � N)�Any�Callable�Optional)� ConfigFile)�AV�FULL� PROACTIVEc � � dS )NT� )�_s �]/opt/imunify360/venv/lib/python3.11/site-packages/defence360agent/feature_management/hooks.py� _hook_stubr s � ��4� c �F � � t j � � � � fd�� � }|S )Nc �h �� �| |� � }|p!t � d�j || � � |S )Nz#Hook '%s(%s)' failed for user '%s'.)�logger�warning�__name__)�user�value�result�callbacks �r �wrapz_result_warn.<locals>.wrap sC �� ���$��&�&��� �&�.�.�1����� � �� � r )� functools�wraps)r r s ` r �_result_warnr s8 �� ��_�X���� � � � ��� �Kr r r �returnc �p � | sdS t � � }|� dd� � }t | � � }|� dd� � }|t k rd}n0|r.|� d� � r|r|� d� � rd} |� dd|� � n# t $ r Y dS w xY wdS )z#Called when 'av' feature is changedT�MALWARE_SCANNING�default_actionN�cleanup�notifyF)r �getr � startswith�set� Exception)r r �config�config_value�user_config�user_config_values r � antivirusr+ $ s � � � ��t� �\�\�F��:�:�0�2B�C�C�L��T�"�"�K�#���(:�<L�M�M����}�}� ����%��(�(��3�3�%� �%� �#�#�I�.�.� %� %������� 0�2C� � � � �� � � � ��u�u����� �4s � B% �% B3�2B3c � � | sdS |t k rdnd} t | � � � dd|� � n# t $ r Y dS w xY wdS )z*Called when 'proactive' feature is changedTN�DISABLED�PROACTIVE_DEFENCE�modeF)r r r% r&