Ë
    àU.j}'  ã                   ól  — d Z ddlZddlZ ej                  e«      ZddlmZ ddlm	Z	m
Z
 ddlmZmZmZ ddlmc mZ g d¢Z G d„ dej(                  j*                  ej,                  «      Z ed	«      Zd
Z G d„ dej(                  j*                  ej4                  «      Z G d„ dej4                  «      Zy)z.passlib.handlers.misc - misc generic handlers
é    N)Úwarn)Úto_native_strÚstr_consteq)ÚunicodeÚuÚunicode_or_bytes_types)Úunix_disabledÚunix_fallbackÚ	plaintextc                   óT   ‡ — e Zd ZdZd ZdZed„ «       Zdˆ fd„	Zd„ Z	edd„«       Z
ˆ xZS )r
   a…  This class provides the fallback behavior for unix shadow files, and follows the :ref:`password-hash-api`.

    This class does not implement a hash, but instead provides fallback
    behavior as found in /etc/shadow on most unix variants.
    If used, should be the last scheme in the context.

    * this class will positively identify all hash strings.
    * for security, passwords will always hash to ``!``.
    * it rejects all passwords if the hash is NOT an empty string (``!`` or ``*`` are frequently used).
    * by default it rejects all passwords if the hash is an empty string,
      but if ``enable_wildcard=True`` is passed to verify(),
      all passwords will be allowed through if the hash is an empty string.

    .. deprecated:: 1.6
        This has been deprecated due to its "wildcard" feature,
        and will be removed in Passlib 1.8. Use :class:`unix_disabled` instead.
    )Úenable_wildcardc                 ód   — t        |t        «      ryt        j                  j	                  |d«      ‚©NTÚhash©Ú
isinstancer   ÚuhÚexcÚExpectedStringError©Úclsr   s     úWC:\xampp\htdocs\tradingbinance\backend\.venv\Lib\site-packages\passlib/handlers/misc.pyÚidentifyzunix_fallback.identify.   ó'   € ä�dÔ2Ô3Øä—&‘&×,Ñ,¨T°6Ó:Ð:ó    c                 óZ   •— t        dt        «       t        t        | �  di |¤Ž || _        y )Nzf'unix_fallback' is deprecated, and will be removed in Passlib 1.8; please use 'unix_disabled' instead.© )r   ÚDeprecationWarningÚsuperr
   Ú__init__r   )Úselfr   ÚkwdsÚ	__class__s      €r   r    zunix_fallback.__init__5   s1   ø€ Üð 3ô  ô	!ô 	Œm˜TÑ+Ñ3¨dÒ3Ø.ˆÕr   c                 óH   — | j                   r| j                   S t        d«      S )NÚ!)Úchecksumr   )r!   Úsecrets     r   Ú_calc_checksumzunix_fallback._calc_checksum=   s   € Ø�=Š=ð —=‘=Ð ä�S“6ˆMr   c                 ó–   — t        j                  |«       t        |t        «      s t         j                  j                  |d«      ‚|ry|S )Nr   F)r   Úvalidate_secretr   r   r   r   )r   r'   r   r   s       r   Úverifyzunix_fallback.verifyE   s>   € ä
×Ñ˜6Ô"Ü˜$Ô 6Ô7Ü—&‘&×,Ñ,¨T°6Ó:Ð:ÙØà"Ð"r   )F)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚnameÚcontext_kwdsÚclassmethodr   r    r(   r+   Ú__classcell__©r#   s   @r   r
   r
      sD   ø„ ñð" €DØ'€Làñ;ó ð;õ/òð ò#ó ô#r   r
   z*!s   *!c                   ó&  ‡ — e Zd ZdZd ZdZdZ e ee	«      «      Z
dej                  v r	 ed«      Zn ed«      Zedˆ fd„	«       Zed„ «       Zed	„ «       Zed
„ «       Z ej*                  dd¬«      edd„«       «       Zedd„«       Zed„ «       Zˆ xZS )r	   a  This class provides disabled password behavior for unix shadow files,
    and follows the :ref:`password-hash-api`.

    This class does not implement a hash, but instead matches the "disabled account"
    strings found in ``/etc/shadow`` on most Unix variants. "encrypting" a password
    will simply return the disabled account marker. It will reject all passwords,
    no matter the hash string. The :meth:`~passlib.ifc.PasswordHash.hash`
    method supports one optional keyword:

    :type marker: str
    :param marker:
        Optional marker string which overrides the platform default
        used to indicate a disabled account.

        If not specified, this will default to ``"*"`` on BSD systems,
        and use the Linux default ``"!"`` for all other platforms.
        (:attr:`!unix_disabled.default_marker` will contain the default value)

    .. versionadded:: 1.6
        This class was added as a replacement for the now-deprecated
        :class:`unix_fallback` class, which had some undesirable features.
    ©Úmarkerr   ÚbsdÚ*r%   c                 ó~   •— t        t        | �
  di |¤Ž}|�&| j                  |«      st	        d|z  «      ‚||_        |S )Nzinvalid marker: %rr   )r   r	   Úusingr   Ú
ValueErrorÚdefault_marker)r   r7   r"   Úsubclsr#   s       €r   r;   zunix_disabled.usingx   sG   ø€ ä”} cÑ0Ñ8°4Ñ8ˆØÐØ—<‘< Ô'Ü Ð!5¸Ñ!>Ó?Ð?Ø$*ˆFÔ!Øˆr   c                 ó¶   — t        |t        «      rt        }n7t        |t        «      rt        }n t
        j                  j                  |d«      ‚| xs |d   |v S )Nr   r   )r   r   Ú_MARKER_CHARSÚbytesÚ_MARKER_BYTESr   r   r   )r   r   Ústarts      r   r   zunix_disabled.identify�   sO   € ô  �dœGÔ$Ü!‰EÜ˜œeÔ$Ü!‰Eä—&‘&×,Ñ,¨T°6Ó:Ð:ØˆxÒ+˜4 ™7 eÐ+Ð+r   c                 óŽ   — t        j                  |«       | j                  |«      st         j                  j	                  | «      ‚y)NF)r   r*   r   r   ÚInvalidHashError)r   r'   r   s      r   r+   zunix_disabled.verify™   s4   € ä
×Ñ˜6Ô"Ø�|‰|˜DÔ!Ü—&‘&×)Ñ)¨#Ó.Ð.Ør   c                 óú   — |r7t        j                  | |«        | j                  di |¤Žj                  |«      S t        j                  |«       | j
                  }|r| j                  |«      sJ ‚t        |d¬«      S )Nr7   ©Úparamr   )r   Úwarn_hash_settings_deprecationr;   r   r*   r=   r   r   )r   r'   r"   r7   s       r   r   zunix_disabled.hash    sn   € áÜ×-Ñ-¨c°4Ô8Ø�3—9‘9Ñ$˜tÑ$×)Ñ)¨&Ó1Ð1Ü
×Ñ˜6Ô"Ø×#Ñ#ˆÙ˜#Ÿ,™, vÔ.Ð.Ð.Ü˜V¨8Ô4Ð4r   ú1.7ú2.0©Ú
deprecatedÚremovedc                 óô   — | j                  |«      st        j                  j                  | «      ‚|r"t        j                  |«       t        |d¬«      S |�| j                  |¬«      } | j                  |«      S )NÚconfigrG   r6   )r   r   r   rE   r*   r   r;   r   )r   r'   rP   r7   s       r   Úgenhashzunix_disabled.genhashª   sh   € ð �|‰|˜FÔ#Ü—&‘&×)Ñ)¨#Ó.Ð.Ùä×Ñ˜vÔ&Ü  ¨xÔ8Ð8àÐ!Ø—i‘i v�iÓ.�Ø—8‘8˜FÓ#Ð#r   c                 ó˜   — | j                  d«      }|�6t        |d¬«      }| j                  |«      r| j                  |«      }|r||z  }|S )NÚ r   rG   )r   r   r   Úenable)r   r   Úouts      r   Údisablezunix_disabled.disable¸   sL   € à�h‰h�r‹lˆØÐÜ  ¨VÔ4ˆDØ�|‰|˜DÔ!à—z‘z $Ó'�ÙØ�t‘�Øˆ
r   c                 óÜ   — t        |d¬«      }| j                  D ]2  }|j                  |«      sŒ|t        |«      d  }|r|c S t	        d«      ‚ t
        j                  j                  | «      ‚)Nr   rG   zcannot restore original hash)r   Ú_disable_prefixesÚ
startswithÚlenr<   r   r   rE   )r   r   ÚprefixÚorigs       r   rT   zunix_disabled.enableÄ   se   € ä˜T¨Ô0ˆØ×+Ô+ˆFØ�‰˜vÕ&ØœC ›K˜LÐ)�ÙØ’Kä$Ð%CÓDÐDð ,ô �f‰f×%Ñ% cÓ*Ð*r   ©N)r,   r-   r.   r/   r0   Úsetting_kwdsr1   ÚtupleÚstrr@   rX   ÚsysÚplatformr   r=   r2   r;   r   r+   r   r   Údeprecated_methodrQ   rV   rT   r3   r4   s   @r   r	   r	   R   sì   ø„ ñð, €DØ€LØ€Lá™c -Ó0Ó1Ðð �—‘ÑÙ˜3›‰ñ
 ˜3›ˆàôó ðð ñ,ó ð,ð. ñó ðð ñ5ó ð5ð €R×Ñ U°EÔ:Øò
$ó ó ;ð
$ð ò	ó ð	ð ñ	+ó ô	+r   r	   c                   óÒ   — e Zd ZdZd ZdZdZdZed„ «       Z	edd„«       Z
edd„«       Z ej                  d	d
¬«      ed„ «       «       Z ej                  d	d
¬«      edd„«       «       Zy)r   a~  This class stores passwords in plaintext, and follows the :ref:`password-hash-api`.

    The :meth:`~passlib.ifc.PasswordHash.hash`, :meth:`~passlib.ifc.PasswordHash.genhash`, and :meth:`~passlib.ifc.PasswordHash.verify` methods all require the
    following additional contextual keyword:

    :type encoding: str
    :param encoding:
        This controls the character encoding to use (defaults to ``utf-8``).

        This encoding will be used to encode :class:`!unicode` passwords
        under Python 2, and decode :class:`!bytes` hashes under Python 3.

    .. versionchanged:: 1.6
        The ``encoding`` keyword was added.
    r   ©Úencodingzutf-8c                 ód   — t        |t        «      ryt        j                  j	                  |d«      ‚r   r   r   s     r   r   zplaintext.identifyç   r   r   Nc                 ób   — t        j                  |«       |s| j                  }t        ||d«      S )Nr'   )r   r*   Údefault_encodingr   )r   r'   rf   s      r   r   zplaintext.hashî   s-   € ä
×Ñ˜6Ô"ÙØ×+Ñ+ˆHÜ˜V X¨xÓ8Ð8r   c                 óÐ   — |s| j                   }t        ||d«      }| j                  |«      st        j                  j                  | «      ‚t        | j                  ||«      |«      S )Nr   )ri   r   r   r   r   rE   r   r   )r   r'   r   rf   s       r   r+   zplaintext.verifyõ   sW   € áØ×+Ñ+ˆHÜ˜T 8¨VÓ4ˆØ�|‰|˜DÔ!Ü—&‘&×)Ñ)¨#Ó.Ð.Ü˜3Ÿ8™8 F¨HÓ5°tÓ<Ð<r   rJ   rK   rL   c                 ó$   — | j                  d«      S )NrS   )r   )r   s    r   Ú	genconfigzplaintext.genconfigþ   s   € ð �x‰x˜‹|Ðr   c                 óˆ   — | j                  |«      st        j                  j                  | «      ‚| j	                  ||¬«      S )Nre   )r   r   r   rE   r   )r   r'   rP   rf   s       r   rQ   zplaintext.genhash  s8   € ð �|‰|˜FÔ#Ü—&‘&×)Ñ)¨#Ó.Ð.Ø�x‰x˜¨ˆxÓ2Ð2r   r]   )r,   r-   r.   r/   r0   r^   r1   ri   r2   r   r   r+   r   rc   rl   rQ   r   r   r   r   r   Ð   s®   „ ñð" €DØ€LØ €LØÐàñ;ó ð;ð ò9ó ð9ð ò=ó ð=ð €R×Ñ U°EÔ:Øñó ó ;ðð €R×Ñ U°EÔ:Øò3ó ó ;ñ3r   r   )r/   ra   ÚloggingÚ	getLoggerr,   ÚlogÚwarningsr   Úpasslib.utilsr   r   Úpasslib.utils.compatr   r   r   Úpasslib.utils.handlersÚutilsÚhandlersr   Ú__all__ÚifcÚDisabledHashÚStaticHandlerr
   r@   rB   ÚMinimalHandlerr	   r   r   r   r   Ú<module>r|      s¡   ðñó Û Ð'�g×'Ñ'¨Ó1�Ý ÷ 5ß CÑ Cß #Ð #ò€ô4#�B—F‘F×'Ñ'¨×)9Ñ)9ô 4#ñl �$“€Ø€ô|+�B—F‘F×'Ñ'¨×):Ñ):ô |+ô|93�×!Ñ!õ 93r   