shell bypass 403

Cubjrnet7 Shell


name : serialcli.cpython-39.opt-1.pyc
a

z�YW�#�@s@ddlZddlZddlTejejZdd�ZGdd�de�ZdS)�N)�*cCstdd�|D��S)NcSsg|]}t|��qS�)�ord)�.0�xrr�4/usr/lib/python3.9/site-packages/serial/serialcli.py�
<listcomp>�z!as_byte_array.<locals>.<listcomp>)�sab)�stringrrr�
as_byte_arraysrc@s�eZdZdZdZdd�Zdd�Zdd�Zed	d
��Z	d#dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zedd��Zedd��Zedd��Zed d!��Zd"S)$�Serialz)Serial port implementation for .NET/Mono.)�2�K�n����i,iXi�ii`	i�i�%iKi�i�i�c
Cs�|jdurtd��|jr td��ztjj�|j�|_Wn<t	yr}z$d|_td|j|f��WYd}~n
d}~00|j
dur�d|_
|jdur�d|_|��|j�
�d|_|js�|��|js�|��|��dS)zx        Open port with current settings. This may throw a SerialException
        if the port cannot be opened.
        Nz.Port must be configured before it can be used.zPort is already open.zcould not open port %s: %sT)Z_port�SerialException�is_open�System�IO�Ports�
SerialPortZportstr�_port_handle�	Exception�
_rts_state�
_dtr_state�_reconfigure_portZOpenZ_dsrdtr�_update_dtr_state�_rtscts�_update_rts_state�reset_input_buffer)�self�msgrrr�opens*
(


zSerial.openc
Cs�|jstd��|jdur*tjjjj|j_nt	|jd�|j_|j
durXtjjjj|j_nt	|j
d�|j_z|j|j_
Wn0ty�}ztt|���WYd}~n
d}~00|jtkr�d|j_nJ|jtkr�d|j_n6|jtkr�d|j_n"|jtkr�d|j_ntd|j��|jtk�r*ttjjjd	�|j_n�|jtk�rHtjjjj|j_nh|jtk�rftjjjj|j_nJ|jtk�r�tjjjj |j_n,|jt!k�r�tjjjj"|j_ntd
|j��|j#t$k�r�tjjj%j&|j_%nJ|j#t'k�r�tjjj%j(|j_%n,|j#t)k�r
tjjj%j*|j_%ntd|j#��|j+�r:|j,�r:tjjj-j.|j_-nH|j+�rTtjjj-j/|j_-n.|j,�rntjjj-j0|j_-nttjjj-d	�|j_-dS)z,Set communication parameters on opened port.z'Can only operate on a valid port handleNi�����z#Unsupported number of data bits: %r�NonezUnsupported parity mode: %rz#Unsupported number of stop bits: %r)1rr�_timeoutrrrrZInfiniteTimeoutZReadTimeout�intZ_write_timeoutZWriteTimeoutZ	_baudrateZBaudRate�IOError�
ValueError�strZ	_bytesizeZFIVEBITSZDataBitsZSIXBITSZ	SEVENBITSZ	EIGHTBITSZ_parityZPARITY_NONE�getattrZParityZPARITY_EVENZEvenZ
PARITY_ODDZOddZPARITY_MARKZMarkZPARITY_SPACEZSpaceZ	_stopbitsZSTOPBITS_ONEZStopBitsZOneZSTOPBITS_ONE_POINT_FIVEZOnePointFiveZSTOPBITS_TWOZTwor Z_xonxoffZ	HandshakeZRequestToSendXOnXOffZ
RequestToSendZXOnXOff)r#�errrr;s\

"







zSerial._reconfigure_portcCsD|jr@|jr:z|j��Wntjjjy2Yn0d|_d|_dS)z
Close portNF)rrZCloserrrZInvalidOperationException�r#rrr�close�szSerial.closecCs|js
t�|jjS)z>Return the number of characters currently in the input buffer.)r�portNotOpenErrorrZBytesToReadr2rrr�
in_waiting�szSerial.in_waiting�cCsT|js
t�t�}|rLz|�|j���Wntjy@YqLYq0|d8}qt|�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.
        r6)	rr4�	bytearray�appendrZReadByter�TimeoutException�bytes)r#�size�datarrr�read�s

zSerial.readcCsH|js
t�z|j�t|�dt|��Wntjy>t�Yn0t|�S)z-Output the given string over the serial port.r)	rr4rZWriter�lenrr9ZwriteTimeoutError)r#r<rrr�write�s
zSerial.writecCs|js
t�|j��dS)z9Clear input buffer, discarding all that is in the buffer.N)rr4rZDiscardInBufferr2rrrr"�szSerial.reset_input_buffercCs|js
t�|j��dS)zs        Clear output buffer, aborting the current output and
        discarding all that is in the buffer.
        N)rr4rZDiscardOutBufferr2rrr�reset_output_buffer�szSerial.reset_output_buffercCs|js
t�t|j�|j_dS)zT
        Set break: Controls TXD. When active, to transmitting is possible.
        N)rr4�boolZ_break_staterZ
BreakStater2rrr�_update_break_state�szSerial._update_break_statecCs|js
t�t|j�|j_dS)z)Set terminal status line: Request To SendN)rr4rArrZ	RtsEnabler2rrrr!�szSerial._update_rts_statecCs|js
t�t|j�|j_dS)z-Set terminal status line: Data Terminal ReadyN)rr4rArrZ	DtrEnabler2rrrr�szSerial._update_dtr_statecCs|js
t�|jjS)z(Read terminal status line: Clear To Send)rr4rZ
CtsHoldingr2rrr�cts�sz
Serial.ctscCs|js
t�|jjS)z)Read terminal status line: Data Set Ready)rr4rZ
DsrHoldingr2rrr�dsr�sz
Serial.dsrcCs|js
t�dS)z)Read terminal status line: Ring IndicatorF)rr4r2rrr�ri�sz	Serial.ricCs|js
t�|jjS)z)Read terminal status line: Carrier Detect)rr4rZ	CDHoldingr2rrr�cd�sz	Serial.cdN)r6)�__name__�
__module__�__qualname__�__doc__Z	BAUDRATESr%rr3�propertyr5r=r?r"r@rBr!rrCrDrErFrrrrr
s,H

	


r
)	rZSystem.IO.PortsZserial.serialutilZArrayZByter
rZ
SerialBaser
rrrr�<module>
s


© 2025 Cubjrnet7