shell bypass 403

Cubjrnet7 Shell


name : serialutil.cpython-39.pyc
a

��gY�T�
@s�ddlZddlZzeWn&eefy>Gdd�de�ZYn0zeWneefybeZYn0zeWneefy�efZYn0dd�Z	dd�Z
e
dg�Ze
d	g�Ze
d
g�Z
e
dg�Zd\ZZZZZd
\ZZZd\ZZZZededededediZGdd�de�ZGdd�de�Zed�Zed�Z Gdd�de�Z!Gdd�dej"�Z#e$dk�r�ddl%Z%e#�Z&e%j'�(d�)e&j*��e%j'�(d �)e&j+��e%j'�(d!�)e&j,��e%j'�(d"�)e&j-��e%j'�(d#�)e&j.��e%j'�(d$�)e&��dS)%�Nc@seZdZdS)�
memoryviewN)�__name__�
__module__�__qualname__�rr�5/usr/lib/python3.9/site-packages/serial/serialutil.pyrsrccsBt|t�r|��}d}|||d�}|d7}|r>|Vqq>qdS)z=Iterate over bytes, returning bytes instead of ints (python3)r�N)�
isinstancer�tobytes)�b�i�arrr�	iterbytes&s
rcCs\t|t�r|St|t�r t|�St|t�r2|��St|t�rLtd�|���ntt|��SdS)z"convert a sequence to a bytes typez?unicode strings are not supported, please encode to bytes: {!r}N)r	�bytes�	bytearrayrr
�unicode�	TypeError�format)�seqrrr�to_bytes6s



r���
�
)�N�E�O�M�S)rg�?�)�����NoneZEvenZOddZMarkZSpacec@seZdZdZdS)�SerialExceptionz.Base class for serial port related exceptions.N�rrr�__doc__rrrrr%Zsr%c@seZdZdZdS)�SerialTimeoutExceptionz Write timeouts give an exceptionNr&rrrrr(^sr(z
Write timeoutz)Attempting to use a port that is not openc@sHeZdZdZeed�rejZnejZdd�Zdd�Z	dd�Z
d	d
�ZdS)�Timeouta>    Abstraction for timeout operations. Using time.monotonic() if available
    or time.time() in all other cases.

    The class can also be initialized with 0 or None, in order to support
    non-blocking and fully blocking I/O operations. The attributes
    is_non_blocking and is_infinite are set accordingly.
    �	monotoniccCs<|du|_|dk|_||_|dur2|��||_nd|_dS)z(Initialize a timeout with given durationNr)�is_infinite�is_non_blocking�duration�TIME�target_time��selfr-rrr�__init__{s

zTimeout.__init__cCs|jduo|��dkS)z4Return a boolean, telling if the timeout has expiredNr)r/�	time_left�r1rrr�expired�szTimeout.expiredcCsP|jr
dS|jrdS|j|��}||jkrB|��|j|_|jStd|�SdS)z:Return how many seconds are left until the timeout expiresrN)r,r+r/r.r-�max)r1Zdeltarrrr3�s
zTimeout.time_leftcCs||_|��||_dS)zb        Restart a timeout, only supported if a timeout was already set up
        before.
        N)r-r.r/r0rrr�restart�szTimeout.restartN)rrrr'�hasattr�timer*r.r2r5r3r7rrrrr)fs

r)c@seZdZdZdZeeeefZ	e
eee
efZeeefZddee
edddddddfdd�Zedd	��Zejd
d	��Zedd��Zejd
d��Zedd��Zejdd��Zedd��Zejdd��Zedd��Zejdd��Zedd��Zejdd��Zedd��Zejdd��Zedd��Zejdd��Zed d!��Zejd"d!��Zed#d$��Z e jd%d$��Z ed&d'��Z!e!jd(d'��Z!ed)d*��Z"e"jdwd+d*��Z"ed,d-��Z#e#jd.d-��Z#ed/d0��Z$e$jd1d0��Z$ed2d3��Z%e%jd4d3��Z%ed5d6��Z&e&jd7d6��Z&d8Z'd9d:�Z(d;d<�Z)d=d>�Z*d?d@�Z+dAdB�Z,dCdD�Z-dEdF�Z.dGdH�Z/dIdJ�Z0dxdLdM�Z1dNdO�Z2dPdQ�Z3dRdS�Z4dydTdU�Z5dzdWdX�Z6d{dYdZ�Z7d[d\�Z8d]d^�Z9d_d`�Z:dadb�Z;dcdd�Z<ededf��Z=e=jdgdf��Z=edhdi��Z>e>jdjdi��Z>dkdl�Z?dmdn�Z@dodp�ZAdqdr�ZBeCdfdsdt�ZDdudv�ZEdS)|�
SerialBasezh    Serial port base class. Provides __init__ function and properties to
    get/set port settings.
    )�2�K�n����i,iXi�ii`	i��%iKi�i�i�i�ii �i�ii@Bi�i`�i��i�%&i��-i�g5i	=NrAFc
Ks
d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_	d|_
d|_d|_d|_
d|_d|_d|_d|_d|_||_||_||_||_||_||_|	|_||_||_|
|_||_||_d|
vr�|
�d�|_d|
vr�|
�d�|_|
r�t d�!|
���|du�r|�"�dS)z�        Initialize comm port object. If a "port" is given, then the port will be
        opened immediately. Otherwise a Serial port object in closed state
        is returned.
        FNT�writeTimeout�interCharTimeoutz"unexpected keyword arguments: {!r})#�is_open�portstr�name�_port�	_baudrate�	_bytesize�_parity�	_stopbits�_timeout�_write_timeout�_xonxoff�_rtscts�_dsrdtr�_inter_byte_timeout�_rs485_mode�
_rts_state�
_dtr_state�_break_state�
_exclusive�port�baudrate�bytesize�parity�stopbits�timeout�
write_timeout�xonxoff�rtscts�dsrdtr�inter_byte_timeout�	exclusive�pop�
ValueErrorr�open)r1rWrXrYrZr[r\r^r_r]r`rarb�kwargsrrrr2�sN
zSerialBase.__init__cCs|jS)z{        Get the current port setting. The value that was passed on init or using
        setPort() is passed back.
        )rGr4rrrrW�szSerialBase.portcCsZ|dur$t|t�s$td�t|����|j}|r6|��||_||_|j|_	|rV|�
�dS)z!        Change the port.
        Nz'"port" must be None or a string, not {})r	�
basestringrdr�typerD�closerErGrFre)r1rWZwas_openrrrrWscCs|jS)z"Get the current baud rate setting.)rHr4rrrrXszSerialBase.baudratecCs\zt|�}Wn ty,td�|���Yn,0|dkrDtd�|���||_|jrX|��dS)z�        Change baud rate. It raises a ValueError if the port is open and the
        baud rate is not possible. If the port is closed, then the value is
        accepted and the exception is raised when the port is opened.
        zNot a valid baudrate: {!r}rN)�intrrdrrHrD�_reconfigure_port)r1rXrrrrrXscCs|jS)z"Get the current byte size setting.)rIr4rrrrY)szSerialBase.bytesizecCs0||jvrtd�|���||_|jr,|��dS)zChange byte size.zNot a valid byte size: {!r}N)�	BYTESIZESrdrrIrDrk)r1rYrrrrY.s

cCs|jS)z)Get the current exclusive access setting.)rVr4rrrrb7szSerialBase.exclusivecCs||_|jr|��dS)z$Change the exclusive access setting.N)rVrDrk)r1rbrrrrb<scCs|jS)zGet the current parity setting.)rJr4rrrrZCszSerialBase.paritycCs0||jvrtd�|���||_|jr,|��dS)zChange parity setting.zNot a valid parity: {!r}N)�PARITIESrdrrJrDrk)r1rZrrrrZHs

cCs|jS)z"Get the current stop bits setting.)rKr4rrrr[QszSerialBase.stopbitscCs0||jvrtd�|���||_|jr,|��dS)zChange stop bits size.zNot a valid stop bit size: {!r}N)�STOPBITSrdrrKrDrk)r1r[rrrr[Vs

cCs|jS�z Get the current timeout setting.)rLr4rrrr\_szSerialBase.timeoutcCsd|durLz|dWn ty4td�|���Yn0|dkrLtd�|���||_|jr`|��dS)�Change timeout setting.Nr�Not a valid timeout: {!r}r)rrdrrLrDrk�r1r\rrrr\dscCs|jSro)rMr4rrrr]rszSerialBase.write_timeoutcCsd|durL|dkrtd�|���z|dWn tyJtd�|���Yn0||_|jr`|��dS)rpNrrqr)rdrrrMrDrkrrrrrr]wscCs|jS)z0Get the current inter-character timeout setting.)rQr4rrrra�szSerialBase.inter_byte_timeoutcCsd|durL|dkrtd�|���z|dWn tyJtd�|���Yn0||_|jr`|��dS)z"Change inter-byte timeout setting.Nrrqr)rdrrrQrDrk)r1Z
ic_timeoutrrrra�scCs|jS)z!Get the current XON/XOFF setting.)rNr4rrrr^�szSerialBase.xonxoffcCs||_|jr|��dS)zChange XON/XOFF setting.N)rNrDrk)r1r^rrrr^�scCs|jS)z-Get the current RTS/CTS flow control setting.)rOr4rrrr_�szSerialBase.rtsctscCs||_|jr|��dS)z$Change RTS/CTS flow control setting.N)rOrDrk)r1r_rrrr_�scCs|jS)z-Get the current DSR/DTR flow control setting.)rPr4rrrr`�szSerialBase.dsrdtrcCs*|dur|j|_n||_|jr&|��dS)z#Change DsrDtr flow control setting.N)rOrPrDrk)r1r`rrrr`�s

cCs|jS�N)rSr4rrr�rts�szSerialBase.rtscCs||_|jr|��dSrs)rSrDZ_update_rts_state�r1�valuerrrrt�scCs|jSrs)rTr4rrr�dtr�szSerialBase.dtrcCs||_|jr|��dSrs)rTrDZ_update_dtr_staterurrrrw�scCs|jSrs)rUr4rrr�break_condition�szSerialBase.break_conditioncCs||_|jr|��dSrs)rUrDZ_update_break_staterurrrrx�scCs|jS)z�        Enable RS485 mode and apply new settings, set to None to disable.
        See serial.rs485.RS485Settings for more info about the value.
        )rRr4rrr�
rs485_mode�szSerialBase.rs485_modecCs||_|jr|��dSrs)rRrDrk)r1Zrs485_settingsrrrry�s)
rXrYrZr[r^r`r_r\r]racst�fdd��jD��S)zb        Get current port settings as a dictionary. For use with
        apply_settings().
        csg|]}|t�d|�f�qS)�_)�getattr)�.0�keyr4rr�
<listcomp>��z+SerialBase.get_settings.<locals>.<listcomp>)�dict�_SAVED_SETTINGSr4rr4r�get_settings�szSerialBase.get_settingscCs>|jD]2}||vr||t|d|�krt||||�qdS)z�        Apply stored settings from a dictionary returned from
        get_settings(). It's allowed to delete keys from the dictionary. These
        values will simply left unchanged.
        rzN)r�r{�setattr)r1�dr}rrr�apply_settings�s
zSerialBase.apply_settingscCsdj|jjt|�|d�S)zAString representation of the current port settings and its state.z�{name}<id=0x{id:x}, open={p.is_open}>(port={p.portstr!r}, baudrate={p.baudrate!r}, bytesize={p.bytesize!r}, parity={p.parity!r}, stopbits={p.stopbits!r}, timeout={p.timeout!r}, xonxoff={p.xonxoff!r}, rtscts={p.rtscts!r}, dsrdtr={p.dsrdtr!r}))rF�id�p)r�	__class__rr�r4rrr�__repr__s�zSerialBase.__repr__cCsdS�NTrr4rrr�readableszSerialBase.readablecCsdSr�rr4rrr�writableszSerialBase.writablecCsdS)NFrr4rrr�seekableszSerialBase.seekablec
Cs||�t|��}t|�}z||d|�<WnPtyv}z8ddl}t||j�sN|�|�d|�|d|�<WYd}~n
d}~00|S)Nrr)�read�lenr�arrayr	)r1r�data�n�errr�rrr�readinto s*zSerialBase.readintocCs|js|��|Srs)rDrer4rrr�	__enter__/szSerialBase.__enter__cOs|��dSrs)ri)r1�argsrfrrr�__exit__4szSerialBase.__exit__��?cCs$|js
t�d|_t�|�d|_dS)za        Send break condition. Timed, returns to idle state after given
        duration.
        TFN)rD�portNotOpenErrorrxr9�sleepr0rrr�
send_break9s

zSerialBase.send_breakcCs|��dSrs)Zreset_input_bufferr4rrr�
flushInputGszSerialBase.flushInputcCs|��dSrs)Zreset_output_bufferr4rrr�flushOutputJszSerialBase.flushOutputcCs|jSrs)�
in_waitingr4rrr�	inWaitingMszSerialBase.inWaitingcCs|�|�dSrs)r�r0rrr�	sendBreakPszSerialBase.sendBreakrcCs
||_dSrs)rtrurrr�setRTSSszSerialBase.setRTScCs
||_dSrs)rwrurrr�setDTRVszSerialBase.setDTRcCs|jSrs)Zctsr4rrr�getCTSYszSerialBase.getCTScCs|jSrs)Zdsrr4rrr�getDSR\szSerialBase.getDSRcCs|jSrs)Zrir4rrr�getRI_szSerialBase.getRIcCs|jSrs)Zcdr4rrr�getCDbszSerialBase.getCDcCs
||_dSrs)rW)r1rWrrr�setPorteszSerialBase.setPortcCs|jSrs�r]r4rrrrBhszSerialBase.writeTimeoutcCs
||_dSrsr�rrrrrrBlscCs|jSrs�rar4rrrrCpszSerialBase.interCharTimeoutcCs
||_dSrsr�)r1rCrrrrCtscCs|��Srs)r�r4rrr�getSettingsDictxszSerialBase.getSettingsDictcCs|�|�dSrs)r�)r1r�rrr�applySettingsDict{szSerialBase.applySettingsDictcCs|jSrs)rDr4rrr�isOpen~szSerialBase.isOpencCs|�|j�S)zL        Read all bytes currently available in the buffer of the OS.
        )r�r�r4rrr�read_all�szSerialBase.read_allcCspt|�}t�}t|j�}|�d�}|rh||7}||d�|krBqh|dur\t|�|kr\qhnqh|��rqhqt|�S)z�        Read until a termination sequence is found ('
' by default), the size
        is exceeded or until timeout occurs.
        rN)r�rr)rLr�r5r)r1�
terminator�sizeZlenterm�liner\�crrr�
read_until�s

zSerialBase.read_untilcos"|j|i|��}|sq|VqdS)zs        Read lines, implemented as generator. It will raise StopIteration on
        timeout (empty read).
        N)r�)r1r�rfr�rrr�iread_until�szSerialBase.iread_until)N)r�)r�)r)r)Frrrr'�	BAUDRATES�FIVEBITS�SIXBITS�	SEVENBITS�	EIGHTBITSrl�PARITY_NONE�PARITY_EVEN�
PARITY_ODD�PARITY_MARK�PARITY_SPACErm�STOPBITS_ONE�STOPBITS_ONE_POINT_FIVE�STOPBITS_TWOrnr2�propertyrW�setterrXrYrbrZr[r\r]rar^r_r`rtrwrxryr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rBrCr�r�r�r��LFr�r�rrrrr:�s�
�
J







































r:�__main__zport name:  {}
zbaud rates: {}
zbyte sizes: {}
zparities:   {}
zstop bits:  {}
z{}
)/�ior9r�	NameError�AttributeError�objectr�strrgrrZXONZXOFFZCRr�r�r�r�r�r�r�r�r�r�r�r�r�ZPARITY_NAMES�IOErrorr%r(ZwriteTimeoutErrorr�r)�	RawIOBaser:r�sys�s�stdout�writerrFr�rlrmrnrrrr�<module>
s^





�	;


© 2025 Cubjrnet7