관리-도구
편집 파일: plesk_stats.cpython-311.opt-1.pyc
� IMgN � � � d dl Z d dlZd dlmZ d dlmZ d dlmZ d dlm Z m Z d dlmZ d dl mZ d dlmZ d d lmZmZ d d lmZ d dlmZ G d� d e � � ZdS )� N)�suppress)� MalwareHit)� LicenseCLN)� RootEndpoints�bind)�run_in_executor_decorator)�HostingPanel)�list_docroots_domains_users)�atomic_rewrite�Scope)�Plesk)�kernel_carec �f � e Zd ZdZ ed� � d� � � Zed� � � Zed� � � Z dS )�PleskStatsEndpoints�d zplesk-statsc � �D K � t � � }t |t � � s J d� � �t t t j � � � � � � � � � � }t t j � |t j j � � � � }| � t � � � d {V ��� � � d {V ��}d|dz |d�|�| � � � � d {V ���dt j � � rdndi�iS )Nzonly for plesk�itemsi� )� last_modified�last_modified_str�license� r )r � isinstancer �int�round�datetime�now� timestamp�str� fromtimestamp�timezone�utc�_domains_statsr �_get_stats_field_in_plugin_infor �is_valid)�self�panel�current_timestampr � domains_statss �[/opt/imunify360/venv/lib/python3.11/site-packages/defence360agent/simple_rpc/plesk_stats.py�plesk_statszPleskStatsEndpoints.plesk_stats sZ � � � ������%��'�'�9�9�)9�9�9�'���h�&7�&;�&;�&=�&=�&G�&G�&I�&I� J� J�K�K�����+�+�!��!�%� � � � �� #�1�1�-�/�/�/�/�/�/�/�/� � � � � � � � � � �!2�T�!9�%6�� � �� �=�=�?�?�?�?�?�?�?�?� � ��!4�!6�!6�=�A�A�A�� � � � c � �� K � t j � � � � � � d {V ��si S t j � � � � � � d {V ��}d d d�}t t � � 5 t t j j � � 5 }t j |� � }d d d � � n# 1 swxY w Y d d d � � n# 1 swxY w Y |d dk }|d |d k r/t j � t j j �� � n4t j � |d t j j � � }|sdn6t j � t j j �� � |z j }t! t j j t j |d |� � � d�� � d � � � |d |d�S ) N)�effective_kernel�first_time_update_available� updateCode�1�effectiveKernelr- )�tzr. r F)�backup� autoUpdate)�kernel_uptodate�outdated_since_days)r � KernelCare�check_installed�get_plugin_infor �FileNotFoundError�open� KC_PROPERTIES�json�loadr r r r! r �daysr �dumpsr )�cls�plugin_info�previous�file�update_availabler. r6 s r) r# z3PleskStatsEndpoints._get_stats_field_in_plugin_info+ s{ � � � � �+�-�-�=�=�?�?�?�?�?�?�?�?� ��I�'�2�4�4�D�D�F�F�F�F�F�F�F�F�� $�+/� � �� �'� (� (� +� +��k�,�:�;�;� +�t��9�T�?�?�� +� +� +� +� +� +� +� +� +� +� +���� +� +� +� +� +� +� +� +� +� +� +� +� +� +� +���� +� +� +� +� '�|�4��;�� �,�-��:L�1M�M�M� ��!�!�X�%6�%:�!�;�;�;��"�0�0��6�7��9J�9N�� � $� $� �A�A� �!�%�%��):�)>�%�?�?�-�.�� � ��"�0��J�(3�4E�(F�3N�3X�3X�3Z�3Z�� � � � � � � � � +�<�8�#6� � � s6 �4C�B4�(C�4B8 �8C�;B8 �<C�C�Cc �� � � t t j t j � � � t j � � � � � � � � � }t d� t t j t j � � � t j � � � � � � � � � � � � D � � � � � t t � fd�|� � � � }g }|D ]9\ }}}|D ]0\ }|� |� � r|� |� � n�1�:|d | j � t |� � d�S )Nc 3 �&