CasperSecurity

Current Path : /usr/lib/python3.10/__pycache__/
Upload File :
Current File : //usr/lib/python3.10/__pycache__/pty.cpython-310.pyc

o

`�wi]�@s�dZddlmZddlZddlZddlZddlmZmZddlmZmZm	Z	gd�Z
dZdZdZ
dZd	d
�Zdd�Zd
d�Zdd�Zdd�Zdd�Zdd�Zeefdd�Zeefdd�ZdS)zPseudo terminal utilities.�)�selectN)�close�waitpid)�setraw�	tcgetattr�	tcsetattr)�openpty�fork�spawn��c	Cs<zt��WSttfyYnwt�\}}t|�}||fS)zdopenpty() -> (master_fd, slave_fd)
    Open a pty master/slave pair, using os.openpty() if possible.)�osr�AttributeError�OSError�_open_terminal�
slave_open)�	master_fd�
slave_name�slave_fd�r�/usr/lib/python3.10/pty.pyrs
�
rc	CsHzt��\}}Wn
ttfyYt�Swt�|�}t�|�||fS)z�master_open() -> (master_fd, slave_name)
    Open a pty master and return the fd, and the filename of the slave end.
    Deprecated, use openpty() instead.)r
rrr�ttynamerr)rrrrrr�master_open&s�

rc
CsddD]+}dD]&}d||}z	t�|tj�}Wn	ty Yqw|d||fSqtd��)z1Open pty master and return (master_fd, tty_name).�pqrstuvwxyzPQRST�0123456789abcdefz/dev/ptyz/dev/ttyzout of pty devices)r
�open�O_RDWRr)�x�y�pty_name�fdrrrr6s��rcCsnt�|tj�}z
ddlm}m}Wnty|YSwz|||d�|||d�W|Sty6Y|Sw)z�slave_open(tty_name) -> slave_fd
    Open the pty slave and acquire the controlling terminal, returning
    opened filedescriptor.
    Deprecated, use openpty() instead.r)�ioctl�I_PUSH�ptem�ldterm)r
rr�fcntlr!r"�ImportErrorr)�tty_name�resultr!r"rrrrBs���rc	Cs�zt��\}}WnttfyYnw|tkr.z	t��W||fSty-Y||fSw||fSt�\}}t��}|tkrvt��t�|�t�	|t
�t�	|t�t�	|t�|tkrct�|�t�
t�t�tj�}t�|�||fSt�|�||fS)zdfork() -> (pid, master_fd)
    Fork and make the child a session leader with a controlling terminal.)r
�forkptyrr�CHILD�setsidrr	r�dup2�STDIN_FILENO�
STDOUT_FILENO�
STDERR_FILENOrrr)�pidr rr�tmp_fdrrrr	Ts:�
��




�r	cCs(|rt�||�}||d�}|sdSdS)z#Write all the data to a descriptor.N)r
�write)r �data�nrrr�_writen|s�r5cCst�|d�S)zDefault read function.i)r
�read)r rrr�_read�sr7cCs�|tg}|rHt|gg�\}}}||vr/z||�}Wnty$d}Ynw|s)dSt�t|�t|vrD|t�}|s?|�t�nt||�|sdSdS)z�Parent copy loop.
    Copies
            pty master -> standard output   (master_read)
            standard input -> pty master    (stdin_read)�N)r-rrr
r2r.�remover5)r�master_read�
stdin_read�fds�rfds�_wfds�_xfdsr3rrr�_copy�s$�
�r@c
Cs�t|�td�kr|f}t�d|�t�\}}|tkr%tj|dg|�R�ztt�}t	t�d}Wnt
jy=d}Ynwzt|||�W|rOt
tt
j|�n|rZt
tt
j|�wwt|�t|d�dS)zCreate a spawned process.�z	pty.spawnrTFr)�type�sys�auditr	r*r
�execlprr-r�tty�errorr@r�	TCSAFLUSHrr)�argvr:r;r0r�mode�restorerrrr
�s.
����r
)�__doc__rr
rCrFrrrrr�__all__r-r.r/r*rrrrr	r5r7r@r
rrrr�<module>s*(
Hacker Blog, Shell İndir, Sql İnjection, XSS Attacks, LFI Attacks, Social Hacking, Exploit Bot, Proxy Tools, Web Shell, PHP Shell, Alfa Shell İndir, Hacking Training Set, DDoS Script, Denial Of Service, Botnet, RFI Attacks, Encryption
Telegram @BIBIL_0DAY