Uname : Linux premium36.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
Soft : LiteSpeed
Ip : 198.54.115.237
Port : 443
~
/
opt
/
imunify360
/
venv
/
lib64
/
python3.11
/
site-packages
/
imav
/
contracts
/
__pycache__
[ HOME ]
Exec
Submit
File Name : imunify_patch_id.cpython-311.pyc
� 3RiP � � � d Z ddlZddlZddlZddlZddlZddlmZ ddlm Z ddl mZ ddlm Z ddlmZ ddlmZmZmZmZ dd lmZ dd lmZ ddlmZ ddlmZmZmZ dd lm Z ddl!m"Z" ddl#m$Z$ ddl%m&Z& dZ'dZ(dZ) ej* e+� � Z, G d� de-� � Z.e/Z0de/de0fd�Z1 e� � de/de0fd�� � Z2 e d�� � de/fd�� � Z3de/de fd�Z4de0fd�Z5de de0dz fd�Z6de d e0ddfd!�Z7 ed"d#�$� � de/dz fd%�� � Z8d&e/d'e9fd(�Z:e)fd)e9e/ef d*e;de9e/e9e/e;f f fd+�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)�defaultdict)� lru_cache)�islice)�Path)�Any)� parse_qsl� urlencode�urlparse� urlunparse)�IndependentAgentIDAPI)�PanelException)�HostingPanel)�async_lru_cache�log_error_and_ignore�safe_fileops)�ImunifyPatchSubscriptionAPI)�VulnerabilityAPI)�VulnerabilityHitStatus)�VulnerabilityHitz.imunify_patch_id� � c � � e Zd ZdS )�ImunifyPatchIdErrorN)�__name__� __module__�__qualname__� � �T/opt/imunify360/venv/lib/python3.11/site-packages/imav/contracts/imunify_patch_id.pyr r 8 s � � � � � ��Dr r �username�returnc � � K � t | � � � d{V ��}t |� � x}r|S t � � }t ||� � � d{V �� |S )a� Ensure the Imunify Patch ID file exists for the given user. This function checks if the Imunify Patch ID file exists in the user's home directory. If it does not exist, it generates a new ID, writes it to the file, and returns the ID. If the file already exists, it reads and returns the existing ID. Args: username (str): The username for which to ensure the ID file. Returns: ImunifyPatchUserId: The Imunify Patch user ID. N)�_get_id_file� _read_id_file�_generate_id�_write_id_file)r �id_file�_ids r �ensure_id_filer) ? sq � � � � !��*�*�*�*�*�*�*�*�G��G�$�$�$�s� �� � �.�.�C� ��#� &� &�&�&�&�&�&�&�&��Jr c � � K � t | � � 4 �d {V �� t | � � � d {V ��cd d d � � �d {V �� S # 1 �d {V ��swxY w Y d S �N)�get_lockr) �r s r �get_imunify_patch_idr. U s� � � � ���!�!� .� .� .� .� .� .� .� .�#�H�-�-�-�-�-�-�-�-�.� .� .� .� .� .� .� .� .� .� .� .� .� .� .� .� .� .� .� .� .� .� .� .���� .� .� .� .� .� .s �A � A � A )�maxsizec �( � t j � � S r+ )�asyncio�Lockr- s r r, r, [ s � ��<�>�>�r c � � K � t j | � � }t |j � � t z }|� � � s�|j � � � s9t � d|j � �� � t d|j � �� � � t j t |� � � � � d{V �� n�# t t f$ r.}t � dt |� � t |�d}~ww xY wnB# t $ r5}t � d| � �� � t d| � �� � |�d}~ww xY w|S )zEGet a file with Imunify Patch user id and create it if does not existzNo such user homedir: Nz$Unable to put %s in user home dir %szNo such user: z No such user )�pwd�getpwnamr �pw_dir�IMUNIFY_PATCH_ID_FILE�exists�parent�logger�errorr r �touch�str�PermissionError�OSError�KeyError)r �user_pwdr'