ok

Mini Shell

Direktori : /opt/alt/python35/lib64/python3.5/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/__pycache__/telnetlib.cpython-35.opt-2.pyc



���]�Y�@s�ddlZddlZddlZddlmZdgZdZdZe	dg�Z
e	dg�Ze	dg�Ze	dg�Z
e	d	g�Ze	dg�Ze	d
g�Ze	dg�Ze	dg�Ze	d
g�Ze	dg�Ze	dg�Ze	dg�Ze	dg�Ze	dg�Ze	dg�Ze	dg�Ze	dg�Ze	dg�Ze	dg�Ze	dg�Ze	dg�Ze	dg�Z e	dg�Z!e	dg�Z"e	dg�Z#e	dg�Z$e	dg�Z%e	dg�Z&e	d g�Z'e	d!g�Z(e	d"g�Z)e	d#g�Z*e	d$g�Z+e	d%g�Z,e	d&g�Z-e	d'g�Z.e	d(g�Z/e	d)g�Z0e	d*g�Z1e	dg�Z2e	d+g�Z3e	d,g�Z4e	d-g�Z5e	d.g�Z6e	d/g�Z7e	d0g�Z8e	d1g�Z9e	d2g�Z:e	d3g�Z;e	d4g�Z<e	d5g�Z=e	d6g�Z>e	d7g�Z?e	d8g�Z@e	d9g�ZAe	d:g�ZBe	d;g�ZCe	d<g�ZDe	d=g�ZEe	d>g�ZFe	d?g�ZGe	d@g�ZHe	dAg�ZIe	dBg�ZJe	dCg�ZKe	dDg�ZLe	dEg�ZMe	dFg�ZNe	dGg�ZOe	dg�ZPe	dg�ZQeRedH�r�ejSZTn	ejUZTGdId�d�ZVdJdK�ZWeXdLkr�eW�dS)M�N)�	monotonic�Telnet�������������������������������	�
���
������������������ �!�"�#�$�%�&�'�(�)�*�+�,�-�.�/�0�1����PollSelectorc@sceZdZddejdd�Zdejdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
ddd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zdd5d6�ZdS)7rNrcCs�t|_||_||_||_d|_d|_d|_d|_d|_	d|_
d|_d|_d|_
|dk	r�|j|||�dS)N�r)�
DEBUGLEVEL�
debuglevel�host�port�timeout�sock�rawq�irawq�cookedq�eof�iacseq�sb�sbdataq�option_callback�open)�selfrLrMrN�rZ�./opt/alt/python35/lib64/python3.5/telnetlib.py�__init__�s													zTelnet.__init__cCsOd|_|st}||_||_||_tj||f|�|_dS)Nr)rS�TELNET_PORTrLrMrN�socket�create_connectionrO)rYrLrMrNrZrZr[rX�s				zTelnet.opencCs|j�dS)N)�close)rYrZrZr[�__del__�szTelnet.__del__cGsT|jdkrPtd|j|jfdd�|rFt||�n
t|�dS)NrzTelnet(%s,%s):�end� )rK�printrLrM)rY�msg�argsrZrZr[re�s
 z
Telnet.msgcCs
||_dS)N)rK)rYrKrZrZr[�set_debuglevel�szTelnet.set_debuglevelcCsA|j}d|_d|_d|_d|_|r=|j�dS)NTrIr)rOrSrTrUr`)rYrOrZrZr[r`s					zTelnet.closecCs|jS)N)rO)rYrZrZr[�
get_socketszTelnet.get_socketcCs
|jj�S)N)rO�fileno)rYrZrZr[risz
Telnet.filenocCsFt|kr"|jttt�}|jd|�|jj|�dS)Nzsend %r)�IAC�replacererO�sendall)rY�bufferrZrZr[�writeszTelnet.writecCs�t|�}|j�|jj|�}|dkrk||}|jd|�}|j|d�|_|S|dk	r�t�|}t���}|j|tj�x�|j	so|j
|�rFtdt|j�|�}|j�|j�|jj||�}|dkrF||}|jd|�}|j|d�|_|S|dk	r�|t�}|dkr�Pq�WWdQRX|j
�S)Nr)�len�process_rawqrR�find�_time�_TelnetSelector�register�	selectors�
EVENT_READrS�select�max�	fill_rawq�read_very_lazy)rY�matchrN�n�i�buf�deadline�selectorrZrZr[�
read_until$s8






zTelnet.read_untilcCsD|j�x!|js-|j�|j�q
W|j}d|_|S)NrI)rprSryrR)rYr~rZrZr[�read_allIs

		zTelnet.read_allcCsO|j�x,|jr8|jr8|j�|j�q
W|j}d|_|S)NrI)rprRrSry)rYr~rZrZr[�	read_someSs

		zTelnet.read_somecCsE|j�x.|jr:|j�r:|j�|j�q
W|j�S)N)rprS�
sock_availryrz)rYrZrZr[�read_very_eagerbs


zTelnet.read_very_eagercCsO|j�x8|jrD|jrD|j�rD|j�|j�q
W|j�S)N)rprRrSr�ryrz)rYrZrZr[�
read_eagerps

#
zTelnet.read_eagercCs|j�|j�S)N)rprz)rYrZrZr[�	read_lazy~s
zTelnet.read_lazycCs<|j}d|_|r8|jr8|jr8td��|S)NrIztelnet connection closed)rRrSrP�EOFError)rYr~rZrZr[rz�s
		zTelnet.read_very_lazycCs|j}d|_|S)NrI)rV)rYr~rZrZr[�read_sb_data�s		zTelnet.read_sb_datacCs
||_dS)N)rW)rY�callbackrZrZr[�set_option_negotiation_callback�sz&Telnet.set_option_negotiation_callbackcCs	ddg}y�x�|jr�|j�}|js�|tkr?q|dkrNq|tkrx||j|||j<qq�|j|7_qt|j�dkr�|ttt	t
fkr�|j|7_qd|_|tkr�||j|||j<q�|tkrd|_d|_n3|t
krMd|_|j|d|_d|d<|jro|j|j|t�q�|jdt|��qt|j�dkr|jdd�}d|_|}|ttfkr:|jd|tkr�dp�d	t|��|jr|j|j||�q�|jjtt
|�q|t	t
fkr|jd|t	krgd
pjdt|��|jr�|j|j||�q|jjtt|�qWWn$tk
r�d|_d|_YnX|j|d|_|j|d|_dS)NrIsrrzIAC %d not recognizedrz	IAC %s %d�DO�DONT�WILL�WONT)rP�rawq_getcharrT�theNULLrjrUror�r�r�r��SBrV�SErWrO�NOOPTre�ordrlr�rR)rYr~�c�cmd�optrZrZr[rp�sh				
			"		"	 
		zTelnet.process_rawqcCs}|js"|j�|jr"t�|j|j|jd�}|jd|_|jt|j�kryd|_d|_|S)NrrIr)rPryrSr�rQro)rYr�rZrZr[r��s	
			zTelnet.rawq_getcharcCsj|jt|j�kr*d|_d|_|jjd�}|jd|�||_|j||_dS)NrIr�2zrecv %r)rQrorPrO�recvrerS)rYr~rZrZr[rys		
zTelnet.fill_rawqc
Cs=t��-}|j|tj�t|jd��SWdQRXdS)Nr)rsrtrurv�boolrw)rYr�rZrZr[r�szTelnet.sock_availcCs3tjdkr|j�dSt��}|j|tj�|jtjtj�x�x�|j�D]�\}}|j	|kr�y|j
�}Wn tk
r�td�dSYnX|r tj
j|jd��tj
j�qb|j	tjkrbtjj�jd�}|sdS|j|�qbWqUWWdQRXdS)N�win32z(*** Connection closed by remote host ***�ascii)�sys�platform�mt_interactrsrtrurv�stdinrw�fileobjr�r�rd�stdoutrn�decode�flush�readline�encode)rYr��key�events�text�linerZrZr[�interacts,


	zTelnet.interactcCsVddl}|j|jf�x0tjj�}|s8P|j|jd��q"WdS)Nrr�)�_thread�start_new_thread�listenerr�r�r�rnr�)rYr�r�rZrZr[r�1szTelnet.mt_interactcCsmxfy|j�}Wn tk
r5td�dSYnX|rXtjj|jd��qtjj�qWdS)Nz(*** Connection closed by remote host ***r�)r�r�rdr�r�rnr�r�)rY�datarZrZr[r�;s

	zTelnet.listenercCs�d}|dd�}tt|��}xJ|D]B}t||d�s/|sZddl}|j||�||<q/W|dk	r�t�|}t���}|j|tj	�x�|j
s�|j�xl|D]d}||j|j
�}|r�|j�}	|j
d|	�}
|j
|	d�|_
|||
fSq�W|dk	rs|j|�}|t�}|ss|dkr�Pnq�|j�q�WWdQRX|j�}
|
r�|j
r�t�dd|
fS)N�searchrr���)�rangero�hasattr�re�compilerrrsrtrurvrSrpr�rRrbrwryrzr�)rY�listrNr��indicesr}rr��m�er��readyrZrZr[�expectHsB




z
Telnet.expect)�__name__�
__module__�__qualname__r^�_GLOBAL_DEFAULT_TIMEOUTr\rXrarergr`rhrirnr�r�r�r�r�r�rzr�r�rpr�ryr�r�r�r�r�rZrZrZr[r�s67
%

H

c
Csd}x>tjdd�rFtjddkrF|d}tjd=q	Wd}tjdd�rmtjd}d}tjdd�r�tjd}yt|�}Wn$tk
r�tj|d�}YnXt�}|j|�|j||dd�|j	�|j
�dS)	Nrrz-d�	localhostrZtcprNg�?)r��argv�int�
ValueErrorr^�
getservbynamerrgrXr�r`)rKrLrMZportstr�tnrZrZr[�test�s&)



	

r��__main__)Yr�r^ru�timerrr�__all__rJr]�bytesrjr�r�r�r�r�r�ZNOPZDMZBRKZIPZAOZAYTZECZELZGAr�ZBINARYZECHOZRCPZSGAZNAMSZSTATUSZTMZRCTEZNAOLZNAOPZNAOCRDZNAOHTSZNAOHTDZNAOFFDZNAOVTSZNAOVTDZNAOLFDZXASCIIZLOGOUTZBMZDETZSUPDUPZSUPDUPOUTPUTZSNDLOCZTTYPEZEORZTUIDZOUTMRKZTTYLOCZVT3270REGIMEZX3PADZNAWSZTSPEEDZLFLOWZLINEMODEZXDISPLOCZOLD_ENVIRONZAUTHENTICATIONZENCRYPTZNEW_ENVIRONZTN3270EZXAUTH�CHARSETZRSPZCOM_PORT_OPTIONZSUPPRESS_LOCAL_ECHOZTLSZKERMITZSEND_URLZ	FORWARD_XZPRAGMA_LOGONZ
SSPI_LOGONZPRAGMA_HEARTBEATZEXOPLr�r�rHrs�SelectSelectorrr�r�rZrZrZr[�<module>$s�		��

Zerion Mini Shell 1.0