ROOTPLOIT
Server: LiteSpeed
System: Linux server71.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
User: niphet (1079)
PHP: 5.3.29
Disabled: NONE
Upload Files
File: //usr/lib64/python3.8/__pycache__/pty.cpython-38.pyc
U

e5d@sdZddlmZddlZddlZddlZdddgZdZdZdZdZ	d	dZ
d
dZdd
ZddZ
ddZddZddZeefddZeefddZdS)zPseudo terminal utilities.)selectNopenptyforkspawnc	Cs>z
tWSttfk
r"YnXt\}}t|}||fS)zdopenpty() -> (master_fd, slave_fd)
    Open a pty master/slave pair, using os.openpty() if possible.)osrAttributeErrorOSError_open_terminal
slave_open)	master_fd
slave_nameslave_fdr/usr/lib64/python3.8/pty.pyrs

c	CsLzt\}}Wnttfk
r(YnXt|}t|||fStS)zmaster_open() -> (master_fd, slave_name)
    Open a pty master and return the fd, and the filename of the slave end.
    Deprecated, use openpty() instead.)rrr	r
ttynamecloser)r
rrrrrmaster_open"s

rc
CsndD]\}dD]R}d||}zt|tj}Wntk
rFYqYnX|d||fSqtddS)z1Open pty master and return (master_fd, tty_name).ZpqrstuvwxyzPQRSTZ0123456789abcdefz/dev/ptyz/dev/ttyzout of pty devicesN)ropenO_RDWRr
)xyZpty_namefdrrrr2s
rcCsrt|tj}zddlm}m}Wntk
r:|YSXz|||d|||dWntk
rlYnX|S)zslave_open(tty_name) -> slave_fd
    Open the pty slave and acquire the controlling terminal, returning
    opened filedescriptor.
    Deprecated, use openpty() instead.r)ioctlI_PUSHZptemZldterm)rrrZfcntlrrImportErrorr
)Ztty_nameresultrrrrrr>s
rc	Cszt\}}Wnttfk
r(Yn4X|tkrTztWntk
rRYnX||fSt\}}t}|tkrtt|t	|t
t	|tt	|t|tkrt|t
tttj}t|n
t|||fS)zdfork() -> (pid, master_fd)
    Fork and make the child a session leader with a controlling terminal.)rforkptyr	r
CHILDsetsidrrrdup2STDIN_FILENO
STDOUT_FILENO
STDERR_FILENOrrr)pidrr
rZtmp_fdrrrrPs0



cCs"|rt||}||d}qdS)z#Write all the data to a descriptor.N)rwrite)rdatanrrr_writenxsr)cCst|dS)zDefault read function.i)rread)rrrr_read~sr+cCsv|tg}t|gg\}}}||krF||}|s:||ntt|t|kr|t}|sf|tqt||qdS)zParent copy loop.
    Copies
            pty master -> standard output   (master_read)
            standard input -> pty master    (stdin_read)N)r"rremoverr&r#r))r
master_read
stdin_readZfdsZrfdsZwfdsZxfdsr'rrr_copysr/cCst|tdkr|f}td|t\}}|tkrHtj|df|ztt	}t
t	d}Wntjk
r~d}YnXzt|||Wn(t
k
r|rtt	tj|YnXt|t|ddS)zCreate a spawned process.z	pty.spawnrr)typesysauditrrrexeclpttyZ	tcgetattrr"Zsetrawerrorr/r
Z	tcsetattrZ	TCSAFLUSHrwaitpid)argvr-r.r%r
modeZrestorerrrrs&




)__doc__rrr2r5__all__r"r#r$rrrrrrr)r+r/rrrrr<module>s$
(