%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/paramiko/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/paramiko/__pycache__/util.cpython-312.pyc

�

�ecr!���dZddlmZddlZddlZddlZddlZddlZddlZddl	m
Z
mZmZm
Z
ddlmZmZmZmZmZddlmZdd�ZerendZere
ndZdd	�Zd d
�Zd�Zd�Zd
�Zd�Zd�Zd�Z d�Z!d�Z"d�Z#ejH�a%da&ejN�a(d�Z)e
fd�Z*Gd�de+�Z,e,�Z-d�Z.d�Z/d�Z0Gd�de+�Z1d�Z2y)!z0
Useful functions used by the rest of paramiko.
�)�
generatorsN)�DEBUG�	zero_byte�	xffffffff�max_byte)�PY2�long�byte_chr�byte_ord�b)�	SSHConfigc	��td�}d}|s!t|�dkDrt|d�dk\rd}t|�dzr%t}|rt}|dt|�dzz
z|z}tdt|�d�D]'}|dzt
jd|||dz�dz}�)|r|td�dt|�zzz}|S)zTturns a normalized byte string into a long-int
    (adapted from Crypto.Util.number)r���� �>I�)r	�lenrrr�range�struct�unpack)�s�always_positive�out�negative�filler�is      �//usr/lib/python3/dist-packages/paramiko/util.py�inflate_longr %s����q�'�C��H���A���
��!�A�$��4�1G���
�1�v��z�����F�
�a�#�a�&�1�*�n�%��)��
�1�c�!�f�a�
 �A���b�y�F�M�M�$��!�a�!�e��=�a�@�@��A���t�A�w�1�s�1�v�:�&�&���J��c���t�}t|�}|dk7r5|dk7r0tjd|tz�|z}|dz}|dk7r|dk7r�0t|�D])}|dk(r|dtk7rn*|dk(s�|dtk7s�)nd}|dk(rt}nt}||dd}|r>|dk(rt|d�dk\r	t|z}|dk(rt|d�dkr	t|z}|S)	zTturns a long-int into a normalized byte string
    (adapted from Crypto.Util.number)r���rrr)rNr)�bytesr	r�packr�	enumerate�deflate_zero�
deflate_ffrrr)�n�add_sign_paddingrrs    r�deflate_longr,>s���	��A��Q��A���6��R���K�K��a�)�m�,�q�0��	�b���
��6��R���q�\���
��F��1���-��
��G�!�A�$�*�,��	�
����6��A��A�	�!�A�$�&�	�A��
��F��!�A�$��4�/��A�
�A�
��G�(�1�Q�4�.�4�/��1��A��Hr!c� �d}g}t|�|dzkDr7|jt|||dz��|dz
}t|�|dzkDr�7|t|�kr|jt||d��|D�cgc]}||z��	c}Scc}w)Nr�)r�append�format_binary_line)�data�prefix�xr�lines     r�
format_binaryr5]s���	�A�
�C�

�d�)�a�"�f�
��
�
�%�d�1�q�2�v�&6�7�8�	�R����d�)�a�"�f�
�	�3�t�9�}��
�
�%�d�1�2�h�/�0�&)�*�d�F�T�M�*�*��*s�<Bc
�:�dj|D�cgc]}djt|����c}�}dj|D�cgc].}djt|��t|�dzdz��0c}�}dj||�Scc}wcc}w)N� z{:02X}�z.{:c}..�?�_z	{:50s} {})�join�formatr)r1�c�left�rights    rr0r0hs����8�8�4�@�a�X�_�_�X�a�[�1�@�A�D��G�G�JN�O�Q��	�	�(�1�+�	&����b�(8�R�'?�	@�O�
�E����d�E�*�*��	A��Os�!B�3Bc��d}|D]G}t|�}d|cxkrdkrnn|t|�z
}�+|tdj|��z
}�I|S)Nr!r�z%{:02X})rr
rr<)rrr=rs    r�safe_stringrBpsY��

�C�
�*���Q�K��
��>�c�>��8�A�;��C��1�Y�%�%�a�(�)�)�C�*��Jr!c���	|j�S#t$rIt|d�}t|d�}|dk(rYyt	|�dz}|dzs|dz}|dz}|dzs�|cYSwxYw)NFrrrr)�
bit_length�AttributeErrorr,rr)r*�norm�hbyte�bitlens    rrDrD{s|����|�|�~����	��A�u�%����a��!���A�:���T��Q����4�<��a�K�E��a�K�F��4�<��
�	�s��(A$�"A$�A$�#A$c��djtjtj���jd�S)Nr8�
)r;�	traceback�format_exception�sys�exc_info�split�r!r�
tb_stringsrQ�s-��
�7�7�9�-�-�s�|�|�~�>�?�E�E�d�K�Kr!c�p�t�}t�}t|�dkDr|dd}|dkDr�|�}t|�dkDr|j|�|jt|��|j|�|j	�}t|t|��}||d|z
}||z}|dkDr��|S)a
    Given a password, passphrase, or other human-source key, scramble it
    through a secure hash into some keyworthy bytes.  This specific algorithm
    is used for encrypting/decrypting private key files.

    :param function hash_alg: A function which creates a new hash object, such
        as ``hashlib.sha256``.
    :param salt: data to salt the hash with.
    :type salt: byte string
    :param str key: human-entered password or passphrase.
    :param int nbytes: number of bytes to generate.
    :return: Key data `str`
    rNr)r%r�updater�digest�min)�hash_alg�salt�key�nbytes�keydatarT�hash_obj�sizes        r�generate_key_bytesr]�s����g�G�
�W�F�
�4�y�1�}��B�Q�x��
�1�*��:���v�;��?��O�O�F�#�����#�����������"���6�3�v�;�'���6�%�4�=� ���$����1�*��Nr!c��ddlm}||�S)a�
    Read a file of known SSH host keys, in the format used by openssh, and
    return a compound dict of ``hostname -> keytype ->`` `PKey
    <paramiko.pkey.PKey>`. The hostname may be an IP address or DNS name.  The
    keytype will be either ``"ssh-rsa"`` or ``"ssh-dss"``.

    This type of file unfortunately doesn't exist on Windows, but on posix,
    it will usually be stored in ``os.path.expanduser("~/.ssh/known_hosts")``.

    Since 1.5.3, this is just a wrapper around `.HostKeys`.

    :param str filename: name of the file to read host keys from
    :return:
        nested dict of `.PKey` objects, indexed by hostname and then keytype
    r)�HostKeys)�paramiko.hostkeysr_)�filenamer_s  r�load_host_keysrb�s�� +��H��r!c�<�t�}|j|�|S)z�
    Provided only as a backward-compatible wrapper around `.SSHConfig`.

    .. deprecated:: 2.7
        Use `SSHConfig.from_file` instead.
    )r
�parse)�file_obj�configs  r�parse_ssh_configrg�s���[�F�
�L�L����Mr!c�$�|j|�S)zM
    Provided only as a backward-compatible wrapper around `.SSHConfig`.
    )�lookup)�hostnamerfs  r�lookup_ssh_host_configrk�s���=�=��"�"r!c��dd|}}}dd|}}}|dkDr)||z}||||zz
}}||||zz
}}||||zz
}}|dkDr�)|dkr||z
}|S)NrrrP)	r3�m�u1�u2�u3�v1�v2�v3�qs	         r�mod_inverseru�s���A�q�B��B��A�q�B��B�
�q�&��"�H���R�"�q�&�[�B���R�"�q�&�[�B���R�"�q�&�[�B��	
�q�&�

�A�v�
�a���
�Ir!c���	tjS#t$rGt5tdz
att_ddd�n#1swYnxYwtjcYSwxYw)Nr)�_g_thread_data�idrE�_g_thread_lock�_g_thread_counterrPr!r�
get_thread_idr{�s[��!�� � � ���!�
�	2���"�� 1�N��	2�	2�	2��� � � �	!�s%��A"�A�	A"�A	�A"�!A"c�>�tjd�}t|j�dkDry|j	|�t|d�}tj|�}d}|dz
}|jtj|d��|j|�y)zKsend paramiko logs to a logfile,
    if they're not already going somewhere�paramikorN�az>%(levelname)-.3s [%(asctime)s.%(msecs)03d] thr=%(_threadid)-3dz %(name)s: %(message)sz%Y%m%d-%H:%M:%S)
�logging�	getLoggerr�handlers�setLevel�open�
StreamHandler�setFormatter�	Formatter�
addHandler)ra�level�logger�f�handler�frms      r�log_to_filer��s����
�
�z�
*�F�
�6�?�?��a���
�O�O�E���X�s��A��#�#�A�&�G�
J�C��#�#�C�����*�*�3�0A�B�C�
���g�r!c��eZdZd�Zy)�PFilterc�"�t�|_y)NT)r{�	_threadid)�self�records  r�filterzPFilter.filters��(�?���r!N)�__name__�
__module__�__qualname__r�rPr!rr�r�s��r!r�c�Z�tj|�}|jt�|S�N)rr��	addFilter�_pfilter)�namer�s  r�
get_loggerr�
s%��
�
�
�t�
$�F�
���X���Mr!c�~�		|�S#t$r(}|jtjk7r�Yd}~nd}~wwxYw�=)z6Retries function until it doesn't raise an EINTR errorN)�EnvironmentError�errno�EINTR)�function�es  r�retry_on_signalr�s?��
�	��:����	��w�w�%�+�+�%��&��	��s�
�	;�6�;c���t|�t|�k7ryd}trtntt|��D]"}|t	||�t	||�zz}�$|dk(S)NFr)rr�xrangerr)r~r�resrs    r�constant_time_bytes_eqr�s^��
�1�v��Q����
�C��f���A��
/�/���x��!��~���1���.�.��/��!�8�Or!c��eZdZd�Zd�Zy)�ClosingContextManagerc��|Sr�rP)r�s r�	__enter__zClosingContextManager.__enter__(s���r!c�$�|j�yr�)�close)r��type�valuerKs    r�__exit__zClosingContextManager.__exit__+s���
�
�r!N)r�r�r�r�r�rPr!rr�r�'s���r!r�c�.�t|t||��Sr�)�maxrU)�minimum�val�maximums   r�clamp_valuer�/s���w��C��)�*�*r!)F)T)r8)3�__doc__�
__future__rr�rMrrK�	threadingr�paramiko.commonrrrr�paramiko.py3compatrr	r
rr�paramiko.configr
r r(r)r,r5r0rBrDrQr]rbrgrkru�localrwrz�Lockryr{r��objectr�r�r�r�r�r�r�rPr!r�<module>r�s���&�"��
�
����A�A�?�?�%��* �y�Q���X�$�
�
�>+�+���L��>�*	�#��!����"��������!��!�!&�� �f���9������F��+r!

Zerion Mini Shell 1.0