403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /lib/python3.9/site-packages/passlib/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /lib/python3.9/site-packages/passlib/__pycache__/registry.cpython-39.opt-1.pyc
a

f�WcMO�O@s�dZddlZddlZe�e�ZddlmZddlm	Z	ddl
mZmZddl
mZddlmZmZmZddlmZdd	lmZgd
�ZGdd�de�Ze�Ze�ZejZe d
dddddddddddddddddddddddddddddddddddddddddddddddddddd
dddddddddddddddddd d!d"d"d#ddd$�MZ!e�"d%�Z#e$gd&��Z%d'd(�Z&d)d*�Z'dCd,d-�Z(efd.d/�Z)dDd0d1�Z*dEd2d3�Z+dFd5d6�Z,dGd8d9�Z-d:Z.d;Z/d<Z0e.d+fd=d>�Z1ed?d@��Z2dAdB�Z3dS)Hz6passlib.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@s8eZdZdZdZdZdd�Zdd�Zdd	�Zd
d�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.hashNcCs<|�d�rtd|f��t|d�}|r*|Std|f��dS)N�_zmissing attribute: %rzunknown password hash: %r)�
startswith�AttributeErrorr)�self�attr�handler�r�4/usr/lib/python3.9/site-packages/passlib/registry.py�__getattr__(s

z!_PasslibRegistryProxy.__getattr__cCs*|�d�rt�|||�nt||d�dS)Nr��_attr)r�object�__setattr__r
)rr�valuerrrr1s
z!_PasslibRegistryProxy.__setattr__cCsdS)Nz<proxy module 'passlib.hash'>r)rrrr�__repr__;sz_PasslibRegistryProxy.__repr__cCs,tt|j��}|�|j�|�t�t|�S�N)�set�dir�	__class__�update�__dict__�
_locations�sorted)r�attrsrrr�__dir__>s
z_PasslibRegistryProxy.__dir__)	�__name__�
__module__�__qualname__�__doc__�__package__rrrr)rrrrrs	
rzpasslib.handlers.md5_cryptzpasslib.handlers.argon2zpasslib.handlers.pbkdf2zpasslib.handlers.bcryptzpasslib.handlers.des_cryptzpasslib.handlers.windowszpasslib.handlers.ciscozpasslib.handlers.djangozpasslib.handlers.fshpzpasslib.handlers.digestszpasslib.handlers.ldap_digestszpasslib.handlers.roundupzpasslib.handlers.mssqlzpasslib.handlers.mysqlzpasslib.handlers.oraclezpasslib.handlers.phpasszpasslib.handlers.misczpasslib.handlers.postgreszpasslib.handlers.scramzpasslib.handlers.scryptzpasslib.handlers.sha1_cryptzpasslib.handlers.sha2_cryptzpasslib.handlers.sun_md5_crypt)MZ
apr_md5_cryptZargon2Zatlassian_pbkdf2_sha1ZbcryptZ
bcrypt_sha256ZbigcryptZ
bsd_nthashZ
bsdi_cryptZ	cisco_pixZ	cisco_asaZcisco_type7Zcta_pbkdf2_sha1Zcrypt16Z	des_cryptZ
django_argon2Z
django_bcryptZdjango_bcrypt_sha256Zdjango_pbkdf2_sha256Zdjango_pbkdf2_sha1Zdjango_salted_sha1Zdjango_salted_md5Zdjango_des_cryptZdjango_disabledZdlitz_pbkdf2_sha1ZfshpZgrub_pbkdf2_sha512Zhex_md4Zhex_md5Zhex_sha1Z
hex_sha256Z
hex_sha512ZhtdigestZldap_plaintextZldap_md5Z	ldap_sha1Zldap_hex_md5Z
ldap_hex_sha1Zldap_salted_md5Zldap_salted_sha1Zldap_salted_sha256Zldap_salted_sha512Zldap_des_cryptZldap_bsdi_cryptZldap_md5_cryptZldap_bcryptZldap_sha1_cryptZldap_sha256_cryptZldap_sha512_cryptZldap_pbkdf2_sha1Zldap_pbkdf2_sha256Zldap_pbkdf2_sha512ZlmhashZ	md5_cryptZmsdccZmsdcc2Z	mssql2000Z	mssql2005Zmysql323Zmysql41ZnthashZoracle10Zoracle11Zpbkdf2_sha1Z
pbkdf2_sha256Z
pbkdf2_sha512ZphpassZ	plaintextZpostgres_md5Zroundup_plaintextZscram�scryptZ
sha1_cryptZsha256_cryptZsha512_cryptZ
sun_md5_cryptZ
unix_disabledZ
unix_fallbackz^[a-z][a-z0-9_]+[a-z0-9]$)ZonloadZpolicy�context�all�defaultZnone�autocCst|std|f��|��|kr,td|f��t�|�sDtd|f��d|vrZtd|f��|tvrptd|f��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``).
    z handler name cannot be empty: %rzname must be lower-case: %rz`invalid name (must be 3+ characters,  begin with a-z, and contain only underscore, a-z, 0-9): %r�__z+name may not contain double-underscores: %rzthat name is not allowed: %rT)�
ValueError�lower�_name_re�match�_forbidden_names)�namerrr�_validate_handler_name�s	
��r;cCspt|�|�d�rtd��d|vrV|�d�dkr8td��|�d|�d��dkrVtd��|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;rr5�count�find�indexr&�log�debug)r:�pathrrrr�s
rFcCs�t|�st|dd��|s td��|j}t|�|rJ||krJtd||f��t�|�}|r�||urrt�	d||�dS|r�t�
d||�ntd||f��|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 Truez<handlers must be stored only under their own name (%r != %r)z&same %r handler already registered: %rNz/overriding previously registered %r handler: %rz2another %r handler has already been registered: %rzregistered %r handler: %r)rr�AssertionErrorr:r;r5�	_handlers�getrCrDZwarning�KeyError)r�forcerr:�otherrrrr
�s0�
��r
cCs$|�d�r&|tur"td|f��n|Sz
t|WStyBYn0|�dd���}||kr�td||ftdd�|}z
t|WSty�Yn0t�	|�}|�rd|vr�|�
d�\}}n
||}}t||gdd	�}t�	|�}|r�|St||�}t
||d
�|S|tu�rtd|f��n|Sd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: %r�-zThandler names should be lower-case, and use underscores instead of hyphens: %r => %r�)�
stacklevelr=r)�fromlist�levelrz(no crypt handler found for algorithm: %rN)r�_UNSETrIrG�replacer6rrr&rH�split�
__import__�getattrr
)r:r2ZaltrE�modnameZmodattr�modrrrrr*sH

��





rcCs(tt�}|s|�t�tdd�|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
    css|]}|�d�s|VqdS)rN)r��.0r:rrr�	<genexpr>��z&list_crypt_handlers.<locals>.<genexpr>)r!rGr$r&r')�loaded_only�namesrrrrus
rcCs|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
    �rGr&)r:r\rrr�_has_crypt_handler�sr_TcCs$|tvrt|=|r |tvr t|=dS)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:Z	locationsrrr�_unload_handler_name�sr`rcCs0t|�r|St|t�rt|�St�|t|��dS)z>
    internal helper to resolve argument to hasher object
    N)r�
isinstancer
rrr)�hasherZparamrrr�_resolve�s

rc�anyZbuiltinZos_cryptcCs�t|�}|tkrDt|d�sdSz|��WdStjyBYdS0t|d�rj|r`||jvr`dS|�|�S|tkrvdS|r~dSt�	||��dS)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)
rc�ANY�hasattrrerZMissingBackendErrorZbackendsrf�BUILTINZUnknownBackendError)rbZbackend�saferrrrf�s$


rfcCsFtsdStdd�tD��}|sBddl}td|��|��ftj�|S)zN
    return tuple of schemes which :func:`crypt.crypt` natively supports.
    rcss |]}t|��t�r|VqdSr )rrf�OS_CRYPTrXrrrrZs�z1get_supported_os_crypt_schemes.<locals>.<genexpr>rNzkcrypt.crypt() function is present, but doesn't support any formats known to passlib! (system=%r release=%r))	�os_crypt_present�tuple�os_crypt_schemes�platformr�system�releaserZPasslibRuntimeWarning)�cacherorrr�get_supported_os_crypt_schemess��rscCstot|tdd�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)rj)rlrfrk)rbrrr�has_os_crypt_supportsrt)FN)F)F)T)r)4r-�reZloggingZ	getLoggerr*rC�warningsrZpasslibrZpasslib.excrrZpasslib.ifcrZ
passlib.utilsrrrlr	rnZpasslib.utils.compatr
Zpasslib.utils.decorr�__all__rr�_proxyrQr%rG�dictr&�compiler7�	frozensetr9r;rr
rrr_r`rcrgrirkrfrsrtrrrr�<module>s�
)�S
*
5K




>


Youez - 2016 - github.com/yon3zu
LinuXploit