Your IP : 18.227.46.202


Current Path : /opt/cloudlinux/venv/lib64/python3.11/site-packages/packaging/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/packaging/__pycache__/_elffile.cpython-311.pyc

�

��bg�����dZddlZddlZddlZddlmZmZmZGd�de��Z	Gd�dej
��ZGd�d	ej
��ZGd
�dej
��Z
Gd�d
��ZdS)a;
ELF file parser.

This provides a class ``ELFFile`` that parses an ELF executable in a similar
interface to ``ZipFile``. Only the read interface is implemented.

Based on: https://gist.github.com/lyssdod/f51579ae8d93c8657a5564aefc2ffbca
ELF header: https://refspecs.linuxfoundation.org/elf/gabi4+/ch4.eheader.html
�N)�IO�Optional�Tuplec��eZdZdS)�
ELFInvalidN)�__name__�
__module__�__qualname__���I/opt/cloudlinux/venv/lib64/python3.11/site-packages/packaging/_elffile.pyrrs�������Drrc��eZdZdZdZdS)�EIClass��N)rr	r
�C32�C64rrr
rr�������
�C�
�C�C�Crrc��eZdZdZdZdS)�EIDatarrN)rr	r
�Lsb�Msbrrr
rrrrrc�"�eZdZdZdZdZdZdZdS)�EMachine���(�>�N)rr	r
�I386�S390�Arm�X8664�AArc64rrr
rrs'�������D�
�D�
�C��E�
�F�F�Frrc�v�eZdZdZdeeddfd�Zdedee	dffd�Z
edeefd	���Z
dS)
�ELFFilez.
    Representation of an ELF executable.
    �f�returnNc
��||_	|�d��}n"#tj$rt	d���wxYwt|dd���}|dkrt	d|�����|d|_|d|_	ddd	d
d�|j|jf\}|_|_	n.#t$r!t	d|j�d
|j�d����wxYw	|�|��\
}|_}}|_}|_
}|_|_dS#tj$r}t	d��|�d}~wwxYw)N�16Bzunable to parse identification�sELFzinvalid magic: �)z<HHIIIIIHHHz	<IIIIIIII�rrr+)z>HHIIIIIHHHz	>IIIIIIIIr-)z<HHIQQQIHHHz	<IIQQQQQQ�rrr,)z>HHIQQQIHHHz	>IIQQQQQQr.))rr)rr)rr)rrzunrecognized capacity (z) or encoding (�)z/unable to parse machine and section information)�_f�_read�struct�errorr�bytes�capacity�encoding�_p_fmt�_p_idx�KeyError�machine�_e_phoff�flags�_e_phentsize�_e_phnum)�selfr'�ident�magic�e_fmt�_�es       r
�__init__zELFFile.__init__,s������	?��J�J�u�%�%�E�E���|�	?�	?�	?��=�>�>�>�	?�����e�B�Q�B�i� � ���J����8�u�8�8�9�9�9��a���
��a���
�	�
@�?�?�?�	/�/�
�}�d�m�,�/.�+�E�4�;������	�	�	��.�$�-�.�.�!�]�.�.�.���
�	����	W��
�
�5�!�!�
�������
���
���!��
�
�
���|�	W�	W�	W��N�O�O�UV�V�����	W���s,��>�'B3�3+C�"9D�E�,D<�<E�fmt.c��tj||j�tj|������S)N)r2�unpackr0�read�calcsize)r?rFs  r
r1z
ELFFile._readZs,���}�S�$�'�,�,�v��s�/C�/C�"D�"D�E�E�Erc��t|j��D]�}|j�|j|j|zz��	|�|j��}n#tj	$rY�YwxYw||j
ddkr�u|j�||j
d��tj|j�
||j
d�����d��cSdS)zH
        The path recorded in the ``PT_INTERP`` section header.
        rrrr�N)�ranger>r0�seekr;r=r1r7r2r3r8�os�fsdecoderI�strip)r?�index�datas   r
�interpreterzELFFile.interpreter]s���
�4�=�)�)�		O�		O�E��G�L�L����):�U�)B�B�C�C�C�
��z�z�$�+�.�.�����<�
�
�
���
�����D�K��N�#�q�(�(���G�L�L��d�k�!�n�-�.�.�.��;�t�w�|�|�D���Q��,@�A�A�B�B�H�H��N�N�N�N�N��ts�A�A/�.A/)rr	r
�__doc__rr4rE�strr�intr1�propertyrrTrrr
r&r&'s���������,W�"�U�)�,W��,W�,W�,W�,W�\F��F��s�C�x��F�F�F�F���X�c�]�����X���rr&)rU�enumrOr2�typingrrr�
ValueErrorr�IntEnumrrrr&rrr
�<module>r]s4��������	�	�	�	�
�
�
�
�&�&�&�&�&�&�&�&�&�&�	�	�	�	�	��	�	�	������d�l����
�����T�\����
�����t�|����E�E�E�E�E�E�E�E�E�Er

?>