관리-도구
편집 파일: event_monitor_message_processor.cpython-311.pyc
� IMgQ � � � d dl Z d dlZd dlZd dlmZmZ d dlmZ d dlm Z m Z d dlmZ d dl mZmZ d dlmZ d dlmZmZ ej � � Z G d � d ee� � Z G d� dee� � Z G d � de� � ZdS )� N)�ABC�abstractmethod)�defaultdict)�heappop�heappush)�Dict)� ConfigFile�Core)�MessageType)�BaseMessageProcessor�expectc �� � e Zd Zd� Zd� Zd� Z eej � � d� � � Z d� Z ed� � � Zed� � � Z ed� � � Zed � � � Zed � � � Zed� � � ZdS ) �EventProcessorBasec �F � t t � � | _ || _ d S �N)r �list�_msg_buf�_loop)�self�loops �l/opt/imunify360/venv/lib/python3.11/site-packages/defence360agent/plugins/event_monitor_message_processor.py�__init__zEventProcessorBase.__init__ s � �#�D�)�)�� ��� � � � c �X � t | j |d |d |f� � d S )N�username� timestamp)r r �r �messages r �add_messagezEventProcessorBase.add_message s9 � ���M�'�*�-�.���1E�w�0O� � � � � r c � �z � K � t j � fd�� j � � � D � � � � d {V �� d S )Nc 3 �B �K � | ]}�� |� � V � �d S r )�process_user_messages)�.0� user_messagesr s �r � <genexpr>z6EventProcessorBase.process_messages.<locals>.<genexpr> sE �� � � � � �!� �*�*�=�9�9�� � � � � r )�asyncio�gatherr �values�r s `r �process_messagesz#EventProcessorBase.process_messages sr �� � � ��n�� � � �%)�]�%9�%9�%;�%;�� � � � � � � � � � � � r c � �x K � | � |� � sd S |j dk r| � |� � � d {V �� d S |j dk r| � |� � � d {V �� d S |j dk r| � |� � � d {V �� d S |j dk r| � |� � � d {V �� d S d S )N�Modify�Create�change_package�Remove)�_message_is_relatable�hook�_process_modify�_process_create�_process_change_package�_process_account_removedr s r � process_eventz EventProcessorBase.process_event# s � � � ��)�)�'�2�2� ��F��<�8�#�#��&�&�w�/�/�/�/�/�/�/�/�/�/�/� �\�X� %� %��&�&�w�/�/�/�/�/�/�/�/�/�/�/� �\�-� -� -��.�.�w�7�7�7�7�7�7�7�7�7�7�7� �\�X� %� %��/�/��8�8�8�8�8�8�8�8�8�8�8� &� %r c � � K � t t |� � � � D ]0}| � t |� � d � � � d {V �� �1d S )N� )�range�len�process_messager )r �messages�_s r r"