403Webshell
Server IP : 54.37.205.81  /  Your IP : 216.73.216.76
Web Server : nginx/1.22.1
System : Linux vps-249481fa 6.1.0-50-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.176-1 (2026-07-02) x86_64
User : debian ( 1000)
PHP Version : 8.2.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/lib/python3/dist-packages/PIL/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3/dist-packages/PIL/__pycache__/ImageFile.cpython-311.pyc
�

�"�c�[��H�ddlZddlZddlZddlZddlmZddlmZdZdZ	dZ
	dd	d
ddd
�Z	d�Zd�Z
Gd�dej��ZGd�de��ZGd�d��Zd!d�Zd"d�Zd�ZGd�d��ZGd�d��ZGd�de��ZGd�d e��ZdS)#�N�)�Image)�is_pathiiFzimage buffer overrun errorzdecoding errorz
unknown errorzbad configurationzout of memory error)������������i����c���	tj�|��}n*#t$rt�|��}YnwxYw|sd|��}|dz
}t
|���)Nzdecoder error z when reading image file)r�core�getcodecstatus�AttributeError�ERRORS�get�OSError)�error�msgs  �//usr/lib/python3/dist-packages/PIL/ImageFile.py�
raise_oserrorr@sz�� ��j�'�'��.�.����� � � ��j�j������� �����'�&�u�&�&���%�%�C�
�#�,�,�s�"�$A	�A	c��|dS)N��)�ts r�	_tilesortrKs���Q�4�K�c�R��eZdZdZd�fd�	Zd�Z�fd�Zd�Zd�Zd�Z	d	�Z
d
�Z�xZS)�	ImageFilez*Base class for image file format handlers.Nc���t�����d|_d|_d|_	d|_d|_t|_t|��r$t|d��|_||_d|_
n||_||_d|_
		|���n@#tt t"t$t&jf$r}t+|��|�d}~wwxYw|jr"|jddks|jddkrd}t+|���dS#t0$r"|j
r|j����wxYw)Nrrr�rbTznot identified by this driver)�super�__init__�
_min_frame�custom_mimetype�tile�readonly�
decoderconfig�MAXBLOCK�decodermaxblockr�open�fp�filename�
_exclusive_fp�_open�
IndexError�	TypeError�KeyError�EOFError�structr�SyntaxError�mode�size�
BaseException�close)�selfr)r*�vr�	__class__s     �rr zImageFile.__init__Xsm���
�����������#�����	�7���
����'����2�;�;�
	&��2�t�n�n�D�G��D�M�!%�D����D�G�$�D�M�!%�D��	�	
,��
�
�������������
,�
,�
,�"�!�n�n�!�+�����
,�����9�
'��	�!��� 1� 1�T�Y�q�\�Q�5F�5F�5��!�#�&�&�&�6G�5F���	�	�	��!�
 ���
�
�����		���s*�B1�0D-�1(C.�C)�)C.�.=D-�-,Ec��|jr|jS|j�6tj�|j�����SdS�N)r"�formatr�MIMEr�upper�r7s r�get_format_mimetypezImageFile.get_format_mimetype�sH����	(��'�'��;�"��:�>�>�$�+�"3�"3�"5�"5�6�6�6�#�"rc�X��g|_t���|��dSr;)r#r�__setstate__)r7�stater9s  �rrBzImageFile.__setstate__�s(�����	�
�����U�#�#�#�#�#rc�T�|jr|j���d|_dS)zCheck file integrityN)r+r)r6r?s r�verifyzImageFile.verify�s)��
��	��G�M�M�O�O�O�����rc�l	�|j�d}t|���tj�|��}|js|Sd|_|jot
|j��dk}|ottd��}d}	|j	}d}n#t$r|jj}YnwxYw	|j
}d}n#t$r|jj}YnwxYw|�r`|jd\}}}	}
|dk�rGt
|
��dk�r3|
d|jk�r!|
dtjv�r	ddl}t%|j��5}|�|���d|j�	��|_ddd��n#1swxYwY|	|jd|
dzz|j���krt�tj�|j|j||	|
��|_d}|jrd|j_n$#ttt6f$r
d|_YnwxYw|���d
}
|j�s�|j�t<���	|j}n#t$rd}YnwxYwd
�tAj!|jd���D��|_|jD�]f\}}}	}
||	��tj"|j||
|j#��}	|�$|j|��|j%r6|�&|j��|�'d��d}
n�|}		||j(��}n<#tRtTj+f$r#}tXrYd}~nud}t|��|�d}~wwxYw|s*tXrnQdt
|���d�}t|���||z}|�'|��\}}
|dkrn||d�}��|�-����O#|�-��wxYwg|_||_.|�/��|j0r |j1r|j�2��d|_|jstXs|
dkrtg|
��tj�|��S)z"Load image data based on tile listNzcannot load this imager�pypy_version_inforF�raw�)�accessr��keyrc�>�g|]\}}t|��d��S)r)�list)�.0�_�tiless   r�
<listcomp>z"ImageFile.load.<locals>.<listcomp>�s6������A�u��U���B����rc�0�|d|d|dfS)NrrrIr)r#s r�<lambda>z ImageFile.load.<locals>.<lambda>�s��T�!�W�d�1�g�t�A�w�,G�rTzimage file is truncatedzimage file is truncated (z bytes not processed))4r#rr�load�mapr*�len�hasattr�sys�	load_readr
r)�read�	load_seek�seekr3�	_MAPMODES�mmapr(�fileno�ACCESS_READr4r�
map_buffer�im�palette�dirty�ImportError�load_prepare�sortr�tile_prefix�	itertools�groupby�_getdecoderr%�setimage�pulls_fd�setfd�decoder'r-r1r�LOAD_TRUNCATED_IMAGES�cleanupr$�load_endr+�!_close_exclusive_fp_after_loadingr6r)r7r�pixel�use_mmapr$r[r]�decoder_name�extents�offset�argsr_r)�err_code�prefix�decoder�b�s�e�ns                    rrUzImageFile.load�sw���9��*�C��#�,�,���� � ��&�&���y�	��L�����=�8�S���^�^�q�%8���E�G�C�1D�$E�$E� E����	 ��>�D��H�H���	 �	 �	 ��7�<�D�D�D�	 ����	 ��>�D��H�H���	 �	 �	 ��7�<�D�D�D�	 �����	$�26�)�A�,�/�L�'�6�4���%�%���I�I��N�N���G�t�y�(�(���G�u��.�.�$��K�K�K��d�m�,�,�V��#'�9�9�R�Y�Y�[�[�!�D�DT�9�#U�#U���V�V�V�V�V�V�V�V�V�V�V����V�V�V�V���	�!��t�A�w� 6�6�������H�H�%�
�#�j�3�3���$�)�\�6�4���D�G� !�H��|�/�-.���*���&���=�$�$�$�#�D�H�H�H�$����	
���������x�9	&��I�N�N�y�N�)�)�)�
��)����!�
�
�
�����
������ )� 1��I�G�G�!�!����D�I�8<�y�(
&�(
&�3��g�v�t���V�����+��I�|�T�4�3E����#&��$�$�T�W�g�6�6�6��'�&��
�
�d�g�.�.�.�#*�>�>�#�#6�#6�q�#9���"��&�>�$(�D��)=�$>�$>����$.���#=�>�>�>�#8�!>�$)�E�E�E�E�*C�C�*1�#�,�,�A�$=�����
>����$%�7�#8�!7�$)�)J�,/��F�F�)J�)J�)J�%(�+2�#�,�,�$6� !�A��A�*1�.�.��*;�*;�K�A�x� �1�u�u� %� !�!�"�"��A�3&�8�O�O�%�%�%�%��G�O�O�%�%�%�%������	� ��
��
�
������	�$�"H�	��G�M�M�O�O�O�����x�	$� 5�	$�(�Q�,�,��(�#�#�#��{����%�%�%s��	B�B%�$B%�)	B3�3C�C�'H�?5F�4H�F�H�F�BH�H/�.H/�1I9�9J�J�1AP�
M�P�N�4N�;P�N�N�AP�P!c��|jr*|jj|jks|jj|jkr/tj�|j|j��|_|jdkr!tj�|��dSdS)N�P)rcr3r4rr�newrUr?s rrgzImageFile.load_prepare$sx���w�	;�$�'�,�$�)�3�3�t�w�|�t�y�7P�7P��j�n�n�T�Y��	�:�:�D�G��9�����K���T�"�"�"�"�"��rc��dSr;rr?s rrszImageFile.load_end,s���rc��||jks*t|d��r|j�$||j|jzkrd}t	|���|���|kS)N�	_n_framesz attempt to seek outside sequence)r!rXr��n_framesr0�tell)r7�framers   r�_seek_checkzImageFile._seek_check8sg���D�O�#�#��T�;�/�/�	
$�59�N�4J��T�]�T�_�<�<�<�5�C��3�-�-���y�y�{�{�e�#�#r)NN)
�__name__�
__module__�__qualname__�__doc__r r@rBrErUrgrsr��
__classcell__)r9s@rrrUs��������4�4�.�.�.�.�.�.�`7�7�7�$�$�$�$�$����G&�G&�G&�R#�#�#�
�
�
�
$�
$�
$�
$�
$�
$�
$rrc�$�eZdZdZd�Zd�Zd�ZdS)�
StubImageFilez�
    Base class for stub image loaders.

    A stub loader is an image loader that can identify files of a
    certain format, but relies on external code to load the file.
    c�$�d}t|���)Nz+StubImageFile subclass must implement _open��NotImplementedError�r7rs  rr,zStubImageFile._openPs��;��!�#�&�&�&rc���|���}|�d|j�d�}t|���|�|��}|�J�|j|_|j|_|���S)Nzcannot find loader for this z file)�_loadr<rrUr9�__dict__)r7�loaderr�images    rrUzStubImageFile.loadTso���������>�C���C�C�C�C��#�,�,�����D�!�!��� � � ��������
��z�z�|�|�rc�$�d}t|���)z (Hook) Find actual image loader.z+StubImageFile subclass must implement _loadr�r�s  rr�zStubImageFile._load`s��;��!�#�&�&�&rN)r�r�r�r�r,rUr�rrrr�r�HsK��������'�'�'�
�
�
�'�'�'�'�'rr�c�H�eZdZdZdZdZdZdZdZdZ	d�Z
d�Zd�Zd�Z
d�ZdS)	�Parserzj
    Incremental image parser.  This class implements the standard
    feed/close consumer interface.
    Nrc�(�|j�
Jd���dS)z�
        (Consumer) Reset the parser.  Note that you can only call this
        method immediately after you've created a parser; parser
        instances cannot be reused.
        Nzcannot reuse parsers)�datar?s r�resetzParser.resetss!���y� � �"8� � � � � rc���|jrdS|j�||_n|j|z|_|jr�|jdkr^t	t|j��|j��}|j|d�|_|j|z
|_|jdks|jsdS|j�|j��\}}|dkr-d|_d|_|dkrd|_t|��ndS|j|d�|_dS|jrdS	tj
|j��5}tj|��}ddd��n#1swxYwYt|d��pt|d��}|st|j��dkrd|_n�|���|jd\}}}	}
g|_tj|j||
|j��|_|j�|j|��|	|_|jt|j��kr |j|jd�|_d|_||_dS#t*$rYdSwxYw)z�
        (Consumer) Feed data to the parser.

        :param data: A string buffer.
        :exception OSError: If the parser failed to parse the image file.
        Nrrr\rZ)�finishedr�r}ry�minrWrpr�r�io�BytesIOrr(rXr#rgrlr3r%rmrcr)r7r��skipr�r�r)rc�flag�d�o�as           r�feedzParser.feed{s����=�	��F��9���D�I�I��	�D�(�D�I��<�<	 ��{�Q����3�t�y�>�>�4�;�7�7�� �I�d�e�e�,��	�"�k�D�0����;��?�?�$�)�?��F��<�&�&�t�y�1�1�D�A�q��1�u�u� ��	� !��
��q�5�5�!%�D�J�!�!�$�$�$�$��F��	�!�"�"�
�D�I�I�I�
�Z�#	 �

�D�

 ��Z��	�*�*�(�b���B���B�(�(�(�(�(�(�(�(�(�(�(����(�(�(�(��r�;�/�/�K�7�2�{�3K�3K���(�3�r�w�<�<�1�,�,�"&�D�K�K��O�O�%�%�%�!#����J�A�q�!�Q� �B�G�#(�#4�R�W�a��B�DT�#U�#U�D�L��L�)�)�"�%��3�3�3�#$�D�K��{�c�$�)�n�n�4�4�$(�I�d�k�m�m�$<��	�&'�����
�
�
��-�
�
�
����
���s6�
I�&E�;I�E�I�E�I�
I"�!I"c��|Sr;rr?s r�	__enter__zParser.__enter__�s���rc�.�|���dSr;)r6�r7rzs  r�__exit__zParser.__exit__�s���
�
�����rc���|jr;|�d��dx|_|_|jsd}t	|���|jsd}t	|���|jr�t
j|j��5}	tj	|��|_|j�
��n#|j�
��wxYw	ddd��n#1swxYwY|jS)a
        (Consumer) Close the stream.

        :returns: An image object.
        :exception OSError: If the parser failed to parse the image file either
                            because it cannot be identified or cannot be
                            decoded.
        rNzimage was incompletezcannot parse this image)r}r�r�r�rr�r�r�rr(rU)r7rr)s   rr6zParser.close�s���<�	#��I�I�c�N�N�N�'+�+�D�I����=�
#�,���c�l�l�"��z�	�+�C��#�,�,���9�	&���D�I�&�&�
&�"�&�!&��B���D�J��J�O�O�%�%�%�%��D�J�O�O�%�%�%�%����%�	
&�
&�
&�
&�
&�
&�
&�
&�
&�
&�
&����
&�
&�
&�
&�
�z�s*�;C�=B0�C�0C�C�C�"C)r�r�r�r��incrementalr�r�r}ryr�r�r�r�r�r6rrrr�r�fs���������
�K��E��D��G�
�F��H�9�9�9�N �N �N �`����������rr�c	��|���t|d��sd|_|�t���tt||jddz��}	|���}|�	��t|||||��n7#ttj
f$r}t||||d|��Yd}~nd}~wwxYwt|d��r|�	��dSdS)z�Helper to save image based on tile list

    :param im: Image object.
    :param fp: File object.
    :param tile: Tile list.
    :param bufsize: Optional buffer size
    �
encoderconfigrrKr�N�flush)rUrXr�rhr�maxr&r4r`r��_encode_tiler
r��UnsupportedOperation)rcr)r#�bufsize�fh�excs      r�_saver��s���G�G�I�I�I��2��'�'������I�I�)�I����
�(�G�R�W�Q�Z�!�^�4�4�G�7�
�Y�Y�[�[��
���
�
�
��R��T�7�B�/�/�/�/���B�3�4�7�7�7��R��T�7�D�#�6�6�6�6�6�6�6�6�����7�����r�7����
���
�
�
�
�
��s�,;B(�(C�>C�Cc�b�|D�]*\}}}}	|dkr|�|��tj|j||	|j��}
	|
�|j|��|
jr-|
�|��|
�	��\}}nL|r4	|
�
|��\}}}
|�|
��|rn�2n|
�||��}|dkrd|�d�}t|��|�	|
�����#|
���wxYwdS)NrTzencoder error z when writing image file)r]r�_getencoderr3r�rmrc�	pushes_fdro�encode_to_pyfd�encode�write�encode_to_filerrr)rcr)r#r�r�r�r�r~r�r��encoder�lrr�rs               rr�r�s]�����
��1�a���q�5�5��G�G�A�J�J�J��#�B�G�Q��2�3C�D�D��	����R�U�A�&�&�&�� �

<��
�
�b�!�!�!��-�-�/�/���1�1��	<�"�")�.�.��"9�"9���1�a���������"�!�	"�"� �.�.�r�7�;�;�A��1�u�u�B�q�B�B�B���c�l�l��+��
�O�O������G�O�O��������1�s
�B7D�D,c���|dkrdS|tkr;|�|��}t|��|krd}t|���|Sg}|}|dkrX|�t	|t����}|sn-|�|��|t|��z}|dk�Xt
d�|D����|krd}t|���d�|��S)a�
    Reads large blocks in a safe way.  Unlike fp.read(n), this function
    doesn't trust the user.  If the requested size is larger than
    SAFEBLOCK, the file is read block by block.

    :param fp: File handle.  Must implement a <b>read</b> method.
    :param size: Number of bytes to read.
    :returns: A string containing <i>size</i> bytes of data.

    Raises an OSError if the file is truncated and the read cannot be completed

    rrzTruncated File Readc3�4K�|]}t|��V��dSr;)rW)rOr�s  r�	<genexpr>z_safe_read.<locals>.<genexpr>Hs(����
 �
 �a�3�q�6�6�
 �
 �
 �
 �
 �
 r)�	SAFEBLOCKr[rWrr��append�sum�join)r)r4r�r�remaining_size�blocks      r�
_safe_readr�+s���q�y�y��s��y����w�w�t�}�}���t�9�9�t���'�C��#�,�,����
�D��N�
�1�
�
�����N�I�6�6�7�7���	�����E�����#�e�*�*�$���1�
�
��
 �
 �4�
 �
 �
 � � �4�'�'�#���c�l�l���8�8�D�>�>�rc��eZdZd�Zd�ZdS)�PyCodecStatec�>�d|_d|_d|_d|_dS)Nr)�xsize�ysize�xoff�yoffr?s rr zPyCodecState.__init__Os"����
���
���	���	�	�	rc�V�|j|j|j|jz|j|jzfSr;)r�r�r�r�r?s rrxzPyCodecState.extentsUs'���y�$�)�T�Y���%;�T�Y���=S�S�SrN)r�r�r�r rxrrrr�r�Ns7���������T�T�T�T�Trr�c�.�eZdZd�Zd�Zd�Zd�Zdd�ZdS)�PyCodecc��d|_t��|_d|_||_|�|��dSr;)rcr�rC�fdr3�init)r7r3rzs   rr zPyCodec.__init__Zs5�����!�^�^��
������	��	�	�$�����rc��||_dS)z�
        Override to perform codec specific initialization

        :param args: Array of args items from the tile entry
        :returns: None
        N)rzr�s  rr�zPyCodec.initas����	�	�	rc��dS)zT
        Override to perform codec specific cleanup

        :returns: None
        Nrr?s rrrzPyCodec.cleanupjs	��	
�rc��||_dS)z�
        Called from ImageFile to set the Python file-like object

        :param fd: A Python file-like object
        :returns: None
        N)r�)r7r�s  rroz
PyCodec.setfdrs������rNc�:�||_|r|\}}}}nd\}}}}|dkr*|dkr$|jj\|j_|j_n6||j_||j_||z
|j_||z
|j_|jjdks|jjdkrd}t|���|jj|jjz|jjdks-|jj|jjz|jjdkrd}t|���dS)z�
        Called from ImageFile to set the core output image for the codec

        :param im: A core image object
        :param extents: a 4 tuple of (x0, y0, x1, y1) defining the rectangle
            for this tile
        :returns: None
        )rrrrrzSize cannot be negativerz Tile cannot extend outside imageN)rcr4rCr�r�r�r��
ValueError)r7rcrx�x0�y0�x1�y1rs        rrmzPyCodec.setimage{s������	,�&��R��R���+��R��R��
��7�7�r�Q�w�w�15���.�D�J��d�j�.�.� �D�J�O� �D�J�O�!�B�w�D�J��!�B�w�D�J���:��q� � �D�J�$4��$9�$9�+�C��S�/�/�!�
�J��t�z��.����a��@�@��z��$�*�/�1�D�G�L��O�C�C�4�C��S�/�/�!�D�Crr;)r�r�r�r r�rrrormrrrr�r�Ysd������������
�
�
����#"�#"�#"�#"�#"�#"rr�c�:�eZdZdZdZed���Zd�Zdd�ZdS)�	PyDecoderz�
    Python implementation of a format decoder. Override this class and
    add the decoding logic in the :meth:`decode` method.

    See :ref:`Writing Your Own File Codec in Python<file-codecs-py>`
    Fc��|jSr;)�	_pulls_fdr?s rrnzPyDecoder.pulls_fd�s
���~�rc��t���)a=
        Override to perform the decoding process.

        :param buffer: A bytes object with the data to be decoded.
        :returns: A tuple of ``(bytes consumed, errcode)``.
            If finished with decoding return -1 for the bytes consumed.
            Err codes are from :data:`.ImageFile.ERRORS`.
        r�)r7�buffers  rrpzPyDecoder.decode����"�#�#�#rNc�P�|s|j}tj|jd|��}|�|j|j�����|�|��}|ddkrd}t|���|ddkrd}t|���dS)a
        Convenience method to set the internal image from a stream of raw data

        :param data: Bytes to be set
        :param rawmode: The rawmode to be used for the decoder.
            If not specified, it will default to the mode of the image
        :returns: None
        rHrznot enough image datarzcannot decode image dataN)	r3rrlrmrcrCrxrpr�)r7r��rawmoder�rrs      r�
set_as_rawzPyDecoder.set_as_raw�s����	 ��i�G���d�i���8�8��	�
�
�4�7�D�J�.�.�0�0�1�1�1�
�H�H�T�N�N���Q�4�1�9�9�)�C��S�/�/�!��Q�4�1�9�9�,�C��S�/�/�!��9rr;)	r�r�r�r�r��propertyrnrpr�rrrr�r��sa���������I�
����X��	$�	$�	$�"�"�"�"�"�"rr�c�>�eZdZdZdZed���Zd�Zd�Zd�Z	dS)�	PyEncoderz�
    Python implementation of a format encoder. Override this class and
    add the decoding logic in the :meth:`encode` method.

    See :ref:`Writing Your Own File Codec in Python<file-codecs-py>`
    Fc��|jSr;)�
_pushes_fdr?s rr�zPyEncoder.pushes_fd�s
����rc��t���)a 
        Override to perform the encoding process.

        :param bufsize: Buffer size.
        :returns: A tuple of ``(bytes encoded, errcode, bytes)``.
            If finished with encoding return 1 for the error code.
            Err codes are from :data:`.ImageFile.ERRORS`.
        r�)r7r�s  rr�zPyEncoder.encode�r�rc��|jsdS|�d��\}}}|r|j�|��||fS)z�
        If ``pushes_fd`` is ``True``, then this method will be used,
        and ``encode()`` will only be called once.

        :returns: A tuple of ``(bytes consumed, errcode)``.
            Err codes are from :data:`.ImageFile.ERRORS`.
        )rr	r)r�r�r�r�)r7�bytes_consumed�errcoder�s    rr�zPyEncoder.encode_to_pyfd�sP���~�	��5�(,���A���%�����	 ��G�M�M�$�����w�&�&rc��d}|dkrB|�|��\}}}|dkr|�||d���|dk�B|S)z�
        :param fh: File handle.
        :param bufsize: Buffer size.

        :returns: If finished successfully, return 0.
            Otherwise, return an error code. Err codes are from
            :data:`.ImageFile.ERRORS`.
        rN)r�r�)r7r�r�r��status�bufs      rr�zPyEncoder.encode_to_file�s_������l�l�#'�;�;�w�#7�#7� �F�G�S���z�z�����V�W�W��&�&�&���l�l��rN)
r�r�r�r�r�r�r�r�r�r�rrrr�r��sk���������J�
����X��	$�	$�	$�
'�
'�
'�����rr�)rr;)r�rjr1rY�r�_utilrr&r�rqrrrrr�r�r�r�r�r�r�r�r�rrr�<module>rs-��<
�	�	�	�����
�
�
�
�
�
�
�
����������������	���N�	%�����
�
���������p$�p$�p$�p$�p$���p$�p$�p$�f'�'�'�'�'�I�'�'�'�<G�G�G�G�G�G�G�G�Z����8����8 � � �FT�T�T�T�T�T�T�T�E"�E"�E"�E"�E"�E"�E"�E"�P."�."�."�."�."��."�."�."�b6�6�6�6�6��6�6�6�6�6r

Youez - 2016 - github.com/yon3zu
LinuXploit