관리-도구
편집 파일: htpasswd.cpython-311.pyc
� �Cg � �Z � d dl Z d dlZd dlZdZ G d� de� � Z G d� de� � ZdS )� Nz Eli Carterc � � e Zd ZdS )�HtpasswdDoesNotExistsN)�__name__� __module__�__qualname__� � ��/builddir/build/BUILDROOT/lve-stats-4.2.10-1.el8.x86_64/opt/cloudlinux/venv/lib/python3.11/site-packages/lvestats/lib/commons/htpasswd.pyr r s � � � � � ��Dr r c �2 � e Zd ZdZd d�Zd� Zd� Zd� Zd� ZdS ) �HtpasswdFilez2 A class for manipulating htpasswd files. Fc �� � g | _ || _ |sQt j � | j � � r| � � � d S t | j � d�� � �d S )Nz does not exist)�entries�filename�os�path�exists�loadr )�selfr �creates r �__init__zHtpasswdFile.__init__ sh � ���� �� �� O��w�~�~�d�m�,�,� O�� � ������+�t�}�,M�,M�,M�N�N�N� O� Or c � � g | _ t | j dd�� � 5 }|D ]J}|� d� � \ }}||� � � g}| j � |� � �K ddd� � dS # 1 swxY w Y dS )z5 Read the htpasswd file into memory. �r�utf-8��encoding�:N)r �openr �split�rstrip�append)r �f�line�username�pwhash�entrys r r zHtpasswdFile.load! s� � � ��� �$�-��w� 7� 7� 7� +�1�� +� +��#'�:�:�c�?�?� ��&�!�6�=�=�?�?�3����#�#�E�*�*�*�*� +� +� +� +� +� +� +� +� +� +� +� +� +���� +� +� +� +� +� +s �AA;�;A?�A?c �� � t | j dd�� � 5 }| j D ])}|� |d � d|d � d�� � �* ddd� � dS # 1 swxY w Y dS ) z1 Write the htpasswd file to disk �wr r r r � � N)r r r �write)r r! r% s r �savezHtpasswdFile.save, s� � � �$�-��w� 7� 7� 7� 4�1��� 4� 4�����5��8�2�2�e�A�h�2�2�2�3�3�3�3� 4� 4� 4� 4� 4� 4� 4� 4� 4� 4� 4� 4� 4���� 4� 4� 4� 4� 4� 4s �2A�A�Ac �T �� t j d� � }t j d|� d� � |d� � }t j ||z � � � d� � }�fd�| j D � � }|r ||d d<