403Webshell
Server IP : 192.158.238.246  /  Your IP : 3.15.22.62
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /usr/lib/python3.6/site-packages/serial/urlhandler/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3.6/site-packages/serial/urlhandler/__pycache__/protocol_loop.cpython-36.pyc
3

M�]W�%�@s"ddlZddlZddlZyddlZWnek
rBddljZYnXyddlZWnek
rlddlZYnXddl	m
Z
mZmZm
Z
mZmZejejejejd�ZGdd�de
�Zedk�rddlZed�Zejjdje��ejjd	�ejd
�ej�ejjdjejd���ej�dS)
�N)�
SerialBase�SerialException�to_bytes�	iterbytes�writeTimeoutError�portNotOpenError)�debug�infoZwarning�errorcs�eZdZdZd6Z�fdd�Zdd�Z�fdd�Zdd�Zdd�Z	e
dd��Zd7d d!�Zd"d#�Z
d$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Ze
d.d/��Ze
d0d1��Ze
d2d3��Ze
d4d5��Z�ZS)8�SerialzSSerial port implementation that simulates a loop back connection in plain software.�2�K�n�����,�X���`	��%�K������cs(tt|�j||�d|_d|_d|_dS)Ni)�superr�__init__�buffer_size�queue�logger)�self�args�kwargs)�	__class__��#/usr/lib/python3.6/protocol_loop.pyr-szSerial.__init__cCs~|jrtd��d|_tj|j�|_|jdkr4td��|j|j�|j	�d|_|j
s\|j�|jsj|j
�|j�|j�dS)zx        Open port with current settings. This may throw a SerialException
        if the port cannot be opened.
        zPort is already open.Nz.Port must be configured before it can be used.T)�is_openrr!r �QueuerZ_port�from_urlZport�_reconfigure_portZ_dsrdtr�_update_dtr_stateZ_rtscts�_update_rts_state�reset_input_buffer�reset_output_buffer)r"r&r&r'�open3s
zSerial.opencsF|jr4d|_y|jjd�Wntjk
r2YnXtt|�j�dS)NF)r(r Z
put_nowaitZFullrr�close)r")r%r&r'r1NszSerial.closecCsRt|jtj�s,d|jko$dknr<tdj|j���|jrN|jjd�dS)zx        Set communication parameters on opened port. For the loop://
        protocol all settings are ignored!
        r�� zinvalid baudrate: {!r}z_reconfigure_port()Nl)�
isinstance�	_baudrate�numbersZIntegral�
ValueError�formatr!r	)r"r&r&r'r+Ws,zSerial._reconfigure_portcCs�tj|�}|jdkr$tdj|j���ypxjtj|jd�j�D]T\}}|dkr�tj	�tj
d�|_|jjt
|d�|jjd�q:tdj|���q:WWn0tk
r�}ztd	j|���WYd
d
}~XnXd
S)z(extract host and port from an URL stringZloopznexpected a string in the form "loop://[?logging={debug|info|warning|error}]": not starting with loop:// ({!r})T�loggingz
pySerial.looprzenabled loggingzunknown option: {!r}zPexpected a string in the form "loop://[?logging={debug|info|warning|error}]": {}N)�urlparseZurlsplit�schemerr8Zparse_qsZquery�itemsr9ZbasicConfigZ	getLoggerr!ZsetLevel�
LOGGER_LEVELSrr7)r"Zurl�partsZoption�values�er&r&r'r*bs"


zSerial.from_urlcCs2|js
t�|jr(|jjdj|jj���|jj�S)z9Return the number of bytes currently in the input buffer.zin_waiting -> {:d})r(rr!rr8r �qsize)r"r&r&r'�
in_waiting{s
zSerial.in_waiting�cCs�|js
t�|jdk	r.|jdkr.tj�|j}nd}t�}x�|dkr�|jr�y|jj|jd�}Wn"tjk
r~|jdkrzPYnX|dk	r�||7}|d8}nP|r:tj�|kr:|jr�|jj	d�Pq:Wt
|�S)z�        Read size bytes from the serial port. If a timeout is set it may
        return less characters as requested. With no timeout it will block
        until the requested number of bytes is read.
        Nr)�timeoutrCzread timeout)r(rZ_timeout�time�	bytearrayr �get�Emptyr!r	�bytes)r"�sizerD�data�br&r&r'�read�s*

zSerial.readcCst|js
t�t|�}dt|�|j}|jdk	rH||jkrHtj|j�t�x"t	|�D]}|j
j||jd�qRWt|�S)z�        Output the given byte string over the serial port. Can block if the
        connection is blocked. May raise SerialException if the connection is
        closed.
        g$@N)rD)r(rr�lenr5Z_write_timeoutrEZsleeprrr Zput)r"rKZtime_used_to_sendZbyter&r&r'�write�szSerial.writecCsV|js
t�|jr|jjd�yx|jj�r6|jj�q WWntjk
rPYnXdS)z9Clear input buffer, discarding all that is in the buffer.zreset_input_buffer()N)r(rr!r	r rA�
get_nowaitrH)r"r&r&r'r.�szSerial.reset_input_buffercCsV|js
t�|jr|jjd�yx|jj�r6|jj�q WWntjk
rPYnXdS)zs        Clear output buffer, aborting the current output and
        discarding all that is in the buffer.
        zreset_output_buffer()N)r(rr!r	r rArPrH)r"r&r&r'r/�szSerial.reset_output_buffercCs|jr|jjdj|j��dS)z[        Set break: Controls TXD. When active, to transmitting is
        possible.
        z_update_break_state({!r})N)r!r	r8Z_break_state)r"r&r&r'�_update_break_state�szSerial._update_break_statecCs|jr|jjdj|j��dS)z)Set terminal status line: Request To Sendz'_update_rts_state({!r}) -> state of CTSN)r!r	r8�
_rts_state)r"r&r&r'r-�szSerial._update_rts_statecCs|jr|jjdj|j��dS)z-Set terminal status line: Data Terminal Readyz'_update_dtr_state({!r}) -> state of DSRN)r!r	r8�
_dtr_state)r"r&r&r'r,�szSerial._update_dtr_statecCs*|js
t�|jr$|jjdj|j��|jS)z(Read terminal status line: Clear To SendzCTS -> state of RTS ({!r}))r(rr!r	r8rR)r"r&r&r'�cts�s
z
Serial.ctscCs |jr|jjdj|j��|jS)z)Read terminal status line: Data Set ReadyzDSR -> state of DTR ({!r}))r!r	r8rS)r"r&r&r'�dsr�sz
Serial.dsrcCs |js
t�|jr|jjd�dS)z)Read terminal status line: Ring Indicatorzreturning dummy for RIF)r(rr!r	)r"r&r&r'�ri�s
z	Serial.ricCs |js
t�|jr|jjd�dS)z)Read terminal status line: Carrier Detectzreturning dummy for CDT)r(rr!r	)r"r&r&r'�cds
z	Serial.cd)rr
rrrrrrrrrrrrrrr)rC)�__name__�
__module__�__qualname__�__doc__Z	BAUDRATESrr0r1r+r*�propertyrBrMrOr.r/rQr-r,rTrUrVrW�
__classcell__r&r&)r%r'r's(	
!		r�__main__zloop://z{}
z	write...
zhello
zread: {!r}
�)r9r6rEr:�ImportErrorZurllib.parse�parser r)Zserial.serialutilrrrrrr�DEBUG�INFOZWARNINGZERRORr=rrX�sys�s�stdoutrOr8�flushrMr1r&r&r&r'�<module>s4 
i



Youez - 2016 - github.com/yon3zu
LinuXploit