Your IP : 18.221.157.203


Current Path : /opt/alt/python310/lib64/python3.10/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/__pycache__/telnetlib.cpython-310.opt-2.pyc

o

6��f�Z�@sL	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�ejSZTnejUZTGdId�d�ZVdJdK�ZWeXdLk�r�eW�dSdS)M�N)�	monotonic�Telnet�������������������������������	�
���
������������������ �!�"�#�$�%�&�'�(�)�*�+�,�-�.�/�0�1����PollSelectorc@seZdZ	ddejfdd�Zdejfdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
d;dd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd;d5d6�Zd7d8�Zd9d:�Z dS)<rNrcCsn	t|_||_||_||_d|_d|_d|_d|_d|_	d|_
d|_d|_d|_
|dur5|�|||�dSdS)N�r)�
DEBUGLEVEL�
debuglevel�host�port�timeout�sock�rawq�irawq�cookedq�eof�iacseq�sb�sbdataq�option_callback�open��selfrLrMrN�r[�0/opt/alt/python310/lib64/python3.10/telnetlib.py�__init__�s"�zTelnet.__init__cCsH	d|_|st}||_||_||_t�d|||�t�||f|�|_	dS)Nrztelnetlib.Telnet.open)
rS�TELNET_PORTrLrMrN�sys�audit�socketZcreate_connectionrOrYr[r[r\rX�szTelnet.opencCs	|��dS�N��close�rZr[r[r\�__del__�szTelnet.__del__cGsH	|jdkr"td|j|jfdd�|rt||�dSt|�dSdS)NrzTelnet(%s,%s):� )�end)rK�printrLrM)rZ�msg�argsr[r[r\rj�s
�z
Telnet.msgcC�	||_dSrb)rK)rZrKr[r[r\�set_debuglevel�s
zTelnet.set_debuglevelcCs4	|j}d|_d|_d|_d|_|r|��dSdS)NTrIr)rOrSrTrUrd)rZrOr[r[r\rds�zTelnet.closecCs	|jSrb)rOrer[r[r\�
get_socketszTelnet.get_socketcCs	|j��Srb)rO�filenorer[r[r\ro�
z
Telnet.filenocCsD	t|vr
|�ttt�}t�d||�|�d|�|j�|�dS)Nztelnetlib.Telnet.writezsend %r)�IAC�replacer_r`rjrO�sendall)rZ�bufferr[r[r\�writeszTelnet.writecCsp	t|�}|��|j�|�}|dkr(||}|jd|�}|j|d�|_|S|dur1t�|}t��x}|�|tj�|j	s�|�
|�r}tdt|j�|�}|��|��|j�||�}|dkr}||}|jd|�}|j|d�|_|Wd�S|dur�|t�}|dkr�n|j	r?Wd�|�
�SWd�|�
�SWd�|�
�S1s�wY|�
�S�Nr)�len�process_rawqrR�find�_time�_TelnetSelector�register�	selectors�
EVENT_READrS�select�max�	fill_rawq�read_very_lazy)rZ�matchrN�n�i�buf�deadline�selectorr[r[r\�
read_until&sP

�
�
��
��
��zTelnet.read_untilcCs6	|��|js|��|��|jr|j}d|_|S�NrI)rxrSr�rR�rZr�r[r[r\�read_allKs�zTelnet.read_allcCsB	|��|js|js|��|��|js|jr|j}d|_|Sr�)rxrRrSr�r�r[r[r\�	read_someUs�zTelnet.read_somecCs>	|��|js|��r|��|��|js|��s|��Srb)rxrS�
sock_availr�r�rer[r[r\�read_very_eagerds�zTelnet.read_very_eagercCsJ	|��|js!|js!|��r!|��|��|js!|js!|��s|��Srb)rxrRrSr�r�r�rer[r[r\�
read_eagerrs�zTelnet.read_eagercCs	|��|��Srb)rxr�rer[r[r\�	read_lazy�szTelnet.read_lazycCs*	|j}d|_|s|jr|jstd��|S)NrIztelnet connection closed)rRrSrP�EOFErrorr�r[r[r\r��szTelnet.read_very_lazycCs	|j}d|_|Sr�)rVr�r[r[r\�read_sb_data�szTelnet.read_sb_datacCrlrb)rW)rZ�callbackr[r[r\�set_option_negotiation_callback�rpz&Telnet.set_option_negotiation_callbackcCs>	ddg}z�|jr�|��}|js1|tkrq|dkrq|tkr)||j|||j<q|j|7_n�t|j�dkr�|ttt	t
fvrH|j|7_qd|_|tkrZ||j|||j<n�|tkred|_d|_n|t
krxd|_|j|d|_d|d<|jr�|�|j|t�nt|�dt|��njt|j�dkr�|jdd�}d|_|}|ttfvr�|�d|tkr�dp�d	t|��|jr�|�|j||�n6|j�tt
|�n+|t	t
fvr�|�d|t	kr�d
p�dt|��|jr�|�|j||�n
|j�tt|�|js	Wnt�yd|_d|_Ynw|j|d|_|j|d|_dS)NrI�rrzIAC %d not recognizedrz	IAC %s %d�DO�DONT�WILL�WONT)rP�rawq_getcharrT�theNULLrqrUrwr�r�r�r��SBrV�SErWrO�NOOPTrj�ordrsr�rR)rZr��c�cmd�optr[r[r\rx�st����8�zTelnet.process_rawqcCs\	|js
|��|jr
t�|j|j|jd�}|jd|_|jt|j�kr,d|_d|_|S)NrrIr)rPr�rSr�rQrw)rZr�r[r[r\r��szTelnet.rawq_getcharcCsN	|jt|j�krd|_d|_|j�d�}|�d|�||_|j||_dS)NrIr�2zrecv %r)rQrwrPrOZrecvrjrSr�r[r[r\r�szTelnet.fill_rawqcCsH	t��}|�|tj�t|�d��Wd�S1swYdSrv)r{r|r}r~�boolr)rZr�r[r[r\r�s
$�zTelnet.sock_availc
Cs	tjdkr|��dSt��k}|�|tj�|�tjtj�	|��D]T\}}|j	|urZz|�
�}WntyHtd�YWd�dSw|rYtj
�|�d��tj
��q$|j	tjurxtj���d�}|ssWd�dS|�|�q$q 1s}wYdS)NZwin32T�(*** Connection closed by remote host ***�ascii)r_�platform�mt_interactr{r|r}r~�stdinrZfileobjr�r�ri�stdoutru�decode�flush�readline�encode)rZr��keyZevents�text�liner[r[r\�interacts<

�	
��
���zTelnet.interactcCs>	ddl}|�|jd�	tj��}|sdS|�|�d��q
)Nrr[rr�)�_thread�start_new_thread�listenerr_r�r�rur�)rZr�r�r[r[r\r�3s
�zTelnet.mt_interactcCsR		z|��}Wntytd�YdSw|r#tj�|�d��ntj��q)Nrr�r�)r�r�rir_r�rur�r�)rZ�datar[r[r\r�=s�
�zTelnet.listenercCsb	d}|dd�}tt|��}|D]}t||d�s)|s ddl}|�||�||<q|dur3t�|}t��c}|�|tj	�|j
s�|��|D]-}||�|j
�}|rt|��}	|j
d|	�}
|j
|	d�|_
|||
fWd�SqG|dur�|�|�}|t�}|s�|dkr�nq>|��|j
rAWd�n1s�wY|��}
|
s�|j
r�t�dd|
fS)N�searchr���)�rangerw�hasattr�re�compilerzr{r|r}r~rSrxr�rRrhrr�r�r�)rZ�listrNr��indicesr�r�r��m�er�Zreadyr[r[r\�expectJsN�
�

���

z
Telnet.expectcCs|Srbr[rer[r[r\�	__enter__�szTelnet.__enter__cCs|��dSrbrc)rZ�type�value�	tracebackr[r[r\�__exit__�szTelnet.__exit__rb)!�__name__�
__module__�__qualname__raZ_GLOBAL_DEFAULT_TIMEOUTr]rXrfrjrmrdrnrorur�r�r�r�r�r�r�r�r�rxr�r�r�r�r�r�r�r�r�r[r[r[r\r�s@5
�


%

H


8cCs	d}tjdd�r'tjddkr'|d}tjd=tjdd�r'tjddksd}tjdd�r5tjd}d}tjdd�rYtjd}zt|�}WntyXt�|d�}Ynwt��}|�|�|j||dd�|�	�Wd�dS1sywYdS)	Nrrz-dZ	localhostrZtcpg�?)rN)
r_�argv�int�
ValueErrorraZ
getservbynamerrmrXr�)rKrLrMZportstrZtnr[r[r\�test�s,�

�

"�r��__main__)Yr_rar}�timerrz�__all__rJr^�bytesrqr�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�rHr{ZSelectSelectorrr�r�r[r[r[r\�<module>s�#









































































�

?>