File manager - Edit - /opt/imunify360/venv/lib/python3.11/site-packages/defence360agent/wordpress/__pycache__/incident_sender.cpython-311.pyc
Back
� tsid � � � d Z ddlZddlZddlmZ ddlmZ ddlmZ ddlm Z ej e� � Z G d� d� � Z dS ) z3Send WordPress incidents to the correlation server.� N)�datetime)�Any)�SensorWordpressIncidentList)�MessageSinkc � � e Zd ZdZdedeeef fd�Zdedee fd�Z de dz d ee defd �Zde dee fd�Z dS ) �IncidentSendera Send WordPress incidents to the correlation server. WordPress incidents are already in the Incident table (visible to UI). This class sends them to correlation via Reportable messages, which are automatically handled by SendToServer/SendToServerFGW plugins. �incident�returnc �� � t � d|� � |� d� � pi }t |� d� � pd� � }t |� � }|r't j |� � � d� � nd}i d|�d|�d|� d � � �d |� d � � pd�d|� d� � �d |� d� � �d|� d� � �d|� d� � pd�d|� d� � pd�d|� d� � pd�d|� d� � pd�d|� d� � pd�d|� d� � pd�d|� d� � r|� d� � dk nd�d|� d� � pd�d |� d!� � pd�d"| � |� � �|� d#� � pd|� d$� � pd|� d%� � pd|� d&� � pd|d'��S )(aJ Prepare an incident for sending to the correlation server. WordPress incidents use extra_info JSON field to store plugin-specific data. Args: incident: WordpressIncident dictionary (with extra_info populated) Returns: Dictionary formatted for correlation server z&Preparing incident for correlation: %s� extra_info� timestampr z%Y-%m-%d� �dt� plugin_id�plugin�rule�unknown�name�message�description�severity�attackers_ip�abuser�domain�retries� �uri�request_uri� user_agent�http_user_agent�http_method�request_method�user_logged_in�trueN� file_path� site_path�user�username�tag�target�slug�version�mode)r* r+ r, r- �details) �logger�info�get�float�intr � fromtimestamp�strftime�_build_tags)�selfr �extra�timestamp_valuer r s �^/opt/imunify360/venv/lib/python3.11/site-packages/defence360agent/wordpress/incident_sender.py�!_prepare_incident_for_correlationz0IncidentSender._prepare_incident_for_correlation s� � � ���<�h�G�G�G��l�l�<�0�0�6�B�� "'�x�|�|�K�'@�'@�'E�A�!F�!F����(�(� � � �H�"�?�3�3�<�<�Z�H�H�H�� � ��� ��"� � ����h�/�/� � �H�L�L��(�(�5�I� � �H�L�L��(�(� � �x�|�|�M�2�2� � ����Z�0�0� � �H�L�L��2�2�8�b� � �h�l�l�8�,�,�2�� � �x�|�|�I�.�.�3�!� � �5�9�9�]�+�+�1�r� � �%�)�)�$5�6�6�<�"� � �5�9�9�%5�6�6�<�"� � ��y�y�)�*�*��e�i�i�(8�9�9�V�C�C��! �"