%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/paramiko/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/paramiko/__pycache__/kex_gex.cpython-312.pyc

�

�ecv(���dZddlZddlmZmZddlmZddlmZddl	m
Z
ddlmZm
Z
mZddlmZed	d
�\ZZZZZed	d
�D�cgc]
}e|���c}\ZZZZZGd�de�ZGd
�de�Zycc}w)z�
Variant on `KexGroup1 <paramiko.kex_group1.KexGroup1>` where the prime "p" and
generator "g" are provided by the server.  A bit more work is required on the
client side, and a **lot** more on the server side.
�N)�sha1�sha256)�util)�DEBUG)�Message)�byte_chr�byte_ord�	byte_mask)�SSHException��#c�X�eZdZdZdZdZdZeZd�Z	dd�Z
d�Zd�Zd	�Z
d
�Zd�Zd�Zd
�Zy)�KexGexz"diffie-hellman-group-exchange-sha1�� ic�t�||_d|_d|_d|_d|_d|_d|_d|_y)NF)�	transport�p�q�g�x�e�f�	old_style)�selfrs  �2/usr/lib/python3/dist-packages/paramiko/kex_gex.py�__init__zKexGex.__init__<s:��"������������������������c�B�|jjr%|jjtt�yt�}|r8|j
t�|j|j�d|_
nf|j
t�|j|j�|j|j�|j|j�|jj|�|jjt�y)NT)r�server_mode�_expect_packet�_MSG_KEXDH_GEX_REQUEST�_MSG_KEXDH_GEX_REQUEST_OLDr�add_byte�c_MSG_KEXDH_GEX_REQUEST_OLD�add_int�preferred_bitsr�c_MSG_KEXDH_GEX_REQUEST�min_bits�max_bits�
_send_message�_MSG_KEXDH_GEX_GROUP)r�_test_old_style�ms   r�	start_kexzKexGex.start_kexFs����>�>�%�%��N�N�)�)�&�(B�
�
�
�I���
�J�J�2�3�
�I�I�d�)�)�*�!�D�N�
�J�J�.�/�
�I�I�d�m�m�$�
�I�I�d�)�)�*�
�I�I�d�m�m�$����$�$�Q�'����%�%�&:�;rc�T�|tk(r|j|�S|tk(r|j|�S|tk(r|j|�S|tk(r|j|�S|tk(r|j|�Sd}t|j|j|���)Nz*KexGex {} asked to handle packet type {:d})
r"�_parse_kexdh_gex_requestr,�_parse_kexdh_gex_group�_MSG_KEXDH_GEX_INIT�_parse_kexdh_gex_init�_MSG_KEXDH_GEX_REPLY�_parse_kexdh_gex_replyr#�_parse_kexdh_gex_request_oldr�format�name)r�ptyper.�msgs    r�
parse_nextzKexGex.parse_next]s����*�*��0�0��3�3�
�*�
*��.�.�q�1�1�
�)�
)��-�-�a�0�0�
�*�
*��.�.�q�1�1�
�0�
0��4�4�Q�7�7�:���3�:�:�d�i�i��7�8�8rc�\�|jdz
dz}tj|d�}t|d�}t	|�}d}|dzs|dz}|dz}|dzs�	tj|�}t|d|�|ddz}tj|d�}|dkDr||kr		||_	y�T)N��r��)
rr�deflate_longr	�len�os�urandomr
�inflate_longr)rr�qnorm�qhbyte�
byte_count�qmask�x_bytesrs        r�_generate_xzKexGex._generate_xms���
�V�V�a�Z�A����!�!�!�Q�'���%��(�#����Z�
����D�=��q�L�F��a�K�E��D�=���j�j��,�G����
�E�2�W�Q�R�[�@�G��!�!�'�1�-�A��A��A��E�����
rc�$�|j�}|j�}|j�}||jkDr|j}||jkr|j}||kDr|}||kr|}||_||_||_|jj�}|�t
d��|jjtdj|||��|j|||�\|_|_t�}|jt�|j!|j�|j!|j�|jj#|�|jj%t&�y)N�-Can't do server-side gex with no modulus packzPicking p ({} <= {} <= {} bits))�get_intr*r)r'r�_get_modulus_packr�_logrr8�get_modulusrrrr$�c_MSG_KEXDH_GEX_GROUP�	add_mpintr+r!r3)rr.�minbits�
preferredbits�maxbits�packs      rr1zKexGex._parse_kexdh_gex_requestsC���)�)�+���	�	��
��)�)�+���4�=�=�(� �M�M�M��4�=�=�(� �M�M�M��]�"�#�G��]�"�#�G���
�+�����
��~�~�/�/�1���<��N�O�O�������-�4�4����
�	
��)�)�'�=�'�J�������I��	�
�
�(�)�	���D�F�F��	���D�F�F�����$�$�Q�'����%�%�&9�:rc�>�|j�|_|j|jkDr|j|_|j|jkr|j|_|jj�}|�t
d��|jjtdj|j��|j|j|j|j�\|_|_t�}|jt�|j!|j�|j!|j�|jj#|�|jj%t&�d|_y)NrNzPicking p (~ {} bits)T)rOr'r*r)rrPrrQrr8rRrrrr$rSrTr+r!r3r)rr.rXs   rr7z#KexGex._parse_kexdh_gex_request_old�s+�� �i�i�k���������.�"&�-�-�D��������.�"&�-�-�D���~�~�/�/�1���<��N�O�O�������*�1�1�$�2E�2E�F�	
��)�)��M�M�4�.�.��
�
�
������
�I��	�
�
�(�)�	���D�F�F��	���D�F�F�����$�$�Q�'����%�%�&9�:���rc��|j�|_|j�|_tj|j�}|dks|dkDrtdj
|���|jjtdj
|��|j�t|j|j|j�|_
t�}|jt �|j#|j�|jj%|�|jj't(�y)Nrrz<Server-generated gex p (don't ask) is out of range ({} bits)zGot server p ({} bits))�	get_mpintrrr�
bit_lengthrr8rrQrrL�powrrrr$�c_MSG_KEXDH_GEX_INITrTr+r!r5)rr.�bitlens   rr2zKexGex._parse_kexdh_gex_group�s���������������������(���T�M�v��}���"�F�6�N��
�	
�����E�#;�#B�#B�6�#J�K������T�V�V�T�V�V�T�V�V�,����I��	�
�
�'�(�	���D�F�F�����$�$�Q�'����%�%�&:�;rc��|j�|_|jdks|j|jdz
kDrtd��|j	�t|j|j|j�|_t|j|j|j�}|jj�j�}t�}|j|jj|jj|jj |jj"|�|j$s|j'|j(�|j'|j*�|j$s|j'|j,�|j/|j�|j/|j�|j/|j�|j/|j�|j/|�|j1|j��j3�}|jj5||�|jj�j7||jj8�}t�}|j;t<�|j?|�|j/|j�|j?|�|jjA|�|jjC�y)Nr>zClient kex "e" is out of range)"r[rrrrLr]rrrr�get_server_key�asbytesr�add�remote_version�
local_version�remote_kex_init�local_kex_initrr&r)r'r*rT�	hash_algo�digest�_set_K_H�
sign_ssh_data�
host_key_typer$�c_MSG_KEXDH_GEX_REPLY�
add_stringr+�_activate_outbound)rr.�K�key�hm�H�sigs       rr4zKexGex._parse_kexdh_gex_init�s,���������F�F�Q�J�D�F�F�T�V�V�a�Z�/��?�@�@������T�V�V�T�V�V�T�V�V�,�������������'���n�n�+�+�-�5�5�7���Y��
����N�N�)�)��N�N�(�(��N�N�*�*��N�N�)�)��	
��~�~��J�J�t�}�}�%�
�
�
�4�&�&�'��~�~��J�J�t�}�}�%�
���T�V�V��
���T�V�V��
���T�V�V��
���T�V�V��
���Q���N�N�2�:�:�<�(�/�/�1��������1�%��n�n�+�+�-�;�;�
�t�~�~�+�+�
��
�I��	�
�
�(�)�	���S��	���D�F�F��	���S�����$�$�Q�'����)�)�+rc���|j�}|j�|_|j�}|jdks|j|jdz
kDrt	d��t|j|j|j�}t�}|j|jj|jj|jj|jj|�|js|j|j �|j|j"�|js|j|j$�|j'|j�|j'|j(�|j'|j*�|j'|j�|j'|�|jj-||j/|j1��j3��|jj5||�|jj7�y)Nr>zServer kex "f" is out of range)�
get_stringr[rrrr]rrrcrrerdrgrfrr&r)r'r*rTrrrjrhrbri�_verify_keyro)rr.�host_keyrtrprrs      rr6zKexGex._parse_kexdh_gex_reply�s����<�<�>���������l�l�n���F�F�Q�J�D�F�F�T�V�V�a�Z�/��?�@�@�����������'���Y��
����N�N�(�(��N�N�)�)��N�N�)�)��N�N�*�*��	
��~�~��J�J�t�}�}�%�
�
�
�4�&�&�'��~�~��J�J�t�}�}�%�
���T�V�V��
���T�V�V��
���T�V�V��
���T�V�V��
���Q��������4�>�>�"�*�*�,�#?�#F�#F�#H�I����"�"�8�S�1����)�)�+rN)F)�__name__�
__module__�__qualname__r9r)r*r'rrhrr/r<rLr1r7r2r4r6�rrrr4sJ��/�D��H��H��N��I��<�.9� �$$;�L�6<�(),�V,rrc��eZdZdZeZy)�KexGexSHA256z$diffie-hellman-group-exchange-sha256N)ryrzr{r9rrhr|rrr~r~s��1�D��Irr~)�__doc__rD�hashlibrr�paramikor�paramiko.commonr�paramiko.messager�paramiko.py3compatrr	r
�paramiko.ssh_exceptionr�ranger#r,r3r5r"r%rSr^rmr(�objectrr~)�cs0r�<module>r�s���&�
� ��!�$�<�<�/�
�"�b�M�
������ ��B�-�(�Q�X�a�[�(�
������h,�V�h,�V�6���])s�A:

Zerion Mini Shell 1.0