Yohohohohohooho | Sanrei Aya
Sanrei Aya


Server : LiteSpeed
System : Linux barito.iixcp.rumahweb.net 5.14.0-611.49.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 21 16:39:08 EDT 2026 x86_64
User : elvh3918 ( 1528)
PHP Version : 8.2.31
Disable Function : mail
Directory :  /usr/lib/python3.9/site-packages/up2date_client/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/lib/python3.9/site-packages/up2date_client/__pycache__/rhnreg.cpython-39.pyc
a

/V)j�.�@s�ddlZddlZddlZddlmZddlmZddlmZddlmZddlmZddlm	Z	ddl
mZdd	lm
Z
mZz4ddlZddlZdd
lmZmZmZmZmZmZWnFey�ddlmZddlmZeZeZeZe Ze!Ze!Ze"Z#Yn0ddl$Z$e$j%ddd
�Z&e'e&d��s"e&j$e&_(e&j(Z)dZ*dZ+ddddd�Z,dd�e,�-�D�Z.ddlm/Z/e/�0�Z1e�2�Z3dd�Z4dd�Z5dd�Z6e e7d�d d!�Z8e7d"�d#d$�Z9d6d&d'�Z:d7e7d(�d)d*�Z;d+d,�Z<e d-�d.d/�Z=d8d0d1�Z>d2d3�Z?d4d5�Z@dS)9�N)�up2dateUtils)�
up2dateErrors)�up2dateAuth)�	rhnserver)�
up2dateLog)�
statistics)�getPlatform)�ustr�sstr)�ListType�	TupleType�
StringType�UnicodeType�DictType�DictionaryTypezrhn-client-toolsT)�fallback�ugettextz/etc/sysconfig/rhnz/etc/sysconfig/rhn/jwt.tokenZ
shared_pro�shared�solo�admin)zCloudLinux OS Shared ProzCloudLinux OS SharedzCloudLinux OS SolozCloudLinux OS AdmincCsi|]\}}||�qS�r)�.0�k�vrr�9/usr/lib/python3.9/site-packages/up2date_client/rhnreg.py�
<dictcomp>5sr)�configcCst�tdtj�S�NZsystemIdPath)�os�access�cfg�R_OKrrrr�
registered=sr"cCs�tj�|�}t�|tj�sdStj�|�rNzt�||d�WnYdS0t�|tjtj	Btj
BtjBtjBd�}zt�
|d�}Wnty�t�|��Yn0z|�t|��W|��n
|��0dS)z; Write a file to disk that is not readable by other users. Fz.savei��wT)r�path�dirnamer�W_OK�lexists�rename�open�O_WRONLY�O_CREAT�
O_NOFOLLOW�O_EXCL�	O_CLOEXEC�fdopen�	Exception�close�writer
)Zsecure_fileZ
file_contentsZdir_name�fdZfd_filerrr�_write_secure_file@s,�
r4cCsttd|�}|Sr)r4r )�systemId�resrrr�
writeSystemIddsr7)�token�allowTransitioncCszddl}ddl}|j�d�s dSddg}|r6|�d�|j||jd�}|j|��d�\}}|j	dkrvt
�d	||f�dS)
�H
    Execute binary file which we use as hook for jwt token updates
    rN� /opt/cloudlinux/venv/bin/python3z/usr/sbin/cl-pre-jwt-updatez--new-token-stdin�--allow-transition)�stdin)�inputz7Pre jwt update hook failed with stdout=%s and stderr=%s)�
subprocessrr$�exists�append�Popen�PIPE�communicate�encode�
returncode�log�log_me)r8r9r?r�cmd�p�stdout�stderrrrr�_execute_pre_jwt_update_hookis

rM)r9cCsjddl}ddl}|j�d�s dSdg}|r4|�d�|�|�}|��\}}|jdkrft�	d||f�dS)r:rNr;z/usr/sbin/cl-post-jwt-updater<z8Post jwt update hook failed with stdout=%s and stderr=%s)
r?rr$r@rArBrDrFrGrH)r9r?rrIrJrKrLrrr�_execute_post_jwt_update_hook|s


rNFcCs�t��}z|j�|�}WnFtjy.YdStjtjtjtj	fy^t
jt�
��YdS0t|t�r�t|�dks�t�d|�s�t|ttf�r�t|�nd}t
�dt|�j|f�dSt||�tt|�t|�dS)z�
    Get a JWT token from CLN and save it to the file
    :param systemId: content of file `/etc/sysconfig/rhn/systemid`
    :return: None
    Ni@z2\A[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\Zzn/azIInvalid JWT token received from server (type=%s, len=%s), skipping update)rZ	RhnServerZup2dateZgetJWTTokenr�UnknownMethodExceptionZAuthenticationTicketErrorZRhnUuidUniquenessError�CommunicationErrorZ$AuthenticationOrAccountCreationErrorrGZ
log_exception�sys�exc_info�
isinstance�str�len�re�match�bytesrH�type�__name__rMr4�	JWT_TOKENrN)r5r9Z
xmlrpm_server�resultZ
result_lenrrr�getAndWriteJWTTokenToFile�s2�

���

r])�human_readablecCsld}tj�|�sdSt|��<}|���d�}|rB|Wd�St|Wd�S1s^0YdS)Nz/opt/cloudlinux/cl_editionr�
)rr$r@r)�read�strip�_human_readable_to_product)r^Zedition_cache_file�fZraw_editionrrr�getServerEdition�s
rdc
CsXzt|�}WnRtjyJ}z$td|j�t�d�WYd}~nd}~0tjy^YdS0t�}|d}||krzdS|r�tdj	t
|t
|d��td�t�d�|�sTtj��s�td�td�t
|�dt
|�d	�}d
dd�}|�
|�}	|	du�rLt��}
|
|	k�r8td||�d
|
�d��t�d�n|�d||�d�}t|�dS)Nz%s��editionz�WARNING: Automatic registration in yum transactions is only available when edition matches the provided license. Your current edition is {current_edition} and your license is {new_edition}.)Zcurrent_editionZnew_editionz0Run clnreg_ks manually to complete registration.aError: interactive input required for edition migration, but tool is running in non-interactive mode. Please try running the tool again in interactive shell or add `--migrate-silently` flag to accept allquestions and perform the edition migration silently.za edition installed on your server does not match license you are trying to register server with: zh. Migration is required. You may lose access to the services which are not supported by the new edition.�)rrz@The license you are trying to register with allows a maximum of z% hosting accounts which is less than z) users detected on this server. Aborting.zG Also, the license you are trying to register with allows a maximum of zM hosting accounts. Make sure that your system complies with this requirement.)�checkKeyrrP�print�errmsgrQ�exitrOrd�format�_product_to_human_readabler=�isatty�getrZcount_server_users�_askConfirmation)�
activationKeyZ
strictEditionZsilentMigrationZlicenseInformation�eZcurrentEditionZlicenseEdition�messageZedition_to_users_limitZlicense_users_limitZusers_on_serverrrr�checkLicenseKey�sX��


��


��
�rt)�confirmationMessagecCs2t|�td�}|��dkr.td�t�d�dS)zS
    Prints message and makes sure that client is ready for edition migration.
    z Do you want to continue? [N/y]: �yzAborted.reN)rir>�lowerrQrk)ruZresponserrrrps
rpcCs�|dur|dusJd��|t��t��t��d�}t��}|durJ||d<|rh|��D]\}}	|	||<qV|rv||d<n||d<||d<|dur�||d<n(tj�	d	�r�d
ntj�	d�r�dnd
|d<t
��}
|
j�
|�}|S)ziWrapper for the old xmlrpc to register a system. Activates subscriptions
    if a reg num is given.

    Nz)username and password usage is deprecated)Zprofile_nameZ
os_releaseZrelease_nameZarchitectureZ	system_idr8�username�passwordrfz/etc/cloudlinux-edition-solorz/etc/cloudlinux-edition-adminrr)rZ
getVersionZgetOSReleaseZgetArchrZgetSystemId�itemsrr$r@r�RegistrationRhnServer�registrationZ
new_system)rxryZprofileNamer8�otherrfZ	auth_dictZ
system_id_xml�key�item�s�retrrr�registerSystem
s6��



��r�cCst��}|j�|�}|S)zG
    Check the activation key and return it's edition and customer
    )rr{r|Z
license_check)rqr�r�rrrrh9srhcGs�g}|D]�}t|�}|tkr&t|�}nZ|tkrBtdd�|D��}n>|tkrZdd�|D�}n&|tksj|tkr�tdd�|�	�D��}|�
|�qt|�dkr�|dSt|�SdS)	u� All the data we gathered from dmi, bios, gudev are in utf-8,
            we need to convert characters beyond ord(127) - e.g ® to unicode.
        css|]}t|�VqdS)N��_encode_characters�r�irrr�	<genexpr>N�z%_encode_characters.<locals>.<genexpr>cSsg|]}t|��qSrr�r�rrr�
<listcomp>Pr�z&_encode_characters.<locals>.<listcomp>cSsg|]\}}t||��qSrr�)r�name�valrrrr�Rr�rerN)rYr
r	r�tuplerrr�dictrzrArU)�argsr\rZ	item_typerrrr�Ds
r�)F)F)NNNNNN)ArrVrQZup2date_clientrrrrrrZup2date_client.pkgplatformrZrhn.i18nr	r
�urlparseZ	xmlrpclib�typesrrr
rrr�ImportError�urllib.parse�parseZ
xmlrpc.clientZclient�listr�rXrTr��intZlong�gettext�translation�t�hasattrr�_Z	SYSID_DIRr[rbrzrmrZinitUp2dateConfigr ZinitLogrGr"r4r7�boolrMrNr]rdrtrpr�rhr�rrrr�<module>	sr$
��$
%>�
,

Yohohohohohooho | Sanrei Aya