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_socket.cpython-36.pyc
3

M�]W�+�
@sddlZddlZddlZddlZddlZyddlZWnek
rRddljZYnXddl	m
Z
mZmZm
Z
ejejejejd�ZdZGdd�de
�Zedkr�ddlZed�Zejjd	je��ejjd
�ejd�ej�ejjdjejd���ej�dS)
�N)�
SerialBase�SerialException�portNotOpenError�to_bytes)�debug�infoZwarning�error�c@s�eZdZdZd:Zdd�Zdd�Zdd�Zdd�Ze	dd��Z
d;dd�Zd d!�Zd"d#�Z
d$d%�Zd<d'd(�Zd)d*�Zd+d,�Zd-d.�Ze	d/d0��Ze	d1d2��Ze	d3d4��Ze	d5d6��Zd7d8�Zd9S)=�Serialz-Serial port implementation for plain sockets.�2�K�n�����,�X���`	��%�K������cCs�d|_|jdkrtd��|jr&td��ytj|j|j�td�|_	Wn:t
k
r|}zd|_	tdj|j|���WYdd}~XnX|j�d|_|j
s�|j�|js�|j�|j�|j�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.)�timeoutzCould not open port {}: {}T)�loggerZ_portr�is_open�socketZcreate_connection�from_urlZportstr�POLL_TIMEOUT�_socket�	Exception�format�_reconfigure_portZ_dsrdtr�_update_dtr_stateZ_rtscts�_update_rts_state�reset_input_buffer�reset_output_buffer)�self�msg�r,�%/usr/lib/python3.6/protocol_socket.py�open0s$
$zSerial.opencCs(|jdkrtd��|jr$|jjd�dS)zz        Set communication parameters on opened port. For the socket://
        protocol all settings are ignored!
        NzCan only operate on open portsz!ignored port configuration change)r"rrr)r*r,r,r-r%Ls
zSerial._reconfigure_portc	CsP|jrL|jr<y|jjtj�|jj�WnYnXd|_d|_tjd�dS)z
Close portNFg333333�?)rr"ZshutdownrZ	SHUT_RDWR�close�timeZsleep)r*r,r,r-r/VszSerial.closecCs�tj|�}|jdkr$tdj|j���y�xjtj|jd�j�D]T\}}|dkr�tj	�tj
d�|_|jjt
|d�|jjd�q:tdj|���q:Wd|jko�d	kns�td
��Wn0tk
r�}ztdj|���WYdd}~XnX|j|jfS)
z(extract host and port from an URL stringrzexpected a string in the form "socket://<host>:<port>[?logging={debug|info|warning|error}]": not starting with socket:// ({!r})T�loggingzpySerial.socketrzenabled loggingzunknown option: {!r}izport not in range 0...65535z_expected a string in the form "socket://<host>:<port>[?logging={debug|info|warning|error}]": {}N)�urlparseZurlsplit�schemerr$Zparse_qsZquery�itemsr1ZbasicConfigZ	getLoggerrZsetLevel�
LOGGER_LEVELSr�
ValueErrorZportZhostname)r*Zurl�partsZoption�values�er,r,r-r es(


zSerial.from_urlcCs,|js
t�tj|jgggd�\}}}t|�S)z9Return the number of bytes currently in the input buffer.r)rr�selectr"�len)r*ZlrZlwZlxr,r,r-�
in_waiting�szSerial.in_waiting�c	Cst|js
t�t�}|j}�xRt|�|k�rjyxtj�}tj|jggg|�\}}}|sRP|jj|t|��}|srt	d��|j
|�|dk	r�|tj�|8}|dkr�PWqtjk
r�Yqtj
k
r�}zt	dj|���WYdd}~Xqtk
�r$}z"|jtjk�rt	dj|���WYdd}~Xqtj
k
�rf}z$|dtjk�rVt	dj|���WYdd}~XqXqWt|�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.
        zsocket disconnectedNrzconnection failed ({})zread failed: {})rr�	bytearrayZ_timeoutr;r0r:r"Zrecvr�extendrrrr$�OSError�errnoZEAGAIN�bytes)	r*�size�readrZ
start_timeZready�_Zbufr9r,r,r-rD�s:
$zSerial.readcCsZ|js
t�y|jjt|��Wn2tjk
rP}ztdj|���WYdd}~XnXt	|�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.
        zsocket connection failed: {}N)
rrr"Zsendallrrrrr$r;)r*�datar9r,r,r-�write�s zSerial.writecCs |js
t�|jr|jjd�dS)z9Clear input buffer, discarding all that is in the buffer.zignored reset_input_bufferN)rrrr)r*r,r,r-r(�szSerial.reset_input_buffercCs |js
t�|jr|jjd�dS)zs        Clear output buffer, aborting the current output and
        discarding all that is in the buffer.
        zignored reset_output_bufferN)rrrr)r*r,r,r-r)�szSerial.reset_output_buffer��?cCs&|js
t�|jr"|jjdj|��dS)za        Send break condition. Timed, returns to idle state after given
        duration.
        zignored send_break({!r})N)rrrrr$)r*Zdurationr,r,r-�
send_break�szSerial.send_breakcCs|jr|jjdj|j��dS)zJSet break: Controls TXD. When active, to transmitting is
        possible.z!ignored _update_break_state({!r})N)rrr$Z_break_state)r*r,r,r-�_update_break_state�szSerial._update_break_statecCs|jr|jjdj|j��dS)z)Set terminal status line: Request To Sendzignored _update_rts_state({!r})N)rrr$Z
_rts_state)r*r,r,r-r'�szSerial._update_rts_statecCs|jr|jjdj|j��dS)z-Set terminal status line: Data Terminal Readyzignored _update_dtr_state({!r})N)rrr$Z
_dtr_state)r*r,r,r-r&�szSerial._update_dtr_statecCs |js
t�|jr|jjd�dS)z(Read terminal status line: Clear To Sendzreturning dummy for ctsT)rrrr)r*r,r,r-�cts�s
z
Serial.ctscCs |js
t�|jr|jjd�dS)z)Read terminal status line: Data Set Readyzreturning dummy for dsrT)rrrr)r*r,r,r-�dsrs
z
Serial.dsrcCs |js
t�|jr|jjd�dS)z)Read terminal status line: Ring Indicatorzreturning dummy for riF)rrrr)r*r,r,r-�ris
z	Serial.ricCs |js
t�|jr|jjd�dS)z)Read terminal status line: Carrier Detectzreturning dummy for cd)T)rrrr)r*r,r,r-�cds
z	Serial.cdcCs
|jj�S)z@Get the file handle of the underlying socket for use with select)r"�fileno)r*r,r,r-rO!sz
Serial.filenoN)rrr
rrrrrrrrrrrrrr)r=)rH)�__name__�
__module__�__qualname__�__doc__Z	BAUDRATESr.r%r/r �propertyr<rDrGr(r)rIrJr'r&rKrLrMrNrOr,r,r,r-r
*s*

1


			r
�__main__zsocket://localhost:7000z{}
z	write...
shello
z	read: {}
)rAr1r:rr0r2�ImportErrorZurllib.parse�parseZserial.serialutilrrrr�DEBUG�INFOZWARNINGZERRORr5r!r
rP�sys�s�stdoutrGr$�flushrDr/r,r,r,r-�<module>s4



Youez - 2016 - github.com/yon3zu
LinuXploit