OwlCyberSecurity - MANAGER
Edit File: protocol.cpython-312.pyc
� Ɠ�g(m � � � d Z ddlZddlZddlmZ ddlmZmZmZm Z m Z ddlmZm Z ddlmZ ddlmZmZ dd lmZ G d � de� Zy)z,Implements the MySQL Client/Server protocol � N)�Decimal� )� FieldFlag� ServerCmd� FieldType� ClientFlag�MAX_MYSQL_TABLE_COLUMNS)�errors�utils)�get_auth_plugin)�PY2� struct_unpack)� get_exceptionc �� � e Zd ZdZd� Zd� Z dd�Z dd�Zd d�Z d!d�Z d � Z d � Zd� Zd"d�Z d � Zd#d�Zd$d�Zd� Zd� Zd� Zd� Zd� Zd$d�Zd� Zd� Zd� Zd� Zd� Z d%d�Zd� Zd� Zy)&� MySQLProtocolzRImplements MySQL client/server protocol Create and parses MySQL packets. c �V � |t j z r|r|j d� dz S y)z.Prepare database string for handshake response�utf8� )r �CONNECT_WITH_DB�encode)�self�client_flags�databases �o/opt/hc_python/lib64/python3.12/site-packages/../../../lib/python3.12/site-packages/mysql/connector/protocol.py�_connect_with_dbzMySQLProtocol._connect_with_db- s) � ��*�4�4�4���?�?�6�*�W�4�4�� c �r � |sy t |� |||||�� }|j � } |t j z r&t | � }t j d|� | z }|S | dz }|S # t t j f$ r2} t j dj t | � � � �d} ~ ww xY w)z#Prepare the authentication responser )�username�passwordr �ssl_enabledzFailed authentication: {0}Nz<B) r � auth_response� TypeErrorr �InterfaceError�ProgrammingError�format�strr �SECURE_CONNECTION�len�struct�pack) r r r r r �auth_plugin� auth_datar �auth�plugin_auth_response�exc�resplenr! s r �_auth_responsezMySQLProtocol._auth_response3 s� � � �� ?�/�?�;�/��!�H�x�'�)�D� $(�#5�#5�#7� � �*�6�6�6��.�/�G�"�K�K��g�6�9M�M�M� �� 1�7�:�M���� �6�0�0�1� ?��)�)�,�3�3�C��H�=�?� ?�� ?�s �&A+ �+B6�-B1�1B6Nc � � |d } | xs |d } |sd} |j d� }t j dj dt |� � � ||||� } | | j ||||| | |� z } | | j ||� z } |t j z r| | j d� d z z } | S # t t f$ r)}t j dj |� � �d}~ww xY w# t $ r |}Y ��w xY w)z"Make a MySQL Authentication packetr, r+ �*Handshake misses authentication info ({0})Nr r z<IIB{filler}{usrlen}sx�xxxxxxxxxxxxxxxxxxxxxxx)�filler�usrlenr )r"