%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/
Upload File :
Create Path :
Current File : //opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/util.pyc

�
��Abc@s�dZddlmZddlZddlZddlZddlZddlZddlZddl	m
Z
mZmZm
Z
ddlmZmZmZmZmZddlmZed�Zer�endZer�e
nd	Zed
�Zdd�Zd
�Zd�Zd�Zd�Z d�Z!d�Z"d�Z#d�Z$d�Z%ej&�a'da(ej)�a*d�Z+e
d�Z,de-fd��YZ.e.�Z/d�Z0d�Z1d�Z2de-fd��YZ3d�Z4dS( s0
Useful functions used by the rest of paramiko.
i����(t
generatorsN(tDEBUGt	zero_bytet	xfffffffftmax_byte(tPY2tlongtbyte_chrtbyte_ordtb(t	SSHConfigcCstd�}d}|rJt|�dkrJt|d�dkrJd}nt|�dr�t}|rot}n|dt|�d|}nxItdt|�d�D]/}|d>tjd|||d!�d}q�W|r|td�dt|�>8}n|S(sTturns a normalized byte string into a long-int
    (adapted from Crypto.Util.number)ii�iii s>Ii(RtlenRRRtrangetstructtunpack(tstalways_positivetouttnegativetfillerti((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/util.pytinflate_long%s/		-!ii�cCsIt�}t|�}x@|dkrW|dkrWtjd|t@�|}|dL}qWxut|�D]F}|dkr�|dtkr�Pn|dkre|dtkrePqeqeWd}|dkr�t}nt	}||d}|rE|dkrt
|d�dkrt|}n|dkrEt
|d�dkrEt	|}qEn|S(sTturns a long-int into a normalized byte string
    (adapted from Crypto.Util.number)ii����s>Ii ii�(i(tbytesRR
tpackRt	enumeratetdeflate_zerot
deflate_ffRRR(tntadd_sign_paddingRR((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/util.pytdeflate_long>s*		"
"tcCs�d}g}xBt|�|dkrP|jt|||d!��|d7}qW|t|�kr}|jt||��ng|D]}||^q�S(Nii(Rtappendtformat_binary_line(tdatatprefixtxRtline((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/util.pyt
format_binary]scCs�djg|D]}djt|��^q
�}djg|D]-}djt|��t|�dd^q>�}dj||�S(Nt s{:02X}Rs.{:c}..i?i_s	{:50s} {}(tjointformatR(R!tctlefttright((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/util.pyR hs1=cCsod}xb|D]Z}t|�}d|ko6dknrN|t|�7}q
|tdj|��7}q
W|S(NRi is%{:02X}(RRR	R((RRR)R((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/util.pytsafe_stringps
cCs�y|j�SWnvtk
r�t|t�}t|d�}|dkrMdSt|�d}x"|d@s�|dK}|d8}q`W|SXdS(Niiii�(t
bit_lengthtAttributeErrorRtFalseRR(Rtnormthbytetbitlen((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/util.pyR-{s


cCs%djtjtj���jd�S(NRs
(R't	tracebacktformat_exceptiontsystexc_infotsplit(((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/util.pyt
tb_strings�scCs�t�}t�}t|�dkr1|d }nx�|dkr�|�}t|�dkrk|j|�n|jt|��|j|�|j�}t|t|��}||| 7}||8}q4W|S(s
    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`
    ii(RRtupdateR	tdigesttmin(thash_algtsalttkeytnbytestkeydataR:thash_objtsize((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/util.pytgenerate_key_bytes�s		
	
cCsddlm}||�S(s�
    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
    i����(tHostKeys(tparamiko.hostkeysRD(tfilenameRD((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/util.pytload_host_keys�scCst�}|j|�|S(s�
    Provided only as a backward-compatible wrapper around `.SSHConfig`.

    .. deprecated:: 2.7
        Use `SSHConfig.from_file` instead.
    (R
tparse(tfile_objtconfig((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/util.pytparse_ssh_config�s	
cCs
|j|�S(sM
    Provided only as a backward-compatible wrapper around `.SSHConfig`.
    (tlookup(thostnameRJ((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/util.pytlookup_ssh_host_config�sc	Cs�dd|}}}dd|}}}xY|dkr�||}||||}}||||}}||||}}q+W|dkr�||7}n|S(Nii((	R#tmtu1tu2tu3tv1tv2tv3tq((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/util.pytmod_inverse�s

cCsGytjSWn5tk
rBt�td7att_WdQXtjSXdS(Ni(t_g_thread_datatidR.t_g_thread_lockt_g_thread_counter(((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/util.pyt
get_thread_id�s

cCs�tjd�}t|j�dkr(dS|j|�t|d�}tj|�}d}|d7}|jtj|d��|j	|�dS(sKsend paramiko logs to a logfile,
    if they're not already going somewheretparamikoiNtas>%(levelname)-.3s [%(asctime)s.%(msecs)03d] thr=%(_threadid)-3ds %(name)s: %(message)ss%Y%m%d-%H:%M:%S(
tloggingt	getLoggerRthandlerstsetLeveltopent
StreamHandlertsetFormattert	Formattert
addHandler(RFtleveltloggertfthandlertfrm((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/util.pytlog_to_file�s

tPFiltercBseZd�ZRS(cCst�|_tS(N(R\t	_threadidtTrue(tselftrecord((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/util.pytfilters(t__name__t
__module__Rs(((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/util.pyRnscCs tj|�}|jt�|S(N(R_R`t	addFiltert_pfilter(tnameRi((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/util.pyt
get_logger
s
cCsJxCtrEy|�SWqtk
rA}|jtjkrB�qBqXqWdS(s6Retries function until it doesn't raise an EINTR errorN(RptEnvironmentErrorterrnotEINTR(tfunctionte((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/util.pytretry_on_signals	cCswt|�t|�krtSd}xHtr1tntt|��D](}|t||�t||�AO}qAW|dkS(Ni(RR/RtxrangeRR(R^R	tresR((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/util.pytconstant_time_bytes_eqs%&tClosingContextManagercBseZd�Zd�ZRS(cCs|S(N((Rq((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/util.pyt	__enter__(scCs|j�dS(N(tclose(RqttypetvalueR3((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/util.pyt__exit__+s(RtRuR�R�(((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/util.pyR�'s	cCst|t||��S(N(tmaxR;(tminimumtvaltmaximum((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/util.pytclamp_value/s(5t__doc__t
__future__RR{R5R
R3t	threadingR_tparamiko.commonRRRRtparamiko.py3compatRRRRR	tparamiko.configR
R/RRRRpRR%R R,R-R8RCRGRKRNRWtlocalRXR[tLockRZR\RmtobjectRnRwRyRR�R�R�(((sB/opt/plesk/python/2.7/lib/python2.7/site-packages/paramiko/util.pyt<module>sH"(													
	


Zerion Mini Shell 1.0