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

M�]W@#�@s�ddlZddlZddlZyddlZWnek
rBddljZYnXdd�Zdd�ZGdd�de	�Z
Gdd	�d	e	�ZGd
d�dej�Ze
dkr�ed�Zd
e_ee�dS)�Nccs�d}xrtj|�D]d}djt|��d|ko2dknrB|jd�ndfV|d7}|dkrbdVq|dkrdVd}qW|dkr�x(|dkr�|d7}|dkr�dVdVq�WdVdS)z�    yield tuples of hex and ASCII display in multiples of 16. Includes a
    space after 8 bytes and (None, None) after 16 bytes and at the end.
    rz{:02X} � ��ascii�.��� ��N�   )rr	)NN)rr	)rr)NN)�serialZ	iterbytes�format�ord�decode)�data�n�b�r�"/usr/lib/python3.6/protocol_spy.py�sixteen"s 6

rccs�g}g}d}xnt|�D]b\}}|dkrd|djdj|�dj|�g�fV|dd�=|dd�=|d7}q|j|�|j|�qWdS)z yield lines with hexdump of datarNrr	r
)r�join�append)r�valuesr�offset�h�arrr�hexdump9s 



rc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�	FormatRawz&Forward only RX and TX data to output.cCs||_||_d|_d|_dS)Nzz)�output�color�rx_color�tx_color)�selfrrrrr�__init__LszFormatRaw.__init__cCs.|jr|jj|j�|jj|�|jj�dS)zshow received dataN)rr�writer �flush)r"rrrr�rxRszFormatRaw.rxcCs.|jr|jj|j�|jj|�|jj�dS)zshow transmitted dataN)rrr$r!r%)r"rrrr�txYszFormatRaw.txcCsdS)z(do not) show control callsNr)r"�name�valuerrr�control`szFormatRaw.controlN)�__name__�
__module__�__qualname__�__doc__r#r&r'r*rrrrrIs
rc@s:eZdZdZdd�Zddd�Zdd�Zd	d
�Zdd�Zd
S)�
FormatHexdumpax    Create a hex dump of RX ad TX data, show when control lines are read or
    written.

    output example::

        000000.000 Q-RX flushInput
        000002.469 RTS  inactive
        000002.773 RTS  active
        000003.001 TX   48 45 4C 4C 4F                                    HELLO
        000003.102 RX   48 45 4C 4C 4F                                    HELLO

    cCs,tj�|_||_||_d|_d|_d|_dS)Nzzz)�time�
start_timerrr r!�
control_color)r"rrrrrr#ts
zFormatHexdump.__init__r	cCs&|jjdj||||��|jj�dS)Nz{:010.3f} {:4} {}{}
)rr$r
r%)r"Z	timestampZlabelr)Zvalue2rrr�
write_line|szFormatHexdump.write_linecCsl|jr|jj|j�|rPxNt|�D](\}}|jtj�|jddj|�|�q"Wn|jtj�|jdd�dS)zshow received data as hex dumpZRXz{:04X}  z<empty>N)	rrr$r rr3r0r1r
)r"rr�rowrrrr&�s&zFormatHexdump.rxcCsN|jr|jj|j�x4t|�D](\}}|jtj�|jddj|�|�qWdS)z!show transmitted data as hex dumpZTXz{:04X}  N)	rrr$r!rr3r0r1r
)r"rrr4rrrr'�szFormatHexdump.txcCs0|jr|jj|j�|jtj�|j||�dS)zshow control callsN)rrr$r2r3r0r1)r"r(r)rrrr*�szFormatHexdump.controlN)r	)	r+r,r-r.r#r3r&r'r*rrrrr/es


r/csTeZdZdZ�fdd�Zejjjdd��Zdd�Z	�fdd	�Z
d,�fdd�	Zeejd
�rd�fdd�Z
eejd�r|�fdd�Ze�fdd��Z�fdd�Z�fdd�Z�fdd�Zd-�fdd�	Zejjjdd��Zejjjd d!��Zejjjd"d#��Zejjj�fd$d%��Zejjj�fd&d'��Zejjj�fd(d)��Zejjj�fd*d+��Z�ZS).�Serialzc    Inherit the native Serial port implementation and wrap all the methods and
    attributes.
    cs"tt|�j||�d|_d|_dS)NF)�superr5r#�	formatter�show_all)r"�args�kwargs)�	__class__rrr#�szSerial.__init__cCs"|dk	rtjjj||j|��dS)N)rr5�port�__set__�from_url)r"r)rrrr<�szSerial.portc	Cs�tj|�}|jdkr&tjdj|j���t}d}tj}yvxptj	|j
d�j�D]Z\}}|dkrjt|dd�}qJ|dkrxd}qJ|d	kr�t
}qJ|d
kr�d|_qJtdj|���qJWWn2tk
r�}ztjdj|���WYd
d
}~XnX|||�|_dj|j|jg�S)z(extract host and port from an URL stringZspyzmexpected a string in the form "spy://port[?option[=value][&option[=value]]]": not starting with spy:// ({!r})FT�filer�wr�raw�allzunknown option: {!r}zPexpected a string in the form "spy://port[?option[=value][&option[=value]]]": {}Nr	)�urlparseZurlsplit�schemerZSerialExceptionr
r/�sys�stderrZparse_qsZquery�items�openrr8�
ValueErrorr7rZnetloc�path)	r"Zurl�partsr7rrZoptionr�errrr>�s2


zSerial.from_urlcs|jj|�tt|�j|�S)N)r7r'r6r5r$)r"r')r;rrr$�szSerial.writercs*tt|�j|�}|s|jr&|jj|�|S)N)r6r5�readr8r7r&)r"�sizer&)r;rrrM�s
zSerial.read�cancel_readcs |jjdd�tt|�j�dS)NzQ-RXrO)r7r*r6r5rO)r")r;rrrO�szSerial.cancel_read�cancel_writecs |jjdd�tt|�j�dS)NzQ-TXrP)r7r*r6r5rP)r")r;rrrP�szSerial.cancel_writecs*tt|�j}|jr&|jjddj|��|S)NzQ-RXzin_waiting -> {})r6r5�
in_waitingr8r7r*r
)r"r)r;rrrQ�szSerial.in_waitingcs |jjdd�tt|�j�dS)NzQ-TXr%)r7r*r6r5r%)r")r;rrr%�szSerial.flushcs |jjdd�tt|�j�dS)NzQ-RX�reset_input_buffer)r7r*r6r5rR)r")r;rrrR�szSerial.reset_input_buffercs |jjdd�tt|�j�dS)NzQ-TX�reset_output_buffer)r7r*r6r5rS)r")r;rrrS�szSerial.reset_output_buffer��?cs(|jjddj|��tt|�j|�dS)N�BRKzsend_break {}s)r7r*r
r6r5�
send_break)r"Zduration)r;rrrV�szSerial.send_breakcCs*|jjd|rdnd�tjjj||�dS)NrU�active�inactive)r7r*rr5�break_conditionr=)r"�levelrrrrY�szSerial.break_conditioncCs*|jjd|rdnd�tjjj||�dS)NZRTSrWrX)r7r*rr5�rtsr=)r"rZrrrr[�sz
Serial.rtscCs*|jjd|rdnd�tjjj||�dS)NZDTRrWrX)r7r*rr5�dtrr=)r"rZrrrr\�sz
Serial.dtrcs&tt|�j}|jjd|rdnd�|S)NZCTSrWrX)r6r5�ctsr7r*)r"rZ)r;rrr]sz
Serial.ctscs&tt|�j}|jjd|rdnd�|S)NZDSRrWrX)r6r5�dsrr7r*)r"rZ)r;rrr^sz
Serial.dsrcs&tt|�j}|jjd|rdnd�|S)NZRIrWrX)r6r5�rir7r*)r"rZ)r;rrr_sz	Serial.rics&tt|�j}|jjd|rdnd�|S)NZCDrWrX)r6r5�cdr7r*)r"rZ)r;rrr`sz	Serial.cd)r)rT)r+r,r-r.r#rr5r<�setterr>r$rM�hasattrrOrP�propertyrQr%rRrSrVrYr[r\r]�getterr^r_r`�
__classcell__rr)r;rr5�s,r5�__main__zspy:///dev/ttyS0)rEr0rrC�ImportErrorZurllib.parse�parserr�objectrr/r5r+Zserr<�printrrrr�<module>s 3

Youez - 2016 - github.com/yon3zu
LinuXploit