관리-도구
편집 파일: realtime_av.cpython-311.pyc
� ��gS- � �* � 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' G d� de(� � Z)dede e* ddfd�Z+dee* deee* ee* f fd�Z,dedee* fd�Z- G d� d e.� � Z/ G d!� d"e*� � Z0d#e*d$e*deee* ee* f fd%�Z1 G d&� d'� � Z2d(e*de e* d)ee* de2fd*�Z3 G d+� d,� � Z4d(e*de e* de4fd-�Z5deddfd.�Z6d/ed0ede7fd1�Z8ded2ee egdf de7fd3�Z9d8d4�Z:de7fd5�Z;d8d6�Z<de7fd7�Z=dS )9u 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-exclcompc � � 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 9 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( ? 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 F 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&