관리-도구
편집 파일: utils.cpython-311.pyc
� IMg! � �V � d dl Z d dlZd dlZd dlZd dlmZ d dlmZmZ d dl m Z d dlmZ d dl mZmZmZ d dlZd dlZd dlmZ d dlmZ d d lmZ d d lmZmZmZmZmZm Z d� Z!d� Z"dd�Z# ddeeddf fd�Z$ddeee fd�Z% ed� � d� � � Z&d� Z' dd�Z(dS )� N)�suppress)� lru_cache�wraps)�chain)�Path)�Optional�Tuple� Generator)� SimpleRpc)�run_in_executor)�ValidationError)�AV_PID_PATH�IM360_NON_RESIDENT_PID_PATH�IM360_RESIDENT_PID_PATH�antivirus_mode�is_centos6_or_cloudlinux6�is_root_userc �� � t j rt nt } | � � � r�t j � � }t t � � 5 t | � � � � � }t � � r1t j |� � � � � d j }||k ot j |� � cddd� � S # 1 swxY w Y dS )z/Check if non-resident agent instance is runningr NF)r �enabledr r �exists�os�getpidr � Exception�int� read_textr �psutil�Process�children�pid� pid_exists)�rpc_process_pid_path�current_pidr s �T/opt/imunify360/venv/lib/python3.11/site-packages/defence360agent/rpc_tools/utils.py�rpc_is_runningr$ s � � &�-�N���3N� � �"�"�$�$� A��i�k�k�� �i� � � A� A��*�4�4�6�6�7�7�C�(�*�*� <��n�S�)�)�2�2�4�4�Q�7�;���+�%�@�&�*;�C�*@�*@� A� A� A� A� A� A� A� A� A� A� A� A���� A� A� A� A� �5s �A:C�C!�$C!c � � t j rt � � S t j � � rMt j � � } t t j � � � � }|| k ot j |� � S dS )z&Check if the agent instance is runningF)�Config�SOCKET_ACTIVATIONr$ r r r r r r r r )r"