OwlCyberSecurity - MANAGER
Edit File: realtime_av.cpython-311.opt-1.pyc
� c1�g. � �P � d Z ddlZddlZddlZddlZddlZddlZddlmZ ddl m Z mZmZm Z mZ ddlmZmZ ddlmZ ddlmZ ddlmZ dd lmZ ej e� � Z ed � � Z ed� � Zedz Zd Z dZ!dZ"dZ#dZ$dZ%dZ&dZ'dZ( ed� � Z) G d� de*� � Z+dede e, ddfd�Z-dee, deee, ee, f fd�Z.dedee, fd�Z/ G d � d!e0� � Z1 G d"� d#e,� � Z2d$e,d%e,deee, ee, f fd&�Z3 G d'� d(� � Z4d)e,de e, d*ee, de4fd+�Z5 G d,� d-� � Z6d)e,de e, de6fd.�Z7deddfd/�Z8d0ed1ede9fd2�Z:ded3ee egdf de9fd4�Z;d:d5�Z<de9fd6�Z=de9fd7�Z>d:d8�Z?de9fd9�Z@dS );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)�Path)�Callable�Iterable�List�Set�Tuple)�ANTIVIRUS_MODE�Malware)�HostingPanel)� check_run)�MalwareIgnorePath)�crontab_pathz4/etc/sysconfig/imunify360/malware-filters-admin-confz)/var/imunify360/files/realtime-av-conf/v1� processedzpd-combined.txtzav-internal.txtzav-admin.txtzav-admin-paths.txt�ignoredi � zimunify-realtime-avz/usr/bin/i360-exclcompz/usr/sbin/imunify-realtime-avc � � e Zd ZdZdS )�PatternLengthErrorz(Raised when pattern's length is too big.N)�__name__� __module__�__qualname__�__doc__� � �L/opt/imunify360/venv/lib/python3.11/site-packages/imav/subsys/realtime_av.pyr r ; s � � � � � �2�2��Dr r �dir�basedirs�returnc � � | dz � d� � 5 }t |� � D ]7}|� t j � |� � dz � � �8 ddd� � dS # 1 swxY w Y dS )z+Save list of basedirs in a file inside dir.zbasedirs-list.txt�w� N)�open�sorted�write�os�path�realpath)r r �f�basedirs r �_save_basedirsr( A s� � � �#� #� )� )�#� .� .� 6�!��h�'�'� 6� 6�G� �G�G�B�G�$�$�W�-�-��4�5�5�5�5� 6�6� 6� 6� 6� 6� 6� 6� 6� 6� 6� 6� 6���� 6� 6� 6� 6� 6� 6s �AA/�/A3�6A3�pathsc � � g g }}| D ]J}|� d� � r|� |dd� � � �5|� |� � �K||fS )z�Split paths into two lists: absolute and relative. Relative paths start with +. This + sign is removed from resulting path.�+� N)� startswith�append)r) �absolute�relativer$ s r �_split_pathsr1 H sm � � �R�h�H�� "� "���?�?�3��� "��O�O�D����H�%�%�%�%��O�O�D�!�!�!�!��X��r r$ c � � | � � � 5 }d� |D � � }d� |D � � cddd� � S # 1 swxY w Y dS # t $ r g cY S w xY w)z�Read file at path and return its lines as a list. Empty lines or lines starting with '#' symbol are skipped. Lines are stripped of leading and trailing whitespace. If the file does not exist, empty list is returned.c �6 � g | ]}|� � � ��S r )�strip)�.0�lines r � <listcomp>z_read_list.<locals>.<listcomp>] s � �0�0�0�d�T�Z�Z�\�\�0�0�0r c �b � g | ],}t |� � d k �|� d� � �*|��-S )r �#)�lenr- )r5 �xs r r7 z_read_list.<locals>.<listcomp>^ s3 � �M�M�M�!��A���� � �1�<�<��;L�;L� �A� � � r N)r �FileNotFoundError)r$ r&