� H�gMO��z�dZddlZddlZeje��ZddlmZddlm Z ddl m Z m Z ddl mZddlmZmZmZddlmZdd lmZgd �ZGd �d e��Ze��Ze��ZejZe d�id d�dd�dd�dd�dd�dd�dd�dd�dd�dd�dd�dd�d d�d!d�d"d#�d$d#�d%d#�d&d#�d'd#�d(d#�d)d#�d*d#�d+d#�d,d�d-d.�d/d�d0d1�d2d1�d3d1�d4d1�d5d1�d6d1�d7d8�d9d8�d:d8�d;d<�d=d<�d>d8�d?d8�d@d8�dAd8�dBd8�dCd8�dDd8�dEd8�dFd8�dGd8�dHd8�dId�dJd�dKd�dLd�dMd�dNd�dOd�dPdQ�dRdQ�dSdT�dUdT�dVd�dWdX�dYdX�dZd�d[d�d\d�d]d^�d_d`�dadb�dcd<�ddde�dfdg�dhdi�djdk�dldk�dmdn�dod`�dpd`��Z!ej"dq��Z#e$gdr���Z%ds�Z&dt�Z'd�dv�Z(efdw�Z)d�dx�Z*d�dy�Z+d�d{�Z,d�d}�Z-d~Z.dZ/d�Z0e.dufd��Z1ed����Z2d��Z3dS)�z6passlib.registry - registry for password hash handlers�N)�warn)�exc)�ExpectedTypeError�PasslibWarning)� PasswordHash)�is_crypt_handler� has_crypt�unix_crypt_schemes)�unicode_or_str)�memoize_single_value)�register_crypt_handler_path�register_crypt_handler�get_crypt_handler�list_crypt_handlersc�2�eZdZdZdZdZd�Zd�Zd�Zd�ZdS)�_PasslibRegistryProxyz�proxy module passlib.hash this module is in fact an object which lazy-loads the requested password hash algorithm from wherever it has been stored. it acts as a thin wrapper around :func:`passlib.registry.get_crypt_handler`. z passlib.hashNc��|�d��rtd|�����t|d��}|r|Std|�����)N�_zmissing attribute: zunknown password hash: )� startswith�AttributeErrorr)�self�attr�handlers �`/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/passlib/registry.py� __getattr__z!_PasslibRegistryProxy.__getattr__(s^�� �?�?�3� � � D� �.�D�D�!B�C�C� C�#�D�$�/�/�� � H��N� �.���!F�G�G� G�c��|�d��rt�|||��dSt||���dS)Nr��_attr)r�object� __setattr__r)rr�values rr!z!_PasslibRegistryProxy.__setattr__1sQ�� �?�?�3� � � 6� � � �t�T�5� 1� 1� 1� 1� 1� #�5�� 5� 5� 5� 5� 5� 5rc��dS)Nz<proxy module 'passlib.hash'>�)rs r�__repr__z_PasslibRegistryProxy.__repr__;s��.�.rc���tt|j����}|�|j��|�t ��t |��S�N)�set�dir� __class__�update�__dict__� _locations�sorted)r�attrss r�__dir__z_PasslibRegistryProxy.__dir__>sM���C���'�'�(�(�� � � �T�]�#�#�#� � � �Z� � � ��e�}�}�r) �__name__� __module__� __qualname__�__doc__� __package__rr!r%r0r$rrrrsi�������� �H��K�H�H�H�6�6�6�/�/�/�����rr� apr_md5_cryptzpasslib.handlers.md5_crypt�argon2zpasslib.handlers.argon2�atlassian_pbkdf2_sha1zpasslib.handlers.pbkdf2�bcryptzpasslib.handlers.bcrypt� bcrypt_sha256�bigcryptzpasslib.handlers.des_crypt� bsd_nthashzpasslib.handlers.windows� bsdi_crypt� cisco_pixzpasslib.handlers.cisco� cisco_asa� cisco_type7�cta_pbkdf2_sha1�crypt16� des_crypt� django_argon2zpasslib.handlers.django� django_bcrypt�django_bcrypt_sha256�django_pbkdf2_sha256�django_pbkdf2_sha1�django_salted_sha1�django_salted_md5�django_des_crypt�django_disabled�dlitz_pbkdf2_sha1�fshpzpasslib.handlers.fshp�grub_pbkdf2_sha512�hex_md4zpasslib.handlers.digests�hex_md5�hex_sha1� hex_sha256� hex_sha512�htdigest�ldap_plaintextzpasslib.handlers.ldap_digests�ldap_md5� ldap_sha1� ldap_hex_md5zpasslib.handlers.roundup� ldap_hex_sha1�ldap_salted_md5�ldap_salted_sha1�ldap_salted_sha256�ldap_salted_sha512�ldap_des_crypt�ldap_bsdi_crypt�ldap_md5_crypt� ldap_bcrypt�ldap_sha1_crypt�ldap_sha256_crypt�ldap_sha512_crypt�ldap_pbkdf2_sha1�ldap_pbkdf2_sha256�ldap_pbkdf2_sha512�lmhash� md5_crypt�msdcc�msdcc2� mssql2000zpasslib.handlers.mssql� mssql2005�mysql323zpasslib.handlers.mysql�mysql41�nthash�oracle10zpasslib.handlers.oracle�oracle11� pbkdf2_sha1� pbkdf2_sha256� pbkdf2_sha512�phpasszpasslib.handlers.phpass� plaintextzpasslib.handlers.misc� postgres_md5zpasslib.handlers.postgres�roundup_plaintext�scramzpasslib.handlers.scram�scryptzpasslib.handlers.scrypt� sha1_cryptzpasslib.handlers.sha1_crypt� sha256_cryptzpasslib.handlers.sha2_crypt� sha512_crypt� sun_md5_cryptzpasslib.handlers.sun_md5_crypt� unix_disabled� unix_fallbackz^[a-z][a-z0-9_]+[a-z0-9]$)�onload�policy�context�all�default�none�autoc�<�|std|�����|���|krtd|�����t�|��std|�����d|vrtd|�����|tvrtd|�����dS)z�helper to validate handler name :raises ValueError: * if empty name * if name not lower case * if name contains double underscores * if name is reserved (e.g. ``context``, ``all``). zhandler name cannot be empty: zname must be lower-case: z^invalid name (must be 3+ characters, begin with a-z, and contain only underscore, a-z, 0-9): �__z)name may not contain double-underscores: zthat name is not allowed: T)� ValueError�lower�_name_re�match�_forbidden_names)�names r�_validate_handler_namer��s��� �G��j�t�t�E�F�F�F� �z�z�|�|�t����j�$�$�@�A�A�A� �>�>�$� � �/��j�'+�t�.�/�/� /� �t�|�|��j��$�!�"�"� "� �����j�4�4�A�B�B�B� �4rc��t|��|�d��rtd���d|vrd|�d��dkrtd���|�d|�d����dkrtd���|t |<t�d||��d S) avregister location to lazy-load handler when requested. custom hashes may be registered via :func:`register_crypt_handler`, or they may be registered by this function, which will delay actually importing and loading the handler until a call to :func:`get_crypt_handler` is made for the specified name. :arg name: name of handler :arg path: module import path the specified module path should contain a password hash handler called :samp:`{name}`, or the path may contain a colon, specifying the module and module attribute to use. for example, the following would cause ``get_handler("myhash")`` to look for a class named ``myhash`` within the ``myapp.helpers`` module:: >>> from passlib.registry import registry_crypt_handler_path >>> registry_crypt_handler_path("myhash", "myapp.helpers") ...while this form would cause ``get_handler("myhash")`` to look for a class name ``MyHash`` within the ``myapp.helpers`` module:: >>> from passlib.registry import registry_crypt_handler_path >>> registry_crypt_handler_path("myhash", "myapp.helpers:MyHash") �.zpath cannot start with '.'�:�z"path cannot have more than one ':'�����z$path cannot have '.' to right of ':'z!registered path to %r handler: %rN) r�rr��count�find�indexr-�log�debug)r��paths rr r �s���6�4� � � � ���s���7��5�6�6�6� �d�{�{� �:�:�c�?�?�Q� � ��A�B�B� B� �9�9�S�$�*�*�S�/�/� *� *�R� /� /��C�D�D� D��J�t���I�I�1�4��>�>�>�>�>rFc��t|��st|dd���|std���|j}t |��|r||krt d|�d|�d����t �|��}|rV||urt� d||��dS|rt� d ||��ntd |�d |�����|t |<t� d ||��dS) a@register password hash handler. this method immediately registers a handler with the internal passlib registry, so that it will be returned by :func:`get_crypt_handler` when requested. :arg handler: the password hash handler to register :param force: force override of existing handler (defaults to False) :param _attr: [internal kwd] if specified, ensures ``handler.name`` matches this value, or raises :exc:`ValueError`. :raises TypeError: if the specified object does not appear to be a valid handler. :raises ValueError: if the specified object's name (or other required attributes) contain invalid values. :raises KeyError: if a (different) handler was already registered with the same name, and ``force=True`` was not specified. zpassword hash handlerrz``bool(handler)`` must be Truez3handlers must be stored only under their own name (z != �)z&same %r handler already registered: %rNz/overriding previously registered %r handler: %rzanother z& handler has already been registered: zregistered %r handler: %r) rr�AssertionErrorr�r�r�� _handlers�getr�r��warning�KeyError)r�forcerr��others rrr�sG��0 �G� $� $�M���)@�)�L�L�L� �?��=�>�>�>� �<�D��4� � � � �(��$����j��%�%����'�(�(� (� �M�M�$� � �E� � *� �G� � � �I�I�>��g� N� N� N� �F� � *� �K�K�I��e� %� %� %� %��(� �D�D�%�%�)�*�*� *��I�d�O��I�I�)�4��9�9�9�9�9rc�P�|�d��r|turtd|�����|S t|S#t$rYnwxYwt |t ��s Jd���|�dd�����}||kr=td|�d|��td���|} t|S#t$rYnwxYwt� |��}|r�d |vr|� d ��\}}n||}}t||gd � ��}t� |��}|r!t|��sJd |�d |�����|St||��}t!||���|S|turtd|�����|S)a'return handler for specified password hash scheme. this method looks up a handler for the specified scheme. if the handler is not already loaded, it checks if the location is known, and loads it first. :arg name: name of handler to return :param default: optional default value to return if no handler with specified name is found. :raises KeyError: if no handler matching that name is found, and no default specified, a KeyError will be raised. :returns: handler attached to name, or default value (if specified). rzinvalid handler name: zname must be string instance�-zLhandler names should be lower-case, and use underscores instead of hyphens: z => �)� stacklevelr�r)�fromlist�levelzunexpected object: name=z object=rz&no crypt handler found for algorithm: )r�_UNSETr�r�� isinstancer �replacer�rrr-r��split� __import__r�getattrr)r�r��altr��modname�modattr�modrs rrr*s��  ���s���� �f� � ��(���?�@�@� @��N� ������ � � � � �� ���� �d�N� +� +�K�K�-K�K�K� +� �,�,�s�3� � � %� %� '� '�C� �d�{�{� ��'+�t�t�S�S�2�3A�� � � � ��� ��T�?� "��� � � � �D� ���� �>�>�$� � �D� �� �$�;�;�#�z�z�#��� �G�W�W�#�T�W�G� ��G�9�A�>�>�>���-�-��%�%�� � �#�G�,�,� f� f� f�X\�X\�X\�^e�^e�.f� f� f�,��N��#�w�'�'���w�d�3�3�3�3����&����h�T�T�K�L�L�L��s#� A� A� A�> C � C�Cc��tt��}|s|�t��t d�|D����S)z�return sorted list of all known crypt handler names. :param loaded_only: if ``True``, only returns names of handlers which have actually been loaded. :returns: list of names of all known handlers c3�DK�|]}|�d���|V��dS)rN)r��.0r�s r� <genexpr>z&list_crypt_handlers.<locals>.<genexpr>�s3����E�E�4�����0D�0D�E�$�E�E�E�E�E�Er)r(r�r+r-r.)� loaded_only�namess rrrusH�� � �N�N�E� �!� � � �Z� � � � �E�E�5�E�E�E� E� E�Erc�,�|tvp | o|tvS)aAcheck if handler name is known. this is only useful for two cases: * quickly checking if handler has already been loaded * checking if handler exists, without actually loading it :arg name: name of handler :param loaded_only: if ``True``, returns False if handler exists but hasn't been loaded �r�r-)r�r�s r�_has_crypt_handlerr��s �� �I� � J�{�?�#I�t�z�7I�JrTc�V�|tvrt|=|r|tvr t|=dSdSdS)a�unloads a handler from the registry. .. warning:: this is an internal function, used only by the unittests. if loaded handler is found with specified name, it's removed. if path to lazy load handler is found, it's removed. missing names are a noop. :arg name: name of handler to unload :param locations: if False, won't purge registered handler locations (default True) Nr�)r�� locationss r�_unload_handler_namer��sF��  �y��� �d�O���T�Z�'�'� �t� � � ���'�'rr"c��t|��r|St|t��rt|��St j|t|���)z> internal helper to resolve argument to hasher object )rr�r rrr)�hasher�params r�_resolver��sP������C�� � �F�N� +� +�C� ��(�(�(��#�F�N�E�B�B�Br�any�builtin�os_cryptc�d�t|��}|tkr?t|d��sdS |���dS#tj$rYdSwxYwt|d��r"|r ||jvrdS|�|��S|tkrdS|rdSt j ||���)a� Test if specified backend is available for hasher. :param hasher: Hasher name or object. :param backend: Name of backend, or ``"any"`` if any backend will do. For hashers without multiple backends, will pretend they have a single backend named ``"builtin"``. :param safe: By default, throws error if backend is unknown. If ``safe=True``, will just return false value. :raises ValueError: * if hasher name is unknown. * if backend is unknown to hasher, and safe=False. :return: True if backend available, False if not available, and None if unknown + safe=True. � get_backendTF� has_backendN) r��ANY�hasattrr�r�MissingBackendError�backendsr��BUILTIN�UnknownBackendError)r��backend�safes rr�r��s���0�f� � �F��#�~�~��v�}�-�-� ��4� � � � � � � ��4���&� � � ��5�5� �����v�}�%�%�+� � �G�6�?�2�2��4��!�!�'�*�*�*��'����t� �7��t��%�f�g�6�6�6s�A�A�Ac���tsdStd�tD����}|sIddl}t d|����d|����d�tj��|S)zN return tuple of schemes which :func:`crypt.crypt` natively supports. r$c3�hK�|]-}t|���t���)|V��.dSr')rr��OS_CRYPTr�s rr�z1get_supported_os_crypt_schemes.<locals>.<genexpr>sY����D�D�4�&�t�,�,�8�8��B�B�D�$�D�D�D�D�D�DrrNz]crypt.crypt() function is present, but doesn't support any formats known to passlib! (system=z release=r�) �os_crypt_present�tuple�os_crypt_schemes�platformr�system�releaser�PasslibRuntimeWarning)�cacher�s r�get_supported_os_crypt_schemesr�s��� ���r� �D�D�#3�D�D�D� D� D�E� �(����� ���o�o������!1�!1�!3�!3�!3�!3�5�� &� (� (� (� �Lrc�>�tot|td���S)a check if hash is supported by native :func:`crypt.crypt` function. if :func:`crypt.crypt` is not present, will always return False. :param hasher: name or hasher object. :returns bool: True if hash format is supported by OS, else False. T)r�)r�r�r�)r�s r�has_os_crypt_supportr�s�� � H� �F�H�4� H� H� H�Hrr$)FN)F)T)r")4r4�re�logging� getLoggerr1r��warningsr�passlibr� passlib.excrr� passlib.ifcr� passlib.utilsrr r�r r��passlib.utils.compatr �passlib.utils.decorr �__all__r r�_proxyr�r,r��dictr-�compiler�� frozensetr�r�r rrrr�r�r�r�r�r�r�r�r�r$rr�<module>r�s7��<�<�  � � � �����'�g�'��1�1��������������9�9�9�9�9�9�9�9�$�$�$�$�$�$�����������0�/�/�/�/�/�4�4�4�4�4�4� � � ��&�&�&�&�&�F�&�&�&�R � � � �� ����� �O� � �T�P�P�P�1�0�P�'� &� P� 6�5� P� '� &� P�.�-�P�,�+�P�,�+�P�.�-�P�)�(�P�)�(�P�+�*�P�0�/�P�+�*�P� -�,�!P�".�-�#P�$.�-�%P�&5�4�'P�(5�4�)P�*3�2�+P�,3�2�-P�.2�1�/P�01�0�1P�20�/�3P�42�1�5P�6 #� "�7P�83�2�9P�:)�(�;P�<)�(�=P�>*�)�?P�@,�+�AP�B,�+�CP�D*�)�EP�F5�4�GP�H/�.�IP�J0�/�KP�L.�-�MP�N/�.�OP�P6�5�QP�R7�6�SP�T9�8�UP�V9�8�WP�X5�4�YP�Z6�5�[P�\5�4�]P�^2�1�_P�`6�5�aP�b8�7�cP�d8�7�eP�f1�0�gP�h3�2�iP�j3�2�kP�l(� '�mP�n-�,�oP�p '� &�qP�r(� '�sP�t)�(�uP�v)�(�wP�x(�'�yP�z'�&�{P�|(� '�}P�~)�(�P�@)�(�AP�B,�+�CP�D.�-�EP�F.�-�GP�H'� &�IP�J(�'�KP�L/�.�MP�N3�2�OP�P %� $�QP�R'� &�SP�T/�.�UP�V1�0�WP�X1�0�YP�Z5�4�[P�\,�+�]P�^,�+�_P� �f �2�:�1� 2� 2���9�9�9�9�:�:�� ���0(?�(?�(?�T3:�3:�3:�3:�j%+�I�I�I�I�V F� F� F� F� K� K� K� K�����< C� C� C� C� �� �� ��!$�%�37�37�37�37�|������& I� I� I� I� Ir
Memory