Server : LiteSpeed
System : Linux server51.dnsbootclub.com 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
User : nandedex ( 1060)
PHP Version : 8.1.33
Disable Function : NONE
Directory :  /opt/cppython/lib/python3.8/site-packages/paramiko/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]


Current File : //opt/cppython/lib/python3.8/site-packages/paramiko/__pycache__/util.cpython-38.pyc
U

P��gN%�@s@dZddlZddlZddlZddlZddlZddlmZmZm	Z	m
Z
mZmZddl
mZd5dd�Zd6d	d
�Zd7dd
�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Ze��adae��ad d!�Z efd"d#�Z!Gd$d%�d%�Z"e"�Z#d&d'�Z$d(d)�Z%Gd*d+�d+�Z&d,d-�Z'd.d/�Z(d8d1d2�Z)d9d3d4�Z*dS):z0
Useful functions used by the rest of paramiko.
�N)�DEBUG�	zero_byte�	xffffffff�max_byte�byte_ord�byte_chr)�	SSHConfigFc	Cs�d}d}|s,t|�dkr,t|d�dkr,d}t|�dr\t}|rDt}|dt|�d|}tdt|�d�D](}|d>t�d|||d��d}ql|r�|ddt|�>8}|S)zTturns a normalized byte string into a long-int
    (adapted from Crypto.Util.number)r���� �>I�)�lenrrr�range�struct�unpack)�sZalways_positive�out�negativeZfiller�i�r�:/opt/cppython/lib/python3.8/site-packages/paramiko/util.py�inflate_long)s &rTcCs�t�}t|�}|dkr<|dkr<t�d|t@�|}|dL}qt|�D]4}|dkr`|ddkr`q�|dkrD|ddkrDq�qDd}|dkr�t}nt}||dd�}|r�|dkr�t|d�d	kr�t|}|dkr�t|d�d	kr�t|}|S)
zTturns a long-int into a normalized byte string
    (adapted from Crypto.Util.number)r���r
rr
�)rNr	)	�bytes�intr�packr�	enumeraterrr)�nZadd_sign_paddingrrrrr�deflate_long>s*
r!�cspd}g}t|�|dkr<|�t|||d���|d7}q|t|�kr^|�t||d����fdd�|D�S)Nr�csg|]}�|�qSrr)�.0�line��prefixrr�
<listcomp>esz!format_binary.<locals>.<listcomp>)r�append�format_binary_line)�datar'�xrrr&r�
format_binary]s
r-cCs4d�dd�|D��}d�dd�|D��}d�||�S)N� cSsg|]}d�t|���qS)z{:02X}��formatr�r$�crrrr(isz&format_binary_line.<locals>.<listcomp>r"cSs*g|]"}d�t|��t|�dd�qS)z.{:c}..�?�_r/r1rrrr(ksz	{:50s} {})�joinr0)r+�left�rightrrrr*hs
�r*cCsRd}|D]D}t|�}d|kr(dkr:nn|t|�7}q|td�|��7}q|S)N�r�z%{:02X})rr�br0)rrr2rrrr�safe_stringpsr;cCsrz
|��WStk
rlt|d�}t|d�}|dkr>YdSt|�d}|d@sd|dK}|d8}qJ|YSXdS)NFrr
rr	)�
bit_length�AttributeErrorr!rr)r ZnormZhbyteZbitlenrrrr<{s


r<cCsd�tjt�����d�S)Nr"�
)r5�	traceback�format_exception�sys�exc_info�splitrrrr�
tb_strings�srDcCs�t�}t�}t|�dkr$|dd�}|dkr�|�}t|�dkrH|�|�|�t|��|�|�|��}t|t|��}||d|�7}||8}q$|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 bytes salt: Hash salt bytes.
    :param str key: human-entered password or passphrase.
    :param int nbytes: number of bytes to generate.
    :return: Key data, as `bytes`.
    rNr)rr�updater:�digest�min)Zhash_alg�salt�key�nbytesZkeydatarFZhash_obj�sizerrr�generate_key_bytes�s


rLcCsddlm}||�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)Zparamiko.hostkeysrM)�filenamerMrrr�load_host_keys�srOcCst�}|�|�|S)z�
    Provided only as a backward-compatible wrapper around `.SSHConfig`.

    .. deprecated:: 2.7
        Use `SSHConfig.from_file` instead.
    )r�parse)Zfile_obj�configrrr�parse_ssh_config�s
rRcCs
|�|�S)zM
    Provided only as a backward-compatible wrapper around `.SSHConfig`.
    )�lookup)�hostnamerQrrr�lookup_ssh_host_config�srUc	Cs|dd|}}}dd|}}}|dkrh||}||||}}||||}}||||}}q |dkrx||7}|S)Nr
rr)	r,�m�u1�u2�u3Zv1Zv2Zv3�qrrr�mod_inverse�sr[cCsFztjWStk
r@t�td7att_W5QRXtjYSXdS)Nr
)�_g_thread_data�idr=�_g_thread_lock�_g_thread_counterrrrr�
get_thread_id�sr`cCsft�d�}t|j�dkrdS|�|�t|d�}t�|�}d}|d7}|�t�|d��|�	|�dS)zKsend paramiko logs to a logfile,
    if they're not already going somewhereZparamikorN�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)rN�level�logger�f�handlerZfrmrrr�log_to_file�s



roc@seZdZdd�ZdS)�PFiltercCst�|_dS)NT)r`Z	_threadid)�self�recordrrr�filterszPFilter.filterN)�__name__�
__module__�__qualname__rsrrrrrpsrpcCst�|�}|�t�|S�N)rbrc�	addFilter�_pfilter)�namerlrrr�
get_logger
s

r{cCsNt|�t|�krdSd}tt|��D] }|t||�t||�AO}q$|dkS)NFr)rrr)rar:�resrrrr�constant_time_bytes_eqsr}c@seZdZdd�Zdd�ZdS)�ClosingContextManagercCs|Srwr)rqrrr�	__enter__szClosingContextManager.__enter__cCs|��dSrw)�close)rq�type�valuer?rrr�__exit__!szClosingContextManager.__exit__N)rtrurvrr�rrrrr~sr~cCst|t||��Srw)�maxrG)�minimum�val�maximumrrr�clamp_value%sr�cCsPz
t|�WStk
rJz|��WYStk
rD|YYSXYnXdS)z:
    Coerce to bytes if possible or return unchanged.
    N)r:�	TypeError�asbytesr=)rrrrr�)s
r��utf8cCs8t|t�r|St|t�r"|�|�Stdt|�����dS)zcast unicode or bytes to bytes�Expected unicode or bytes, got N)�
isinstancer�str�encoder�r��r�encodingrrrr:?s



r:cCs8t|t�r|�|�St|t�r"|Stdt|�����dS)z cast bytes or unicode to unicoder�N)r�r�decoder�r�r�r�rrr�uJs



r�)F)T)r")r�)r�)+�__doc__rArr?�	threadingrbZparamiko.commonrrrrrrZparamiko.configrrr!r-r*r;r<rDrLrOrRrUr[�localr\r_�Lockr^r`rorpryr{r}r~r�r�r:r�rrrr�<module>sB 






F1le Man4ger