Hacked By AnonymousFox

Current Path : /opt/cloudlinux/venv/lib64/python3.11/site-packages/lvestats/lib/commons/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/lvestats/lib/commons/__pycache__/htpasswd.cpython-311.pyc

�

)�f���l�ddlmZddlZddlZddlZdZGd�de��Zd�ZGd�de	��Z
dS)	�)�absolute_importNz
Eli Carterc��eZdZdS)�HtpasswdDoesNotExistsN)�__name__�
__module__�__qualname__����/builddir/build/BUILDROOT/lve-stats-4.2.8-1.el8.x86_64/opt/cloudlinux/venv/lib/python3.11/site-packages/lvestats/lib/commons/htpasswd.pyrrs�������Dr
rc�X�d}tj|��tj|��zS)z/
    Returns a string of 2 randome letters
    z@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/.)�random�choice)�letterss r�saltrs*���G��=��!�!�F�M�'�$:�$:�:�:r
c�2�eZdZdZd	d�Zd�Zd�Zd�Zd�ZdS)
�HtpasswdFilez2
    A class for manipulating htpasswd files.
    Fc���g|_||_|sQtj�|j��r|���dSt
d|jz���dS)Nz%s does not exist)�entries�filename�os�path�exists�loadr)�selfr�creates   r�__init__zHtpasswdFile.__init__"se����� ��
��	Q��w�~�~�d�m�,�,�
Q��	�	������+�,?�$�-�,O�P�P�P�		Q�	Qr
c��t|jd�����}g|_|D]J}|�d��\}}||���g}|j�|���KdS)z5
        Read the htpasswd file into memory.
        �r�:N)�openr�	readlinesr�split�rstrip�append)r�lines�line�username�pwhash�entrys      rrzHtpasswdFile.load+s����T�]�C�(�(�2�2�4�4������	'�	'�D�#�z�z�#����H�f��v�}�}���/�E��L����&�&�&�&�	'�	'r
c�t�t|jd���d�|jD����dS)z1
        Write the htpasswd file to disk
        �wc�6�g|]}|d�d|d�d���S)rr��
r	)�.0r)s  r�
<listcomp>z%HtpasswdFile.save.<locals>.<listcomp>:sD��-H�-H�-H�16�;@��(�(�(�E�!�H�H�H�-M�-H�-H�-Hr
N)r r�
writelinesr)rs r�savezHtpasswdFile.save6sZ��	
�T�]�C� � �+�+�-H�-H�:>�,�-H�-H�-H�	I�	I�	I�	I�	Ir
c����tj|t����}�fd�|jD��}|r
||dd<dS|j��|g��dS)zI
        Replace the entry for the given user, or add it if new.
        c�,��g|]}|d�k�|��S�rr	�r/r)r's  �rr0z'HtpasswdFile.update.<locals>.<listcomp>Bs1���5�5�5�e�$�Q�x�8�3�3�"�3�3�3r
rr-N)�cryptrrr$)rr'�passwordr(�matching_entriess `   r�updatezHtpasswdFile.update=s������X�t�v�v�.�.��5�5�5�5�t�|�5�5�5���	4�%+��Q���"�"�"��L����6� 2�3�3�3�3�3r
c�8���fd�|jD��|_dS)z6
        Remove the entry for the given user.
        c�,��g|]}|d�k�|��Sr5r	r6s  �rr0z'HtpasswdFile.delete.<locals>.<listcomp>Ms1���1�1�1�%� ��8�x�/�/��/�/�/r
N)r)rr's `r�deletezHtpasswdFile.deleteIs2���1�1�1�1�4�<�1�1�1����r
N)F)	rrr�__doc__rrr2r:r=r	r
rrrsu��������Q�Q�Q�Q�	'�	'�	'�I�I�I�
4�
4�
4�1�1�1�1�1r
r)�
__future__rrr
r7�
__author__�	Exceptionrr�objectrr	r
r�<module>rCs���'�&�&�&�&�&�	�	�	�	�
�
�
�
�����
�
�	�	�	�	�	�I�	�	�	�;�;�;�11�11�11�11�11�6�11�11�11�11�11r

Hacked By AnonymousFox1.0, Coded By AnonymousFox