Server IP : 192.158.238.246 / Your IP : 3.15.7.155 Web Server : LiteSpeed System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64 User : jenniferflocom ( 1321) PHP Version : 8.1.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /opt/alt/python37/lib/python3.7/site-packages/beaker/__pycache__/ |
Upload File : |
B �Rd];� � @ sp d dl mZmZmZmZmZmZmZ ddlZddl Z ddl m Z mZ ddlm ZmZmZmZmZmZ ddlmZmZ ddlmZ ddlmZmZ dd lmZ d ZdZ dd dgZ!G dd� de"�Z#e#� Z$yddl%Z%dd� Z&W nB e'k �r ddl(Z(e)ed��rej*Z*ndd� Z*dd� Z&Y nX G dd� de�Z+G dd� de,�Z-G dd � d e-�Z.G dd� de.�Z/G dd� de"�Z0dS )� )�PY2�pickle�http_cookies�unicode_text� b64encode� b64decode�string_type� N)�datetime� timedelta)�hmac� hmac_sha1�sha1�get_nonce_size�DEFAULT_NONCE_BITS�get_crypto_module)�crypto�util)�clsmap)�BeakerException�InvalidCryptoBackendError)�SimpleCookie) N�Jan�Feb�Mar�Apr�May�Jun�Jul�Aug�Sep�Oct�Nov�Dec)�Mon�Tue�Wed�Thu�Fri�Sat�Sun�SignedCookie�Session�InvalidSignaturec @ s e Zd ZdZdd� Zdd� ZdS )�_InvalidSignatureTypezBReturned from SignedCookie when the value's signature was invalid.c C s dS )NF� )�selfr/ r/ �?/opt/alt/python37/lib/python3.7/site-packages/beaker/session.py�__nonzero__ s z!_InvalidSignatureType.__nonzero__c C s dS )NFr/ )r0 r/ r/ r1 �__bool__ s z_InvalidSignatureType.__bool__N)�__name__� __module__�__qualname__�__doc__r2 r3 r/ r/ r/ r1 r. s r. c C s t �� jS )N)�uuidZuuid4�hexr/ r/ r/ r1 �_session_id$ s r: �getpidc C s dS )N� r/ r/ r/ r/ r1 r; + s c C s� dt � � ti �t�� t� f } tsVtt| �d���� �}t |� dd�� dd��d��S tt| ��� �}|� dd �� d d��d�S d S ) Nz%f%s%f%s�ascii� +� -� /� _� =�+�-�/�_�=)�time�id�randomr; r r r �encode�digest�str�replace�rstrip)Zid_strZraw_idr/ r/ r1 r: . s c @ s* e Zd ZdZd dd�Zdd� Zdd� ZdS ) r+ z7Extends python cookie to give digital signature supportNc C s |� d�| _tj�| |� d S )NzUTF-8)rK �secretr Z BaseCookie�__init__)r0 rP �inputr/ r/ r1 rQ A s zSignedCookie.__init__c C s� |� d�}|sd |fS t�| j|dd � �d�t��� }d}|d d� }t|�t|�kr`t|fS x"t ||�D ]\}}|||k7 }qlW |r�t|fS |dd � |fS d S )N�"�( zutf-8r ) �strip�HMAC�newrP rK �SHA1� hexdigest�lenr- �zip)r0 �val�sigZinvalid_bitsZ input_sig�a�br/ r/ r1 �value_decodeE s "zSignedCookie.value_decodec C s. t �| j|�d�t��� }t|�d||f fS )Nzutf-8z%s%s)rV rW rP rK rX rY rM )r0 r\ r] r/ r/ r1 �value_encodeZ s zSignedCookie.value_encode)N)r4 r5 r6 r7 rQ r` ra r/ r/ r/ r1 r+ ? s c s* e Zd ZdZddd�Z� fdd�Z� ZS ) �_ConfigurableSessionz�Provides support for configurable Session objects. Provides a way to ensure some properties of sessions are always available with pre-configured values when they are not available in the session cookie itself. NrE c C s ||d�| _ d S )N)�_domain�_path)�_config)r0 � cookie_domain�cookie_pathr/ r/ r1 rQ g s z_ConfigurableSession.__init__c s t t| ��� | �| j� dS )z5Clears Session data. Preserves session configuration.N)�superrb �clear�updatere )r0 )� __class__r/ r1 ri m s z_ConfigurableSession.clear)NrE )r4 r5 r6 r7 rQ ri � __classcell__r/ r/ )rk r1 rb _ s rb c @ s* e Zd ZdZddddddddddddddddddedd fd d�Zdd � Zdd� Zd<dd�Ze dd� �Z dd� Zd=dd�Zdd� Z d>dd�Zedd� �Zdd� Zd d!� Zeee�Zd"d#� Zd$d%� Zeee�Zd?d&d'�Zd(d)� Zd*d+� Zd,d-� Zd.d/� Zd0d1� Zd@d2d3�Zd4d5� Zd6d7� Zd8d9� Z d:d;� Z!dS )Ar, an Session object that uses container package for storage. :param invalidate_corrupt: How to handle corrupt data when loading. When set to True, then corrupt data will be silently invalidated and a new session created, otherwise invalid data will cause an exception. :type invalidate_corrupt: bool :param use_cookies: Whether or not cookies should be created. When set to False, it is assumed the user will handle storing the session on their own. :type use_cookies: bool :param type: What data backend type should be used to store the underlying session data :param key: The name the cookie should be set to. :param timeout: How long session data is considered valid. This is used regardless of the cookie being present or not to determine whether session data is still valid. Can be set to None to disable session time out. :type timeout: int or None :param save_accessed_time: Whether beaker should save the session's access time (True) or only modification time (False). Defaults to True. :param cookie_expires: Expiration date for cookie :param cookie_domain: Domain to use for the cookie. :param cookie_path: Path to use for the cookie. :param data_serializer: If ``"json"`` or ``"pickle"`` should be used to serialize data. Can also be an object with ``loads` and ``dumps`` methods. By default ``"pickle"`` is used. :param secure: Whether or not the cookie should only be sent over SSL. :param httponly: Whether or not the cookie should only be accessible by the browser not by JavaScript. :param encrypt_key: The key to use for the local session encryption, if not provided the session will not be encrypted. :param validate_key: The key used to sign the local encrypted session :param encrypt_nonce_bits: Number of bits used to generate nonce for encryption key salt. For security reason this is 128bits be default. If you want to keep backward compatibility with sessions generated before 1.8.0 set this to 48. :param crypto_type: encryption module to use :param samesite: SameSite value for the cookie -- should be either 'Lax', 'Strict', or None. NFTzbeaker.session.idrE r �default�Laxc K s$ t j| ||d� | �� |s0|r(d| _q6d| _n|| _|pBt| j | _|| _|| _|| _|| _ |rn| snt d��|| _| jd k r�| jd | jd<