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/contrib/sessions/backends/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/django/contrib/sessions/backends/__pycache__/base.cpython-311.pyc
�

�|�eL6���ddlZddlZddlZddlZddlmZmZddlmZddlm	Z	ddl
mZddlm
Z
ddlmZddlmZmZmZdd	lmZdd
lmZddlmZejejzZGd�d
e��ZGd�de��ZGd�d��Z dS)�N)�datetime�	timedelta)�settings)�SuspiciousSession)�signing)�SuspiciousOperation)�timezone)�constant_time_compare�get_random_string�salted_hmac)�RemovedInDjango40Warning)�
import_string)�LANGUAGE_SESSION_KEYc��eZdZdZdS)�CreateErrorz�
    Used internally as a consistent exception type to catch from save (see the
    docstring for SessionBase.save() for details).
    N��__name__�
__module__�__qualname__�__doc__���G/usr/lib/python3/dist-packages/django/contrib/sessions/backends/base.pyrrs��������	�Drrc��eZdZdZdS)�UpdateErrorzF
    Occurs if Django tries to update a session that was deleted.
    Nrrrrrr s��������	�Drrc��eZdZdZdZdZe��Zd1d�Zd�Z	d�Z
d�Zd	�Ze
d
���Zd1d�Zefd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d�Z"d�Z#d �Z$d!�Z%e
e$��Z&e
e$e%��Z'd2d#�Z(e
e(��Z)d$�Z*d%�Z+d&�Z,d'�Z-d(�Z.d)�Z/d*�Z0d+�Z1d,�Z2d2d-�Z3d1d.�Z4d/�Z5e6d0���Z7dS)3�SessionBasez-
    Base class for all Session classes.
    �
testcookie�workedNc�l�||_d|_d|_ttj��|_dS)NF)�_session_key�accessed�modifiedrr�SESSION_SERIALIZER�
serializer��self�session_keys  r�__init__zSessionBase.__init__0s.��'�����
���
�'��(C�D�D����rc��||jvS�N��_session�r'�keys  r�__contains__zSessionBase.__contains__6����d�m�#�#rc�j�|tkrtjdtd���|j|S)Nz�The user language will no longer be stored in request.session in Django 4.0. Read it from request.COOKIES[settings.LANGUAGE_COOKIE_NAME] instead.�)�
stacklevel)r�warnings�warnr
r-r.s  r�__getitem__zSessionBase.__getitem__9sC���&�&�&��M�J�)�Q�	
�
�
�
��}�S�!�!rc�(�||j|<d|_dS�NT�r-r#�r'r/�values   r�__setitem__zSessionBase.__setitem__Cs��"��
�c����
�
�
rc�$�|j|=d|_dSr9r:r.s  r�__delitem__zSessionBase.__delitem__Gs���M�#����
�
�
rc� �d|jjzS)Nzdjango.contrib.sessions.)�	__class__r�r's r�key_saltzSessionBase.key_saltKs��)�D�N�,G�G�Grc�8�|j�||��Sr+)r-�get)r'r/�defaults   rrEzSessionBase.getOs���}� � ��g�.�.�.rc�n�|jp||jv|_||jurdn|f}|jj|g|�R�S)Nr)r#r-�_SessionBase__not_given�pop)r'r/rF�argss    rrIzSessionBase.popRsL���
�=���
�)=��
��� 0�0�0�r�r�w�j�� �t�}� ��,�t�,�,�,�,rc�T�||jvr
|j|Sd|_||j|<|Sr9r:r;s   r�
setdefaultzSessionBase.setdefaultWs4���$�-����=��%�%� �D�M�!&�D�M�#���Lrc�$�|j||j<dSr+)�TEST_COOKIE_VALUE�TEST_COOKIE_NAMErBs r�set_test_cookiezSessionBase.set_test_cookie_s��&*�&<��T�
"�#�#�#rc�H�|�|j��|jkSr+)rErOrNrBs r�test_cookie_workedzSessionBase.test_cookie_workedbs���x�x��-�.�.�$�2H�H�Hrc��||j=dSr+)rOrBs r�delete_test_cookiezSessionBase.delete_test_cookiees����&�'�'�'rc�d�d|jjz}t||�����S)Nzdjango.contrib.sessions)rArr�	hexdigest)r'r<rCs   r�_hashzSessionBase._hashhs-��,�t�~�/F�F���8�U�+�+�5�5�7�7�7rc��tjdkr|�|��Stj||j|jd���S)zGReturn the given session dictionary serialized and encoded as a string.�sha1T)�saltr%�compress)r�DEFAULT_HASHING_ALGORITHM�_legacy_encoder�dumpsrCr%)r'�session_dicts  r�encodezSessionBase.encodemsM���-��7�7��&�&�|�4�4�4��}��t�}����
�
�
�	
rc�V�	tj||j|j���S#tj$rV	|�|��cYS#t$r0tjd��}|�	d��icYcYSwxYwt$r|�|��cYSwxYw)N)rZr%z!django.security.SuspiciousSession�Session data corrupted)
r�loadsrCr%�BadSignature�_legacy_decode�	Exception�logging�	getLogger�warning)r'�session_data�loggers   r�decodezSessionBase.decodews���	5��=��D�M�d�o�^�^�^�^���#�	�	�	�
��*�*�<�8�8�8�8�8���
�
�
� �*�+N�O�O�����7�8�8�8��	�	�	�	�	�
�����	5�	5�	5��&�&�|�4�4�4�4�4�	5���s2� #�B(�A
�B(�
5B�?B(�B�!B(�'B(c��|����|��}|�|��}tj|���dz|z���d��S)N�:�ascii)r%r^rW�base64�	b64encoder`rl)r'r_�
serialized�hashs    rr]zSessionBase._legacy_encode�sa���_�_�&�&�,�,�\�:�:�
��z�z�*�%�%�������
�
�� 4�z� A�B�B�I�I�'�R�R�Rrc�@�tj|�d����}	|�dd��\}}|�|��}t|���|��std���|����	|��S#t$rd}t|t��rCtjd|jjz��}|�t%|����icYd}~Sd}~wwxYw)Nrorn�rbzdjango.security.%s)rp�	b64decoder`�splitrWr
rlrr%rcrf�
isinstancerrgrhrArri�str)r'rj�encoded_datarsrr�
expected_hash�erks        rrezSessionBase._legacy_decode�s
���'��(;�(;�G�(D�(D�E�E��	�+�1�1�$��:�:��D�*� �J�J�z�2�2�M�(������
�F�F�
;�'�(@�A�A�A����(�(�.�.�z�:�:�:���	�	�	��!�0�1�1�
'� �*�+?�!�+�BV�+V�W�W�����s�1�v�v�&�&�&��I�I�I�I�I�I�����
	���s�BB/�/
D�9AD�D�Dc�H�|j�|��d|_dSr9)r-�updater#)r'�dict_s  rr~zSessionBase.update�s#���
���U�#�#�#���
�
�
rc��||jvSr+r,r.s  r�has_keyzSessionBase.has_key�r1rc�4�|j���Sr+)r-�keysrBs rr�zSessionBase.keys�s���}�!�!�#�#�#rc�4�|j���Sr+)r-�valuesrBs rr�zSessionBase.values�s���}�#�#�%�%�%rc�4�|j���Sr+)r-�itemsrBs rr�zSessionBase.items�s���}�"�"�$�$�$rc�0�i|_d|_d|_dSr9)�_session_cacher"r#rBs r�clearzSessionBase.clear�s��!�����
���
�
�
rc�F�	|jo|jS#t$rYdSwxYw)zBReturn True when there is no session_key and the session is empty.T)r!r��AttributeErrorrBs r�is_emptyzSessionBase.is_empty�s@��	��(�(�D��1D�-D�D���	�	�	��4�4�	���s��
 � c�^�	tdt��}|�|��s|S�-)z)Return session key that isn't being used.T� )r�VALID_KEY_CHARS�existsr&s  r�_get_new_session_keyz SessionBase._get_new_session_key�s5��	#�+�B��@�@�K��;�;�{�+�+�
#�"�"�	#rc�P�|j�|���|_|jSr+)r!r�rBs r�_get_or_create_session_keyz&SessionBase._get_or_create_session_key�s(����$� $� 9� 9� ;� ;�D��� � rc�,�|ot|��dkS)z�
        Key must be truthy and at least 8 characters long. 8 characters is an
        arbitrary lower bound for some minimal key security.
        �)�lenr.s  r�_validate_session_keyz!SessionBase._validate_session_key�s��
�$�s�3�x�x�1�}�$rc��|jSr+)�_SessionBase__session_keyrBs r�_get_session_keyzSessionBase._get_session_key�s���!�!rc�P�|�|��r	||_dSd|_dS)zV
        Validate session key on assignment. Invalid values will set to None.
        N)r�r��r'r<s  r�_set_session_keyzSessionBase._set_session_key�s6���%�%�e�,�,�	&�!&�D����!%�D���rFc��d|_	|jS#t$r-|j�|ri|_n|���|_YnwxYw|jS)z�
        Lazily load session from storage (unless "no_load" is True, when only
        an empty dict is stored) and store it in the current instance.
        T)r"r�r�r(�load)r'�no_loads  r�_get_sessionzSessionBase._get_session�sj��
��
�	2��&�&���	2�	2�	2���'�7�'�&(��#�#�&*�i�i�k�k��#���		2����
�"�"s��4A�Ac��tjSr+)r�SESSION_COOKIE_AGErBs r�get_session_cookie_agez"SessionBase.get_session_cookie_age�s���*�*rc�B�	|d}n##t$rtj��}YnwxYw	|d}n%#t$r|�d��}YnwxYw|s|���St|t��s|S||z
}|jdz|jzS)z�Get the number of seconds until the session expires.

        Optionally, this function accepts `modification` and `expiry` keyword
        arguments specifying the modification and expiry of the session.
        �modification�expiry�_session_expiryi�Q)	�KeyErrorr	�nowrEr�rxr�days�seconds)r'�kwargsr�r��deltas     r�get_expiry_agezSessionBase.get_expiry_age�s���	*�!�.�1�L�L���	*�	*�	*�#�<�>�>�L�L�L�	*����
	1��H�%�F�F���	1�	1�	1��X�X�/�0�0�F�F�F�	1�����	1��.�.�0�0�0��&�(�+�+�	��M���%���z�E�!�E�M�1�1���+�+�8�A�Ac�:�	|d}n##t$rtj��}YnwxYw	|d}n%#t$r|�d��}YnwxYwt	|t
��r|S|p|���}|t|���zS)z�Get session the expiry date (as a datetime object).

        Optionally, this function accepts `modification` and `expiry` keyword
        arguments specifying the modification and expiry of the session.
        r�r�r�)r�)r�r	r�rErxrr�r)r'r�r�r�s    r�get_expiry_datezSessionBase.get_expiry_dates���	*�!�.�1�L�L���	*�	*�	*�#�<�>�>�L�L�L�	*����	1��H�%�F�F���	1�	1�	1��X�X�/�0�0�F�F�F�	1�����f�h�'�'�	��M��8�4�6�6�8�8���i��7�7�7�7�7r�c��|�	|d=n#t$rYnwxYwdSt|t��rtj��|z}||d<dS)a*
        Set a custom expiration for the session. ``value`` can be an integer,
        a Python ``datetime`` or ``timedelta`` object or ``None``.

        If ``value`` is an integer, the session will expire after that many
        seconds of inactivity. If set to ``0`` then the session will expire on
        browser close.

        If ``value`` is a ``datetime`` or ``timedelta`` object, the session
        will expire at that specific future time.

        If ``value`` is ``None``, the session uses the global session expiry
        policy.
        Nr�)r�rxrr	r�r�s  r�
set_expiryzSessionBase.set_expiry$sr���=�
��*�+�+���
�
�
���
�����F��e�Y�'�'�	+��L�N�N�U�*�E�"'��
���s��
�c�v�|�d���tjS|�d��dkS)a
        Return ``True`` if the session is set to expire when the browser
        closes, and ``False`` if there's an expiry date. Use
        ``get_expiry_date()`` or ``get_expiry_age()`` to find the actual expiry
        date/age, if there is one.
        r�Nr)rEr�SESSION_EXPIRE_AT_BROWSER_CLOSErBs r�get_expire_at_browser_closez'SessionBase.get_expire_at_browser_close>s8���8�8�%�&�&�.��;�;��x�x�)�*�*�a�/�/rc�d�|���|���d|_dS)zc
        Remove the current session data from the database and regenerate the
        key.
        N)r��deleter!rBs r�flushzSessionBase.flushIs,��
	
�
�
�������
�
�
� ����rc��|j}|j}|���||_|r|�|��dSdS)zU
        Create a new session key, while retaining the current session data.
        N)r-r(�creater�r�)r'�datar/s   r�	cycle_keyzSessionBase.cycle_keyRsR���}��������
�
�
�"����	��K�K�������	�	rc� �td���)zF
        Return True if the given session_key already exists.
        z9subclasses of SessionBase must provide an exists() method��NotImplementedErrorr&s  rr�zSessionBase.exists_s��"�"]�^�^�^rc� �td���)z�
        Create a new session instance. Guaranteed to create a new object with
        a unique key and will have saved the result once (with empty data)
        before the method returns.
        z8subclasses of SessionBase must provide a create() methodr�rBs rr�zSessionBase.createes��"�"\�]�]�]rc� �td���)z�
        Save the session data. If 'must_create' is True, create a new session
        object (or raise CreateError). Otherwise, only update an existing
        object and don't create one (raise UpdateError if needed).
        z6subclasses of SessionBase must provide a save() methodr�)r'�must_creates  r�savezSessionBase.savems��"�"Z�[�[�[rc� �td���)zx
        Delete the session data under this key. If the key is None, use the
        current session key value.
        z8subclasses of SessionBase must provide a delete() methodr�r&s  rr�zSessionBase.deleteus��
"�"\�]�]�]rc� �td���)z@
        Load the session data and return a dictionary.
        z6subclasses of SessionBase must provide a load() methodr�rBs rr�zSessionBase.load|s��"�"Z�[�[�[rc� �td���)a
        Remove expired sessions from the session store.

        If this operation isn't possible on a given backend, it should raise
        NotImplementedError. If it isn't necessary, because the backend has
        a built-in expiration mechanism, it should be a no-op.
        z.This backend does not support clear_expired().r�)�clss r�
clear_expiredzSessionBase.clear_expired�s��"�"R�S�S�Srr+)F)8rrrrrOrN�objectrHr)r0r7r=r?�propertyrCrErIrLrPrRrTrWr`rlr]rer~r�r�r�r�r�r�r�r�r�r�r�r(r!r�r-r�r�r�r�r�r�r�r�r�r�r�r��classmethodr�rrrrr'sP��������$�� ���&�(�(�K�E�E�E�E�$�$�$�"�"�"��������H�H��X�H�/�/�/�/� +�-�-�-�-�
���=�=�=�I�I�I�(�(�(�8�8�8�

�
�
�5�5�5�"S�S�S����&���$�$�$�$�$�$�&�&�&�%�%�%�������#�#�#�!�!�!�
%�%�%�"�"�"�&�&�&��(�+�,�,�K��8�,�.>�?�?�L�
#�
#�
#�
#��x��%�%�H�+�+�+�2�2�2�28�8�8�*(�(�(�4	0�	0�	0�!�!�!�	�	�	�_�_�_�^�^�^�\�\�\�\�^�^�^�^�\�\�\��T�T��[�T�T�Trr)!rprg�stringr5rr�django.confr�"django.contrib.sessions.exceptionsr�django.corer�django.core.exceptionsr�django.utilsr	�django.utils.cryptor
rr�django.utils.deprecationr
�django.utils.module_loadingr�django.utils.translationr�ascii_lowercase�digitsr�rfrrrrrr�<module>r�s���
�
�
�
�����
�
�
�
�����(�(�(�(�(�(�(�(� � � � � � �@�@�@�@�@�@�������6�6�6�6�6�6�!�!�!�!�!�!�����������>�=�=�=�=�=�5�5�5�5�5�5�9�9�9�9�9�9��(�6�=�8��	�	�	�	�	�)�	�	�	�	�	�	�	�	�)�	�	�	�dT�dT�dT�dT�dT�dT�dT�dT�dT�dTr

Youez - 2016 - github.com/yon3zu
LinuXploit