shell bypass 403

Cubjrnet7 Shell


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

t~�`��@sFddlZddlZddlZddlmZddlmZdZGdd�d�ZdS)�N)�ProxySchemeUnsupported)�sixi@c@s�eZdZdZedd��Zd:dd�Zdd	�Zd
d�Zdd
�Z	d;dd�Z
d<dd�Zd=dd�Zd>dd�Z
d?dd�Zd@dd�Zdd�Zdd �ZdAd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�ZdBd6d7�Zd8d9�ZdS)C�SSLTransportaL
    The SSLTransport wraps an existing socket and establishes an SSL connection.

    Contrary to Python's implementation of SSLSocket, it allows you to chain
    multiple TLS connections together. It's particularly useful if you need to
    implement TLS within TLS.

    The class supports most of the socket API operations.
    cCs&t|d�s"tjrtd��ntd��dS)z�
        Raises a ProxySchemeUnsupported if the provided ssl_context can't be used
        for TLS in TLS.

        The only requirement is that the ssl_context provides the 'wrap_bio'
        methods.
        �wrap_biozKTLS in TLS requires SSLContext.wrap_bio() which isn't supported on Python 2zXTLS in TLS requires SSLContext.wrap_bio() which isn't available on non-native SSLContextN)�hasattrrZPY2r)�ssl_context�r�=/usr/lib/python3.9/site-packages/urllib3/util/ssltransport.py�$_validate_ssl_context_for_tls_in_tlss

��z1SSLTransport._validate_ssl_context_for_tls_in_tlsNTcCsHt��|_t��|_||_||_|j|j|j|d�|_|�|jj	�dS)zV
        Create an SSLTransport around socket using the provided ssl_context.
        )�server_hostnameN)
�sslZ	MemoryBIO�incoming�outgoing�suppress_ragged_eofs�socketr�sslobj�_ssl_io_loopZdo_handshake)�selfrrrrrrr	�__init__,s


�zSSLTransport.__init__cCs|S�Nr�rrrr	�	__enter__?szSSLTransport.__enter__cGs|��dSr)�close)r�_rrr	�__exit__BszSSLTransport.__exit__cCs
|j��Sr)r�filenorrrr	rEszSSLTransport.fileno�cCs|�||�Sr)�_wrap_ssl_read)r�len�bufferrrr	�readHszSSLTransport.readrcCs|dkrtd��|�|�S)Nrz+non-zero flags not allowed in calls to recv)�
ValueErrorr)rr�flagsrrr	�recvKszSSLTransport.recvcCs>|dkrtd��|r&|dur&t|�}n|dur2d}|�||�S)Nrz0non-zero flags not allowed in calls to recv_intor)r!rr )rr�nbytesr"rrr	�	recv_intoPs
zSSLTransport.recv_intoc	Cs�|dkrtd��d}t|��f}|�d��<}t|�}||krV|�||d��}||7}q2Wd�n1sj0YWd�n1s�0YdS)Nrz.non-zero flags not allowed in calls to sendall�B)r!�
memoryview�castr�send)r�datar"�count�view�	byte_view�amount�vrrr	�sendallYszSSLTransport.sendallcCs$|dkrtd��|�|jj|�}|S)Nrz+non-zero flags not allowed in calls to send)r!rr�write)rr*r"Zresponserrr	r)cszSSLTransport.send�rc
Cs�t|�hd�kstd|f��d|v}d|vp2|}d|v}d}	|rL|	d7}	|rX|	d7}	t�||	�}
|jjd7_|dur�d	}|d
kr�tj}|d
kr�|s�td��|
S|r�|r�t�|
|
|�}n|r�t�|
|�}nt�	|
|�}|r�|St�
||||�}||_|S)a
        Python's httpclient uses makefile and buffered io when reading HTTP
        messages and we need to support it.

        This is unfortunately a copy and paste of socket.py makefile with small
        changes to point to the socket directly.
        >r2�b�wz&invalid mode %r (only r, w, b allowed)r4r2r3��N���rz!unbuffered streams must be binary)�setr!rZSocketIOZ_io_refs�io�DEFAULT_BUFFER_SIZE�BufferedRWPair�BufferedReader�BufferedWriter�
TextIOWrapper�mode)
rr?�	buffering�encoding�errors�newlineZwritingZreadingZbinaryZrawmode�rawr�textrrr	�makefileis<
zSSLTransport.makefilecCs|�|jj�dSr)rr�unwraprrrr	rG�szSSLTransport.unwrapcCs|j��dSr)rrrrrr	r�szSSLTransport.closeFcCs|j�|�Sr)r�getpeercert)rZbinary_formrrr	rH�szSSLTransport.getpeercertcCs
|j��Sr)r�versionrrrr	rI�szSSLTransport.versioncCs
|j��Sr)r�cipherrrrr	rJ�szSSLTransport.ciphercCs
|j��Sr)r�selected_alpn_protocolrrrr	rK�sz#SSLTransport.selected_alpn_protocolcCs
|j��Sr)r�selected_npn_protocolrrrr	rL�sz"SSLTransport.selected_npn_protocolcCs
|j��Sr)r�shared_ciphersrrrr	rM�szSSLTransport.shared_cipherscCs
|j��Sr)r�compressionrrrr	rN�szSSLTransport.compressioncCs|j�|�dSr)r�
settimeout)r�valuerrr	rO�szSSLTransport.settimeoutcCs
|j��Sr)r�
gettimeoutrrrr	rQ�szSSLTransport.gettimeoutcCs|j��dSr)r�_decref_socketiosrrrr	rR�szSSLTransport._decref_socketiosc
Csbz|�|jj||�WStjy\}z.|jtjkrF|jrFWYd}~dS�WYd}~n
d}~00dS)Nr)rrr r�SSLError�errnoZ
SSL_ERROR_EOFr)rrr�errr	r�szSSLTransport._wrap_ssl_readc
Gs�d}d}|r�d}z||�}WnBtjy^}z(|jtjtjfvrD|�|j}WYd}~n
d}~00|j��}|j�|�|dur�d}q|tjkr|j�	t
�}|r�|j�|�q|j�
�q|S)z>Performs an I/O loop between incoming/outgoing and the socket.TNF)rrSrTZSSL_ERROR_WANT_READZSSL_ERROR_WANT_WRITErr rr0r#�
SSL_BLOCKSIZEr
r1Z	write_eof)r�func�argsZshould_loop�retrTrU�bufrrr	r�s(

zSSLTransport._ssl_io_loop)NT)rN)rr)Nr)r)r)r2NNNN)F)N)�__name__�
__module__�__qualname__�__doc__�staticmethodr
rrrrr r#r%r0r)rFrGrrHrIrJrKrLrMrNrOrQrRrrrrrr	rs:

�



	


�
-

	r)	r9rrZurllib3.exceptionsrZurllib3.packagesrrVrrrrr	�<module>s

© 2025 Cubjrnet7