403Webshell
Server IP : 192.158.238.246  /  Your IP : 18.216.137.32
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/paste/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python37/lib/python3.7/site-packages/paste/__pycache__/session.cpython-37.pyc
B

a�NG,�@s&dZddlmZddlZddlZddlZddlZddlZddlZyddl	Z	Wne
k
rhddlZ	YnXyddlm
Z
Wn e
k
r�ddl
m
Z
YnXddlmZddlmZGdd�de�ZGd	d
�d
e�Zdadaejdd
�aGdd�de�ZGdd�de�Ze�Zeeeeefdd�ZdS)a�
Creates a session object in your WSGI environment.

Use like:

..code-block:: Python

    environ['paste.session.factory']()

This will return a dictionary.  The contents of this dictionary will
be saved to disk when the request is completed.  The session will be
created when you first fetch the session dictionary, and a cookie will
be sent in that case.  There's current no way to use sessions without
cookies, and there's no way to delete a session except to clear its
data.

@@: This doesn't do any locking, and may cause problems when a single
session is accessed concurrently.  Also, it loads and saves the
session for each request, with no caching.  Also, sessions aren't
expired.
�)�SimpleCookieN)�md5)�wsgilib)�requestc@seZdZddd�Zdd�ZdS)�SessionMiddlewareNcKs||_||_dS)N)�application�
factory_kw)�selfr�global_confr�r�>/opt/alt/python37/lib/python3.7/site-packages/paste/session.py�__init__/szSessionMiddleware.__init__csbt|f|j���|d<g�d���fdd�	}|�||�}���fdd�}�fdd�}t�|||�S)	Nzpaste.session.factorycs:�js ||g�dd�<�||�S|������|||�S)N)�created�append�set_cookie_header)�status�headers�exc_info)�remember_headers�session_factory�start_responserr�session_start_response8s

z:SessionMiddleware.__call__.<locals>.session_start_responsecs@�jr<�r<�\}}|�����td�}�|||j|df�dS)NzLYou cannot get the session after content from the app_iter has been returned)rrr�
ValueError�	__class__)rr�exc)rrrrr�start@s
z)SessionMiddleware.__call__.<locals>.startcs�jr���dS)N)�used�closer)rrrrIsz)SessionMiddleware.__call__.<locals>.close)N)�SessionFactoryrrrZadd_start_close)r	�environrrZapp_iterrrr)rrrr�__call__3s	zSessionMiddleware.__call__)N)�__name__�
__module__�__qualname__r
r rrrrr-s
rc@sHeZdZddd�Zdd�Zdd	�Zd
d�Zddd
�Zdd�Zdd�Z	dS)r�_SID_N��cKs8d|_d|_||_||_d|_|p$t|_||_||_dS)NF)	rrr�cookie_name�session�FileSession�
session_class�session_class_kw�
expiration)r	rr&r)�session_expirationr*rrrr
Rs
zSessionFactory.__init__cCs�d|_|jdk	r|j��St�|j�}d}|�|j�rx||jj|_	y|j
|j	fddi|j��}Wntk
rvYnX|dkr�d|_
|��|_	|j
|j	fddi|j��}|��||_|��S)NT�createF)rr'�datar�get_cookiesr�has_keyr&�value�sidr)r*�KeyErrorr�make_sid�clean_up)r	�cookiesr'rrrr as(



zSessionFactory.__call__cCs.|jdk	rdSt�|j�}|�|j�r*dSdS)NTF)r'rr/rr0r&)r	r6rrr�has_sessionxs
zSessionFactory.has_sessioncCs2d�dd�t�t���dd�D��d|��S)N�cSsg|]}d|�qS)z%02dr)�.0�xrrr�
<listcomp>�sz+SessionFactory.make_sid.<locals>.<listcomp>��-)�join�time�	localtime�	unique_id)r	rrrr4�szSessionFactory.make_sidc	Cs�t��t��g}ttd�r(|�t���|dk	r>|�t|��tt|��}y|�	�St
k
r�g}x"|��D]}|�dt|��qpWd�
|�SXdS)a
        Generates an opaque, identifier string that is practically
        guaranteed to be unique.  If an object is passed, then its
        id() is incorporated into the generation.  Relies on md5 and
        returns a 32 character long string.
        �timesNz%02xr8)r?�random�hasattr�osrrB�idr�str�	hexdigest�AttributeError�digest�ordr>)r	Z
for_object�rZmd5_hashrH�charrrrrA�s
zSessionFactory.unique_idcCsjt�}|j||j<d||jd<t�t��|jd�}t�d|�||jd<t|��dd�\}}||fS)N�/�path�<z%a, %d-%b-%Y %H:%M:%S GMTZexpiresz: �)	rr2r&r?�gmtimer+�strftimerG�split)r	�cZgmt_expiration_time�namer1rrrr�sz SessionFactory.set_cookie_headercCs|jdk	r|j��dS)N)r'r)r	rrrr�s
zSessionFactory.close)r$Nr%)N)
r!r"r#r
r r7r4rArrrrrrrOs


rFi�)�secondsc@sReZdZde��ddfdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�ZdS)r(FNi@cCsZ|rt|t�rt|d�}||_|s&t�||_||_|sJtj�	|�
��sJt�d|_||_dS)N�)
�
isinstance�
basestring�int�chmodr3�session_file_pathr2rErO�exists�filename�_datar+)r	r2r-r]r\r+rrrr
�s
zFileSession.__init__cCstj�|j|j�S)N)rErOr>r]r2)r	rrrr_�szFileSession.filenamecCsP|jdk	r|jStj�|���rDt|��d�}t�|�|_|��ni|_|jS)N�rb)	r`rErOr^r_�open�cPickle�loadr)r	�frrrr.�s

zFileSession.datacCsp|jdk	rl|��}tj�|�}|js4|rlt�|�n8t|d�}t�|j|�|�	�|sl|j
rlt�
||j
�dS)N�wb)r`r_rErOr^�unlinkrbrc�dumprr\)r	r_r^rerrrr�s


zFileSession.closecCsfzZtj|jdd�}tj��}x8t�|j�D](\}}}x|D]}|j|||d�q<Wq,WWddaXdS)NrP)rW)�exp_time�nowF)	�datetime�	timedeltar+rjrE�walkr]�_clean_up_file�cleaning_up)r	rirj�root�dirs�filesrerrr�	_clean_up�s

zFileSession._clean_upcCs�|�d�}t|�dkrdS|d}y`t�t|dd��t|dd��t|dd��t|dd��t|dd��t|dd	���}Wntk
r�dSX|||kr�t�tj�|j	|��dS)
Nr=�r�r<rX�
��)
rT�lenrkr[rrE�removerOr>r])r	rerirj�tZ	sess_timerrrrn�s 
zFileSession._clean_up_filecCs`tj��}trdStr"tt|kr\ts\day|atj|jd�}|��Wnda�YnXdS)NT)�targetF)	rkrjro�last_cleanup�
cleanup_cycle�	threading�Threadrsr)r	rjr{rrrr5s
zFileSession.clean_up)r!r"r#�tempfile�
gettempdirr
r_r.rrsrnr5rrrrr(�s
r(c@seZdZdd�ZdS)�
_NoDefaultcCsdS)Nz<dynamic default>r)r	rrr�__repr__sz_NoDefault.__repr__N)r!r"r#r�rrrrr�sr�cCs�|tkr|�dd�}t|�}|tkr0|�dd�}t|�}|tkrL|�dd�}|tkr`|�dd�}|tkrt|�d	d
�}t||||||d�S)a
    Adds a middleware that handles sessions for your applications.
    The session is a peristent dictionary.  To get this dictionary
    in your application, use ``environ['paste.session.factory']()``
    which returns this persistent dictionary.

    Configuration:

      session_expiration:
          The time each session lives, in minutes.  This controls
          the cookie expiration.  Default 12 hours.

      expiration:
          The time each session lives on disk.  Old sessions are
          culled from disk based on this.  Default 48 hours.

      cookie_name:
          The cookie name used to track the session.  Use different
          names to avoid session clashes.

      session_file_path:
          Sessions are put in this location, default /tmp.

      chmod:
          The octal chmod you want to apply to new sessions (e.g., 660
          to make the sessions group readable/writable)

    Each of these also takes from the global configuration.  cookie_name
    and chmod take from session_cookie_name and session_chmod
    r,i�r+i@Zsession_cookie_namer$r]z/tmpZ
session_chmodN)r,r+r&r]r\)�	NoDefault�getr[r)Zappr
r,r+r&r]r\rrr�make_session_middlewares %r�)�__doc__ZCookierr?rCrErkrr�rc�ImportError�pickle�hashlibr�pasterr�objectrrr}rorlr~r(r�r�r�rrrr�<module>s<"]h

Youez - 2016 - github.com/yon3zu
LinuXploit