OwlCyberSecurity - MANAGER
Edit File: endpoints.cpython-311.pyc
� �#h�# � �B � d Z ddlZddlZddlmZ ddlmZmZ ddlm Z ddl mZ ddlm Z mZmZ ddlmZmZmZmZ dd lmZ dd lmZmZmZ ddlmZ ddlmZ dd lm Z ddl!m"Z"m#Z# ddl$m%Z% ddl&m'Z'm(Z(m)Z)m*Z* ej+ e,� � Z-dZ.dZ/de0fd�Z1 G d� de"� � Z2dS )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)�PatchmanConfig)�PATCHMAN_PACKAGE�PATCHMAN_SERVICE_NAME)�PatchmanCustomIntegration)� PatchmanError)� FeatureStatus�PatchmanFeature�RealtimeFeature)�Domain�Path�User�patchman_db)�License)�get_current_ip�is_ipv4� is_private_ip)�REALTIME_SERVICE_NAME)�Core)�MessageType)� RootEndpoints�bind)� hosting_panel)� check_run�finally_happened� OsReleaseInfo� os_versionzpatchman-clientz/usr/local/patchman/patchmand�returnc �B � t j � � t j z S �N)r �id_like�DEBIAN� � �P/opt/imunify360/venv/lib/python3.11/site-packages/imav/patchman/rpc/endpoints.py� is_debianr% 8 s � �� �"�"�]�%9�9�9r# c � � e Zd ZdZ edd� � dd�� � Z edd� � dd�� � Zed � � � Zed � � � Z d� Z dd �Z edd� � dd�� � Z edd� � d� � � Z edd� � d� � � Z edd� � d� � � Z eddd� � d� � � Z eddd� � d� � � ZdS )�PatchmanEndpointsz/etc/patchman/license/key�patchman�usersFNc � �j K � |rt ||� � }nt j � � }|� � � � d{V ��}t t t t gt j d�� � 5 }|D ]�}|d }|d pd} |d } |d pd}|d }|d } t j || | ||| �� � }|d }|D ]C}|d }t j ||�� � }|d }|D ]}t j ||�� � ��D��d|j icddd� � S # 1 swxY w Y dS )as Writes the users and their domains to database. Patchman go agent executes this endpoint to fill the database. In case of custom integration it retrieves the user-defined parameters from Patchman Portal and passes it here. :param custom_integration: true if custom integration, false by default :param integration_type: only for custom integration, file or script :param metadata_path: only for custom integration, path to file or script that represent metadata (File type 1 or Script 1 from https://docs.imunify360.com/Patchman_custom_integration.pdf) Nr) )� target_dir�prefix�username�email� �language�parent�level� suspended)�namer. r0 r1 r2 r3 �domains�domain)r4 �user�paths)r4 r6 �path)r r �HostingPanel�patchman_usersr r r r r �TMPDIR�create�database)�self�custom_integration�integration_type� metadata_path�hpr; �db� user_data� user_namer. r0 r1 r2 r3 r7 r5 �domain_data�domain_namer6 r8 � path_names r$ r) zPatchmanEndpoints.users? s� � � � �&