AnonSec Shell
Server IP : 85.193.89.191  /  Your IP : 3.149.254.10
Web Server : Apache
System : Linux 956367-cx40159.tmweb.ru 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64
User : bitrix ( 600)
PHP Version : 8.1.27
Disable Function : NONE
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python2.7/site-packages/passlib/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /lib/python2.7/site-packages/passlib//registry.pyc
�
�Xc�@s�dZddlZddlZeje�ZddlmZddlm	Z	ddl
mZmZddl
mZddlmZmZmZddlmZdd	lmZd
ddd
gZdefd��YZe�Ze�ZejZe ddddddddddddddddddd dd!dd"dd#dd$dd%d&d'd&d(d&d)d&d*d&d+d&d,d&d-d&d.d&d/dd0d1d2dd3d4d5d4d6d4d7d4d8d4d9d4d:d;d<d;d=d;d>d?d@d?dAd;dBd;dCd;dDd;dEd;dFd;dGd;dHd;dId;dJddKddLddMddNddOddPddQdRdSdRdTdUdVdUdWddXdYdZdYd[dd\dd]dd^d_d`dadbdcddd?dedfdgdhdidjdkdldmdldndodpdadqda�KZ!ej"dr�Z#e$dsdtdudvdwdxdyg�Z%dz�Z&d{�Z'e(dd|�Z*ed}�Z+e(d~�Z,e(d�Z-e.d��Z/d�d��Z0d�Z1d�Z2d�Z3e1e(d��Z4ed���Z5d��Z6dS(�s6passlib.registry - registry for password hash handlersi����N(twarn(texc(tExpectedTypeErrortPasslibWarning(tPasswordHash(tis_crypt_handlert	has_crypttunix_crypt_schemes(tunicode_or_str(tmemoize_single_valuetregister_crypt_handler_pathtregister_crypt_handlertget_crypt_handlertlist_crypt_handlerst_PasslibRegistryProxycBs>eZdZdZdZd�Zd�Zd�Zd�ZRS(s�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`.
    spasslib.hashcCsU|jd�r%td|f��nt|d�}|r>|Std|f��dS(Nt_smissing attribute: %rsunknown password hash: %r(t
startswithtAttributeErrorRtNone(tselftattrthandler((s4/usr/lib/python2.7/site-packages/passlib/registry.pyt__getattr__(scCs9|jd�r%tj|||�nt|d|�dS(NRt_attr(Rtobjectt__setattr__R(RRtvalue((s4/usr/lib/python2.7/site-packages/passlib/registry.pyR1scCsdS(Ns<proxy module 'passlib.hash'>((R((s4/usr/lib/python2.7/site-packages/passlib/registry.pyt__repr__;scCs<tt|j��}|j|j�|jt�t|�S(N(tsettdirt	__class__tupdatet__dict__t
_locationstsorted(Rtattrs((s4/usr/lib/python2.7/site-packages/passlib/registry.pyt__dir__>s
N(	t__name__t
__module__t__doc__Rt__package__RRRR$(((s4/usr/lib/python2.7/site-packages/passlib/registry.pyRs			
	t
apr_md5_cryptspasslib.handlers.md5_crypttargon2spasslib.handlers.argon2tatlassian_pbkdf2_sha1spasslib.handlers.pbkdf2tbcryptspasslib.handlers.bcryptt
bcrypt_sha256tbigcryptspasslib.handlers.des_cryptt
bsd_nthashspasslib.handlers.windowst
bsdi_cryptt	cisco_pixspasslib.handlers.ciscot	cisco_asatcisco_type7tcta_pbkdf2_sha1tcrypt16t	des_cryptt
django_argon2spasslib.handlers.djangot
django_bcrypttdjango_bcrypt_sha256tdjango_pbkdf2_sha256tdjango_pbkdf2_sha1tdjango_salted_sha1tdjango_salted_md5tdjango_des_crypttdjango_disabledtdlitz_pbkdf2_sha1tfshpspasslib.handlers.fshptgrub_pbkdf2_sha512thex_md4spasslib.handlers.digeststhex_md5thex_sha1t
hex_sha256t
hex_sha512thtdigesttldap_plaintextspasslib.handlers.ldap_digeststldap_md5t	ldap_sha1tldap_hex_md5spasslib.handlers.roundupt
ldap_hex_sha1tldap_salted_md5tldap_salted_sha1tldap_des_crypttldap_bsdi_crypttldap_md5_crypttldap_bcrypttldap_sha1_crypttldap_sha256_crypttldap_sha512_crypttldap_pbkdf2_sha1tldap_pbkdf2_sha256tldap_pbkdf2_sha512tlmhasht	md5_crypttmsdcctmsdcc2t	mssql2000spasslib.handlers.mssqlt	mssql2005tmysql323spasslib.handlers.mysqltmysql41tnthashtoracle10spasslib.handlers.oracletoracle11tpbkdf2_sha1t
pbkdf2_sha256t
pbkdf2_sha512tphpassspasslib.handlers.phpasst	plaintextspasslib.handlers.misctpostgres_md5spasslib.handlers.postgrestroundup_plaintexttscramspasslib.handlers.scramtscryptspasslib.handlers.scryptt
sha1_cryptspasslib.handlers.sha1_crypttsha256_cryptspasslib.handlers.sha2_crypttsha512_cryptt
sun_md5_cryptspasslib.handlers.sun_md5_cryptt
unix_disabledt
unix_fallbacks^[a-z][a-z0-9_]+[a-z0-9]$tonloadtpolicytcontexttalltdefaulttnonetautocCs�|std|f��n|j�|krDtd|f��ntj|�sitd|f��nd|kr�td|f��n|tkr�td|f��ntS(s�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``).
    s handler name cannot be empty: %rsname must be lower-case: %rs`invalid name (must be 3+ characters,  begin with a-z, and contain only underscore, a-z, 0-9): %rt__s+name may not contain double-underscores: %rsthat name is not allowed: %r(t
ValueErrortlowert_name_retmatcht_forbidden_namestTrue(tname((s4/usr/lib/python2.7/site-packages/passlib/registry.pyt_validate_handler_name�s	cCs�t|�|jd�r(td��nd|kr�|jd�dkrXtd��n|jd|jd��dkr�td��q�n|t|<tjd||�d	S(
svregister 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")
    t.spath cannot start with '.'t:is"path cannot have more than one ':'i����s$path cannot have '.' to right of ':'s!registered path to %r handler: %rN(	R�RR|tcounttfindtindexR!tlogtdebug(R�tpath((s4/usr/lib/python2.7/site-packages/passlib/registry.pyR
�s
!
cCst|�s!t|dd��n|s6td��n|j}t|�|rt||krttd||f��ntj|�}|r�||kr�tj	d||�dS|r�tj
d||�q�td||f��n|t|<tj	d	||�dS(
s@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.
    spassword hash handlerRs``bool(handler)`` must be Trues<handlers must be stored only under their own name (%r != %r)s&same %r handler already registered: %rNs/overriding previously registered %r handler: %rs2another %r handler has already been registered: %rsregistered %r handler: %r(RRtAssertionErrorR�R�R|t	_handlerstgetR�R�twarningtKeyError(RtforceRR�tother((s4/usr/lib/python2.7/site-packages/passlib/registry.pyR�s*	
	

cCs�|jd�r8|tkr1td|f��q8|Snyt|SWntk
rWnXt|t�sstd��|jdd�j�}||kr�t	d||ft
dd�|}yt|SWq�tk
r�q�Xntj|�}|r�d|kr|j
d�\}}n
||}}t|d	|gd
d�}tj|�}|ryt|�sutd||f��|St||�}t|d
|�|S|tkr�td|f��n|SdS(s'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).
    Rsinvalid handler name: %rsname must be string instancet-sThandler names should be lower-case, and use underscores instead of hyphens: %r => %rt
stackleveliR�tfromlisttlevelis$unexpected object: name=%r object=%rRs(no crypt handler found for algorithm: %rN(Rt_UNSETR�R�t
isinstanceRR�treplaceR}RRR!R�tsplitt
__import__RtgetattrR(R�RxtaltR�tmodnametmodattrtmodR((s4/usr/lib/python2.7/site-packages/passlib/registry.pyR(sF


"cCs6tt�}|s"|jt�ntd�|D��S(s�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$|]}|jd�s|VqdS(RN(R(t.0R�((s4/usr/lib/python2.7/site-packages/passlib/registry.pys	<genexpr>s(RR�RR!R"(tloaded_onlytnames((s4/usr/lib/python2.7/site-packages/passlib/registry.pyR
sscCs|tkp|o|tkS(sAcheck 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�((s4/usr/lib/python2.7/site-packages/passlib/registry.pyt_has_crypt_handler�scCs6|tkrt|=n|r2|tkr2t|=ndS(s�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)
    N(R�R!(R�t	locations((s4/usr/lib/python2.7/site-packages/passlib/registry.pyt_unload_handler_name�s
RcCsBt|�r|St|t�r)t|�Stj|t|��dS(s>
    internal helper to resolve argument to hasher object
    N(RR�RRRR(thashertparam((s4/usr/lib/python2.7/site-packages/passlib/registry.pyt_resolve�s

tanytbuiltintos_cryptcCs�t|�}|tkrXt|d�s+tSy|j�tSWqXtjk
rTtSXnt|d�r�|r�||jkr�dS|j
|�S|tkr�tS|r�dStj||��dS(s�
    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.
    tget_backendthas_backendN(
R�tANYthasattrR�R�RtMissingBackendErrortFalsetbackendsRR�tBUILTINtUnknownBackendError(R�tbackendtsafe((s4/usr/lib/python2.7/site-packages/passlib/registry.pyR��s$

cCs=ts
dStd�tD��}|s9tdtj�n|S(sN
    return tuple of schemes which :func:`crypt.crypt` natively supports.
    css*|] }t|�jt�r|VqdS(N(RR�tOS_CRYPT(R�R�((s4/usr/lib/python2.7/site-packages/passlib/registry.pys	<genexpr>ssTcrypt.crypt() function is present, but doesn't support any formats known to passlib!((tos_crypt_presentttupletos_crypt_schemesRRtPasslibRuntimeWarning(tcache((s4/usr/lib/python2.7/site-packages/passlib/registry.pytget_supported_os_crypt_schemes�s
cCstot|tdt�S(s
    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.
    R�(R�R�R�R�(R�((s4/usr/lib/python2.7/site-packages/passlib/registry.pythas_os_crypt_supports(7R'tretloggingt	getLoggerR%R�twarningsRtpasslibRtpasslib.excRRtpasslib.ifcRt
passlib.utilsRRR�RR�tpasslib.utils.compatRtpasslib.utils.decorR	t__all__RRt_proxyR�R R�tdictR!tcompileR~t	frozensetR�R�R
R�RRRR
R�R�R�R�R�R�R�R�R�R�(((s4/usr/lib/python2.7/site-packages/passlib/registry.pyt<module>s�	)						*5K

>

Anon7 - 2022
AnonSec Team