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 :  /opt/cloudlinux/venv/lib64/python3.11/site-packages/xray/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/xray/__pycache__/user_agent.cpython-311.pyc
�

e�"j_�
���dZddlZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
mZddlm
Z
ddlmZddlmZmZddlmZmZddlmZdd	lmZdd
lmZmZmZmZm Z ddl!m"Z"m#Z#m$Z$ddl%m&Z&ej'd
��Z(ej)d��Z*dZ+dZ,ej-e.��Z/e
��Z0dZ1de
e2e2ffd�Z3de2de4fd�Z5de2de2fd�Z6de7de4dede
e2e2ffd�Z8dd�Z9d d�Z:dS)!z@
This module contains X-Ray User Manager service implementation
�N)�Lock�current_thread)�Tuple)�BoundedThreadExecutor)�
get_runner�Runner)�user_agent_sock�user_agent_log)�	XRayError)�gettext)�unpack_request�
pack_response�
extract_creds�check_for_root�error_response)�
create_socket�read_sys_id�configure_logging)�get_locale_from_envars�
user_agentz0^[a-zA-Z]{1,5}(_[a-zA-Z]{2})?(\.[a-zA-Z0-9-]+)?$�2�i�returnc�f�td��}t|�����dfS)zN
    General format of message in case of errors during manager execution
    z[X-Ray User Plugin failed to execute your request. Please, contact your server administrator�)�_r�encode)�_errs �F/opt/cloudlinux/venv/lib64/python3.11/site-packages/xray/user_agent.py�general_exec_errorr /s1��
�
j�k�k�D��$���&�&�(�(�#�-�-r�orig_msgc�R�tjdd|�����S)zL
    Cut data field from the original message, because it could be huge
    z(?<="data": {).+(?=}, "result")z...)�re�sub�decode)r!s r�log_truncater&7s#���6�3�U�H�O�O�<M�<M�N�N�Nrc�4�d�}tjd||��S)zA
    Extend warning 'Task is duplicated by URL' for end user
    c�J�d}|�d��}|dkr||zS|S)zM
        Add more text for duplicate warning, leave others unchanged
        s�. In case if you do not see running task for the same URL in your list of tasks below, contact your server administrator and ask him to check whether the requested URL is in the tasks list of X-Ray Admin Plugin or is scheduled for continuous tracing.rsTask is duplicated by URL)�group)�m�
additional�warns   r�genz#duplicate_warning_cast.<locals>.genCs7��V�
��w�w�q�z�z���/�/�/��*�$�$��rs(?<="warning": ").+(?="}))r#r$)r!r-s  r�duplicate_warning_castr.>s(��
����6�.��X�>�>�>r�command�user�runnerc���
����jdkr1	t��|d<n#t$rt��cYSwxYw�fd��d��
d}d}||g�|�|��}|�|t����}t
|t��rt�	|��st��pd}|r0�|��}d�j
��d	|��||�d
��g}nd�j
��|�d
��g}|��
��fd�|�
��D����||d�}	t�d
|t|	����	t!j|d|	d���}
n6#t$t&t(t jf$rt��cYSwxYw|
j���|
j���}}|r:t�dt3��jt5|����|r?t�dt3��j|�����t9|��|fS)zA
    Trigger runner.target utility with requested parameters
    �manager�	system_idc�F��|�jvr�j||��n|S)z0runner may define a special cast for each option)�option_cast)�optr1s �r�runner_cast_optz(execute_manager.<locals>.runner_cast_opt]s<����6�-�-�-�'�v�!�#�&�����36�	7rc��|durdnd|��S)z=Hide True value from cmd representation for bool-flag optionsT��=�)�vs r�
hide_true_valz&execute_manager.<locals>.hide_true_valbs���$�Y�Y�r�r�G��G�G�+r�api_version�langzC.UTF-8z
/usr/sbin/�--r/c�T��g|]$\}}|r|�v�d�|����|������%S)rAr<)�.0�kr=r>r8�skip_optionss   ���r�
<listcomp>z#execute_manager.<locals>.<listcomp>zs^���@�@�@���1�#$�@�)*�,�)>�)>�<�_�_�Q�'�'�;���q�)9�)9�;�;�)>�)>�)>r)�XRAYEXEC_UID�LANGz*Going to execute: %s, with environment: %sT�x)�capture_output�env�timeoutz[%s] Proxied command stdout: %sz[%s] Proxied command stderr: %s)�namerrr �getr�
isinstance�str�
_LOCALE_RE�match�target�pop�extend�items�logger�info�
subprocess�run�OSError�
ValueError�	TypeError�SubprocessError�stdout�strip�stderrrr&r%r.)r/r0r1�api_version_key�
locale_optionr?�
target_locale�casted_api_version�cmd�with_env�p�byte_out�byte_errr>r8rEs  `          @@@r�execute_managerrkSs��������{�i���	(�#.�=�=�G�K� � ���	(�	(�	(�%�'�'�'�'�'�	(����7�7�7�7�7�
,�,�,�$�O��M�$�]�3�L��+�+�o�.�.�K��K�K�
�/E�/G�/G�H�H�M��m�S�)�)�>��1A�1A�-�1P�1P�>�.�0�0�=�I�
��E�,�_�_�=�=��+�F�M�+�+�-F�2D�-F�-F��U\�U`�U`�aj�Uk�Uk�l���+�F�M�+�+�W�[�[��-C�-C�D���J�J�@�@�@�@�@�@��
�
���@�@�@�A�A�A�!%�m�<�<�H�
�K�K�<�c�3�x�=�=�Q�Q�Q�$��N�3�t�'��
6�
6�
6�����Z��J�,F�G�$�$�$�!�#�#�#�#�#�$��������)�)�1�8�>�>�+;�+;�h�H��,����5�~�7G�7G�7L� ��*�*�	,�	,�	,��'����5�~�7G�7G�7L��O�O�%�%�	'�	'�	'�!�(�+�+�X�5�5s�#�>�>�<F�0G�G�
connection�
socket objectc��
�tjdtd��id���}|5|�d��t	|��\}}}t|��rB|�t|�������	ddd��dSt5t�|d��tkr4t�d|��	ddd��ddd��dSt|xxd	z
cc<ddd��n#1swxYwY	|�d
��}|rt!|��d
kr[	t5t|xxd	zcc<t|dkrt|=ddd��n#1swxYwYddd��dSt#jd|��d}|dks|t&kr[	t5t|xxd	zcc<t|dkrt|=ddd��n#1swxYwYddd��dSd}t!|��|kr�|�|t!|��z
��}|s[	t5t|xxd	zcc<t|dkrt|=ddd��n#1swxYwYddd��dS||z
}t!|��|k��	t)|��}	n�#tjt,f$r�}
|�ttjdt/|
��id����������Yd}
~
t5t|xxd	zcc<t|dkrt|=ddd��n#1swxYwYddd��dSd}
~
wwxYw	t1|	�d
����}n�#t4$r�}
|�tt/|
���������Yd}
~
t5t|xxd	zcc<t|dkrt|=ddd��n#1swxYwYddd��dSd}
~
wwxYw	|�|	��n�#t8$r�}
|�tt/|
���������Yd}
~
t5t|xxd	zcc<t|dkrt|=ddd��n#1swxYwYddd��dSd}
~
wwxYwt;|	t/|��|��\}}
|�t|p|
����nu#t<t>j f$r\Yt5t|xxd	zcc<t|dkrt|=ddd��n#1swxYwYddd��dSwxYw	t5t|xxd	zcc<t|dkrt|=ddd��n#1swxYwYnR#t5t|xxd	zcc<t|dkrt|=ddd��w#1swxYwYwxYwddd��dS#1swxYwYdS)z
    Handle incoming connection
    :param connection: socket object usable to
    send and receive data on the connection
    �resultz#Commands from root are not acceptedF)�ensure_asciig@Nrz6Too many concurrent connections from uid=%s, rejecting��z>Irr1)!�json�dumpsr�
settimeoutrr�sendallrr�_uid_connections_lock�_uid_connectionsrN�_MAX_CONNECTIONS_PER_UIDrW�warning�recv�len�struct�unpack�_MAX_REQUEST_SIZEr
�JSONDecodeError�UnicodeDecodeErrorrPrrTr�	validator�
SystemExitrkr[�socketrL)rl�
root_error�_pid�_uid�_gid�
raw_msglen�msglen�data�chunk�args�er1�_outrs              r�handler��s�
�����!�9�:�:������J�
�8/�8/����c�"�"�"�(��4�4���d�D��$���	����}�Z�->�->�-@�-@�A�A�B�B�B��8/�8/�8/�8/�8/�8/�8/�8/�#�	(�	(��#�#�D�!�,�,�0H�H�H����W�Y]�^�^�^��	(�	(�	(�	(�	(�	(�8/�8/�8/�8/�8/�8/�8/�8/�
�T�"�"�"�a�'�"�"�"�		(�	(�	(�	(�	(�	(�	(�	(�	(�	(�	(����	(�	(�	(�	(�+	/�#����+�+�J��
��Z���1�!4�!4��J'�
/�
/� ��&�&�&�!�+�&�&�&�#�D�)�Q�.�.�(��.�
/�
/�
/�
/�
/�
/�
/�
/�
/�
/�
/����
/�
/�
/�
/�k8/�8/�8/�8/�8/�8/�8/�8/�$�]�4��4�4�Q�7�F���{�{�f�'8�8�8��B'�
/�
/� ��&�&�&�!�+�&�&�&�#�D�)�Q�.�.�(��.�
/�
/�
/�
/�
/�
/�
/�
/�
/�
/�
/����
/�
/�
/�
/�k8/�8/�8/�8/�8/�8/�8/�8/�,�D��d�)�)�f�$�$�"�����T���(:�;�;�����6'�
/�
/� ��&�&�&�!�+�&�&�&�#�D�)�Q�.�.�(��.�
/�
/�
/�
/�
/�
/�
/�
/�
/�
/�
/����
/�
/�
/�
/�k8/�8/�8/�8/�8/�8/�8/�8/�6��
��	�d�)�)�f�$�$�
�%�d�+�+�����(�*<�=�
�
�
��"�"�=��J��#�a�&�&�1��F�F�F�M�M�O�O�$Q�$Q�R�R�R�����&'�
/�
/� ��&�&�&�!�+�&�&�&�#�D�)�Q�.�.�(��.�
/�
/�
/�
/�
/�
/�
/�
/�
/�
/�
/����
/�
/�
/�
/�k8/�8/�8/�8/�8/�8/�8/�8/�����>
����

�#�D�H�H�X�$6�$6�7�7�����
�
�
��"�"�=��Q�������#A�#A�B�B�B�����'�
/�
/� ��&�&�&�!�+�&�&�&�#�D�)�Q�.�.�(��.�
/�
/�
/�
/�
/�
/�
/�
/�
/�
/�
/����
/�
/�
/�
/�k8/�8/�8/�8/�8/�8/�8/�8/�����L
����
�� � ��&�&�&�&���
�
�
��"�"�=��Q�������#A�#A�B�B�B�����'�
/�
/� ��&�&�&�!�+�&�&�&�#�D�)�Q�.�.�(��.�
/�
/�
/�
/�
/�
/�
/�
/�
/�
/�
/����
/�
/�
/�
/�k8/�8/�8/�8/�8/�8/�8/�8/�����X
����)��s�4�y�y�&�A�A�J�D�$����}�T�\�T�:�:�;�;�;�;�����(�	�	�	��&�
/�
/� ��&�&�&�!�+�&�&�&�#�D�)�Q�.�.�(��.�
/�
/�
/�
/�
/�
/�
/�
/�
/�
/�
/����
/�
/�
/�
/�k8/�8/�8/�8/�8/�8/�8/�8/�d	����
<�'�
/�
/� ��&�&�&�!�+�&�&�&�#�D�)�Q�.�.�(��.�
/�
/�
/�
/�
/�
/�
/�
/�
/�
/�
/����
/�
/�
/�
/���&�
/�
/� ��&�&�&�!�+�&�&�&�#�D�)�Q�.�.�(��.�
/�
/�
/�
/�
/�
/�
/�
/�
/�
/�
/����
/�
/�
/�
/�
/����k8/�8/�8/�8/�8/�8/�8/�8/�8/�8/�8/�8/����8/�8/�8/�8/�8/�8/s��A-[�"[�)AD#�*[�D#�[�#D'	�'[�*D'	�+[�/*V1�[�!/F�[�F 	� [�#F 	�$[�4,V1�![�(/H#�[�#H'	�'[�*H'	�+[�;<V1�8[�?/J:�.[�:J>	�>[�J>	�[�V1�+K;�:V1�;O�AO�(V1�,[�3/N.�"[�.N2	�2[�5N2	�6[�O�V1�"O2�1V1�2
R �<AR�=V1�[�/R�7[�R	�[�
R	�[�R � V1�$R:�9V1�:
U(�AU#�V1�	[�/U�?[�U	�[�U	�[�#U(�(AV1�0Y5�1X#�Y5�[�/X
�>[�
X	�[�X	�[�"X#�#Y5�'[�./Y)�[�)Y-	�-[�0Y-	�1[�5[�=/Z8	�,[�8Z<
�<[�?Z<
�[�[�[�[c��tt��tt��5}t	t
d���5}	|���\}}	|�t|��nC#tj
$r1t�d��|�
��YnwxYw�x#1swxYwYddd��dS#1swxYwYdS)z
    Run listening service
    r)�max_workers�maxqueuesizeTz(Connection rejected: thread pool is fullN)rr
rr	r�_MAX_WORKERS�accept�submitr��queue�FullrW�error�close)�s�pool�connrs    rrZrZ�s<���n�%�%�%�	��	'�	'��1�	�<�a�	H�	H�	H��LP�	��h�h�j�j�G�D�!�
����F�D�)�)�)�)���:�
�
�
����G�H�H�H��
�
������
����		��������������������������������sS�C�B:�A6�5B:�6=B6�3B:�5B6�6B:�:B>	�>C�B>	�C�C�C)rlrmrN)rN);�__doc__�collectionsrs�loggingr�r#r�r}rY�	threadingrr�typingr�xray.agent.executorr�#xray.console_utils.run_user.runnersrr�xray.internal.constantsr	r
�xray.internal.exceptionsr�xrayrr�xray.internal.user_plugin_utilsr
rrrr�xray.internal.utilsrrr�clcommon.clwpos_libr�	getLoggerrW�compilerQr�ry�defaultdict�intrxrwr�bytesr rPr&r.�dictrkr�rZr<rr�<module>r�s���������������������	�	�	�	�
�
�
�
�
�
�
�
�����*�*�*�*�*�*�*�*�������5�5�5�5�5�5�B�B�B�B�B�B�B�B�C�C�C�C�C�C�C�C�.�.�.�.�.�.���������������������N�M�M�M�M�M�M�M�M�M�6�6�6�6�6�6�	��	�<�	(�	(��
�R�Z�K�
L�
L�
�����*�;�*�3�/�/���������.�E�%��,�/�.�.�.�.�O�5�O�S�O�O�O�O�?�U�?�u�?�?�?�?�*96�T�96��96�f�96��u�e�|�AT�96�96�96�96�xA/�A/�A/�A/�H
�
�
�
�
�
r

Yohohohohohooho | Sanrei Aya