AnonSec Shell
Server IP : 209.38.156.173  /  Your IP : 216.73.216.122   [ Reverse IP ]
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.1.2-1ubuntu2.22
Disable Function : NONE
Domains : 2 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3/dist-packages/twisted/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /usr/lib/python3/dist-packages/twisted/test/__pycache__/test_fdesc.cpython-310.pyc
o

�b�@s�dZddlZddlZddlZzddlZWneydZYnwddlmZddl	m
Z
ddlmZGdd�dej
�ZGd	d
�d
ej
�ZGdd�dej
�ZdS)
z&
Tests for L{twisted.internet.fdesc}.
�Nznot supported on this platform)�fdesc)�untilConcludes)�unittestc@s eZdZdZdd�Zdd�ZdS)�NonBlockingTestszE
    Tests for L{fdesc.setNonBlocking} and L{fdesc.setBlocking}.
    cCsjt��\}}|�tj|�|�tj|�|�t�|tj�tj@�t�	|�|�
t�|tj�tj@�dS)zR
        L{fdesc.setNonBlocking} sets a file description to non-blocking.
        N)�os�pipe�
addCleanup�close�assertFalse�fcntl�F_GETFL�
O_NONBLOCKr�setNonBlocking�
assertTrue��self�r�w�r�9/usr/lib/python3/dist-packages/twisted/test/test_fdesc.py�test_setNonBlockings
z$NonBlockingTests.test_setNonBlockingcCsZt��\}}|�tj|�|�tj|�t�|�t�|�|�t�|tj	�tj
@�dS)zK
        L{fdesc.setBlocking} sets a file description to blocking.
        N)rrrr	rr�setBlockingr
rrr
rrrr�test_setBlocking's

z!NonBlockingTests.test_setBlockingN)�__name__�
__module__�__qualname__�__doc__rrrrrrrsrc@speZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS)�ReadWriteTestsz<
    Tests for L{fdesc.readFromFD}, L{fdesc.writeToFD}.
    cCs,t��\|_|_t�|j�t�|j�dS)zG
        Create a non-blocking pipe that can be used in tests.
        N)rrrrrr�rrrr�setUp8szReadWriteTests.setUpcCsLzt�|j�Wn	tyYnwz	t�|j�WdSty%YdSw)z
        Close pipes.
        N)rr	r�OSErrorrrrrr�tearDown@s��zReadWriteTests.tearDowncCst�|j|�S)z)
        Write data to the pipe.
        )r�	writeToFDr)r�drrr�writeMszReadWriteTests.writecCs0g}t�|j|j�}|dur|r|dSdS|S)z*
        Read data from the pipe.
        Nr�)r�
readFromFDr�append)r�l�resrrr�readSszReadWriteTests.readcCsH|�d�}|�|dk�|��}|�t|�|�|�dd|�|�dS)z�
        Test that the number of bytes L{fdesc.writeToFD} reports as written
        with its return value are seen by L{fdesc.readFromFD}.
        shellorN)r$rr*�assertEqual�len)r�n�srrr�test_writeAndReadas

z ReadWriteTests.test_writeAndReadcCs�dd}|�|�}|�|dk�g}d}d}||ks|dkr9|�|���|t|d�7}|d7}||ks|dksd�|�}|�t|�|�|�|d|�|�dS)	z}
        Similar to L{test_writeAndRead}, but use a much larger string to verify
        the behavior for that case.
        s
0123456879i'r�2����r%N)r$rr'r*r,�joinr+)r�orig�written�result�resultlength�irrr�test_writeAndReadLargels
�
z%ReadWriteTests.test_writeAndReadLargecCs.g}t�|j|j�}|�|g�|�|�dS)z�
        Verify that reading from a file descriptor with no data does not raise
        an exception and does not result in the callback function being called.
        N)rr&rr'r+�assertIsNone)rr(r6rrr�test_readFromEmpty�sz!ReadWriteTests.test_readFromEmptycC�"t�|j�|�|��tj�dS)z�
        Test that using L{fdesc.readFromFD} on a cleanly closed file descriptor
        returns a connection done indicator.
        N)rr	rr+r*r�CONNECTION_DONErrrr�test_readFromCleanClose��z&ReadWriteTests.test_readFromCleanClosecC�$t�|j�|�|�d�tj�dS)z�
        Verify that writing with L{fdesc.writeToFD} when the read end is closed
        results in a connection lost indicator.
        �sN)rr	rr+r$r�CONNECTION_LOSTrrrr�test_writeToClosed��z!ReadWriteTests.test_writeToClosedcCr<)z�
        Verify that reading with L{fdesc.readFromFD} when the read end is
        closed results in a connection lost indicator.
        N)rr	rr+r*rrBrrrr�test_readFromInvalid�r?z#ReadWriteTests.test_readFromInvalidcCr@)z�
        Verify that writing with L{fdesc.writeToFD} when the write end is
        closed results in a connection lost indicator.
        rAN)rr	rr+r$rrBrrrr�test_writeToInvalid�rDz"ReadWriteTests.test_writeToInvalidcCsptj}dd�}|t_z|�|�d�d�W|t_n|t_wdd�}|t_z|�|�d�d�W|t_dS|t_w)z8
        Test error path for L{fdesc.writeTod}.
        cS�t�}tj|_|��N)r �errno�EAGAIN��fd�data�errrrr�eagainWrite��z4ReadWriteTests.test_writeErrors.<locals>.eagainWriterArcSrGrH)r rI�EINTRrKrrr�
eintrWrite�rPz3ReadWriteTests.test_writeErrors.<locals>.eintrWriteN)rr$r+)r�
oldOsWriterOrRrrr�test_writeErrors�szReadWriteTests.test_writeErrorsN)rrrrrr!r$r*r/r9r;r>rCrErFrTrrrrr3s

rc@s,eZdZdZdZdd�Zdd�Zdd�Zd	S)
�CloseOnExecTestszL
    Tests for L{fdesc._setCloseOnExec} and L{fdesc._unsetCloseOnExec}.
    z�
import os, errno
try:
    os.write(%d, b'lul')
except OSError as e:
    if e.errno == errno.EBADF:
        os._exit(0)
    os._exit(5)
except BaseException:
    os._exit(10)
else:
    os._exit(20)
cCszt��}|dkr4zt�tjtjd|j|��fg�WdSty3ddl}|�	�t�
d�YdSwttj|d�dS)Nrz-c�r2)
r�fork�execv�sys�
executable�program�fileno�
BaseException�	traceback�	print_exc�_exitr�waitpid)r�fObj�pidr^rrr�_execWithFileDescriptor�s
��z(CloseOnExecTests._execWithFileDescriptorcCsnt|��d��&}t�|���|�|�}|�t�|��|�	t�
|�d�Wd�dS1s0wYdS)z�
        A file descriptor passed to L{fdesc._setCloseOnExec} is not inherited
        by a new process image created with one of the exec family of
        functions.
        �wbrN)�open�mktempr�_setCloseOnExecr\rdrr�	WIFEXITEDr+�WEXITSTATUS�rrb�statusrrr�test_setCloseOnExec�s
"�z$CloseOnExecTests.test_setCloseOnExeccCs|t|��d��-}t�|���t�|���|�|�}|�t�	|��|�
t�|�d�Wd�dS1s7wYdS)z�
        A file descriptor passed to L{fdesc._unsetCloseOnExec} is inherited by
        a new process image created with one of the exec family of functions.
        re�N)rfrgrrhr\�_unsetCloseOnExecrdrrrir+rjrkrrr�test_unsetCloseOnExec�s
"�z&CloseOnExecTests.test_unsetCloseOnExecN)rrrrr[rdrmrprrrrrU�srU)rrIrrYr�ImportError�skip�twisted.internetr�twisted.python.utilr�
twisted.trialr�SynchronousTestCaserrrUrrrr�<module>s �

Anon7 - 2022
AnonSec Team