403Webshell
Server IP : 118.27.122.248  /  Your IP : 216.73.216.153
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_pty.cpython-36.pyc
3

�w2_�-�@s�ddlmZmZmZed�ddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZdZ
dZerzdd�Zndd�Zd	d
�Zdd�ZGd
d�dej�ZGdd�dej�Zdd�Zedkr�ej�dS)�)�verbose�
import_module�
reap_childrenZtermiosNsI wish to buy a fish license.
sFor my pet fish, Eric.
cCst|�dS)N)�print)�msg�r�2/opt/alt/python36/lib64/python3.6/test/test_pty.py�debugsr	cCsdS)Nr)rrrrr	scCs0|jd�r|jdd�S|jd�r,|jdd�S|S)Ns

�
s
)�endswith�replace)�datarrr�normalize_output%s


rcCstj|ddd�}|j�S)z8Read one line.  May block forever if no newline is read.�rbF)�mode�closefd)�io�FileIO�readline)�fd�readerrrr�	_readline:src@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�PtyTestcCs>tjtj|j�}|jtjtj|�|jtjd�tjd�dS)Nr�
)�signal�SIGALRM�
handle_sigZ
addCleanup�alarm)�selfZ	old_alarmrrr�setUpEsz
PtyTest.setUpcCs|jd�dS)Nzisatty hung)�fail)rZsig�framerrrrMszPtyTest.handle_sigc!Cs�yLtd�tj�\}}td||f�td|f�tj|�}td|�Wntk
rjtjd��YnX|jtj	|�d�tj
|�}z^tj|d�ytj|d�}|j
d	|�Wn0tk
r�}z|jtjkr҂WYdd}~XnXWdtj||�Xtd
�tj|t�t|�}|j
dt|��td�tj|tdd
��tj|td
d��t|�}|j
dt|��tj|�tj|�dS)NzCalling master_open()z#Got master_fd '%d', slave_name '%s'zCalling slave_open(%r)zGot slave_fd '%d'z,Pseudo-terminals (seemingly) not functional.zslave_fd is not a ttyFi�zWriting to slave_fdsI wish to buy a fish license.
zWriting chunked output�sFor my pet fish, Eric.
)r	�ptyZmaster_openZ
slave_open�OSError�unittestZSkipTestZ
assertTrue�os�isatty�get_blocking�set_blocking�read�assertEqual�errnoZEAGAIN�write�
TEST_STRING_1rr�
TEST_STRING_2�close)r�	master_fdZ
slave_nameZslave_fdZblocking�s1�e�s2rrr�
test_basicPsB



zPtyTest.test_basicc
Cs�td�tj�\}}|tjkr�tjd�s:td�tjd�td�ytj�WnRtk
rjtd�YnJt	k
r�td�Yn0td�tjd�YnXtd	�tjd
�tjd�n�td|�xPytj
|d
�}Wntk
r�PYnX|�s�Ptjj
t|jdd�dd��q�Wtj|d�\}}|d?}td|||f�|dk�r^|jd�n@|d
k�rt|jd�n*|dk�r�|jd�n|dk�r�|jd�tj|�dS)Nzcalling pty.fork()�zChild's fd 1 is not a tty?!�zIn child, calling os.setsid()zGood: OSError was raised.zNo setsid() available?zAn unexpected error was raised.zos.setsid() succeeded! (bad!)��z!Waiting for child (%d) to finish.�Ps
r
�ascii)�encodingr�z&Child (%d) exited with status %d (%d).z3Child raised an unexpected exception in os.setsid()z1pty.fork() failed to make child a session leader.z8Child spawned by pty.fork() did not have a tty as stdoutz&pty.fork() failed for unknown reasons.)r	r$�forkZCHILDr'r(�_exit�setsidr%�AttributeErrorr+�sys�stdoutr.�strr�waitpidr r1)r�pidr2r
Zstatus�resrrr�	test_fork�sV









zPtyTest.test_forkN)�__name__�
__module__�__qualname__rrr6rIrrrrrDs1rc@sHeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dS)�
SmallPtyTestsz)These tests don't spawn children or hang.cCs4tj|_tj|_tj|_g|_g|_g|_	g|_
dS)N)r$�STDIN_FILENO�orig_stdin_fileno�
STDOUT_FILENO�orig_stdout_fileno�select�orig_pty_select�fds�files�select_rfds_lengths�select_rfds_results)rrrrr�szSmallPtyTests.setUpcCs�|jt_|jt_|jt_x0|jD]&}y|j�Wq t	k
rDYq Xq Wx2|j
D](}ytj|�WqRt	k
rxYqRXqRWdS)N)rOr$rNrQrPrSrRrUr1r%rTr')r�filerrrr�tearDown�s
zSmallPtyTests.tearDowncCstj�}|jj|�|S)N)r'�piperT�extend)rZpipe_fdsrrr�_pipe�szSmallPtyTests._pipecCstj�}|jj|�|S)N)�socket�
socketpairrUr[)rr^rrr�_socketpair�szSmallPtyTests._socketpaircCs*|j|jjd�t|��|jjd�ggfS)Nr)r,rV�pop�lenrW)r�rfdsZwfdsZxfdsrrr�_mock_select�szSmallPtyTests._mock_selectcCs|j�\}}|t_|j�\}}|t_|j�}dd�|D�}tj|dd�tj|d�|jt_|j	j
d�|jj
||dg�|j	j
d�|jt
��tj|d�WdQRXtj||dgggd�d}|j||dg|�|jtj|d	�d�|jtj|dd	�d�dS)
z6Test the normal data case on both master_fd and stdin.cSsg|]}|j��qSr)�fileno)�.0�srrr�
<listcomp>sz4SmallPtyTests.test__copy_to_each.<locals>.<listcomp>r7sfrom masters
from stdinr9rN�)r\r$rPrNr_r'r.rcrRrV�appendrW�assertRaises�
IndexError�_copyr,r+)r�read_from_stdout_fd�mock_stdout_fd�
mock_stdin_fd�write_to_stdin_fdr^�mastersrbrrr�test__copy_to_eachs$z SmallPtyTests.test__copy_to_eachc
Cs�|j�\}}|t_|j�\}}|t_|j�}dd�|D�}|dj�tj|�|jt_|j	j
d�|jj
||dg�|j	j
d�|jt
��tj|d�WdQRXdS)z9Test the empty read EOF case on both master_fd and stdin.cSsg|]}|j��qSr)rd)rerfrrrrg$sz7SmallPtyTests.test__copy_eof_on_all.<locals>.<listcomp>r7r9rN)r\r$rPrNr_r1r'rcrRrVrirWrjrkrl)rrmrnrorpr^rqrrr�test__copy_eof_on_alls
z#SmallPtyTests.test__copy_eof_on_allN)rJrKrL�__doc__rrYr\r_rcrrrsrrrrrM�s	rMcCs
t�dS)N)rrrrr�tearDownModule5sru�__main__)Ztest.supportrrrr-r$r'rCrRrr]rr&r/r0r	rrZTestCaserrMrurJ�mainrrrr�<module>s.

^

Youez - 2016 - github.com/yon3zu
LinuXploit