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/middleware/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/django/middleware/__pycache__/csrf.cpython-311.pyc
�

�|�e�5��P�dZddlZddlZddlZddlmZddlmZddlm	Z	m
Z
ddlmZddl
mZddlmZmZdd	lmZdd
lmZddlmZejd��Zd
ZdZdZdZdZdZdZ de zZ!ej"ej#zZ$dZ%d�Z&d�Z'd�Z(d�Z)d�Z*d�Z+d�Z,d�Z-d�Z.Gd�d e��Z/dS)!z�
Cross Site Request Forgery Middleware.

This module provides a middleware that implements protection
against request forgeries from other sites.
�N)�urlparse)�settings)�DisallowedHost�ImproperlyConfigured)�get_callable)�patch_vary_headers)�constant_time_compare�get_random_string)�MiddlewareMixin)�is_same_domain)�log_responsezdjango.security.csrfz%Referer checking failed - no Referer.z@Referer checking failed - %s does not match any trusted origins.zCSRF cookie not set.z CSRF token missing or incorrect.z/Referer checking failed - Referer is malformed.zCReferer checking failed - Referer is insecure while host is secure.� ��
_csrftokenc�4�ttj��S)z/Return the view to be used for CSRF rejections.)rr�CSRF_FAILURE_VIEW���8/usr/lib/python3/dist-packages/django/middleware/csrf.py�_get_failure_viewr$s����2�3�3�3rc�8�ttt���S)N)�
allowed_chars)r
�CSRF_SECRET_LENGTH�CSRF_ALLOWED_CHARSrrr�_get_new_csrf_stringr)s���/�?Q�R�R�R�Rrc����t��}t�t�fd�|D���fd�|D����}d��fd�|D����}||zS)z�
    Given a secret (assumed to be a string of CSRF_ALLOWED_CHARS), generate a
    token by adding a mask and applying it to the secret.
    c3�B�K�|]}��|��V��dS�N��index��.0�x�charss  �r�	<genexpr>z&_mask_cipher_secret.<locals>.<genexpr>4s-�����0�0�A����Q���0�0�0�0�0�0rc3�B�K�|]}��|��V��dSrrr!s  �rr%z&_mask_cipher_secret.<locals>.<genexpr>4s-�����2P�2P�a�5�;�;�q�>�>�2P�2P�2P�2P�2P�2Pr�c3�T�K�|]"\}}�||zt���zV��#dSr)�len�r"r#�yr$s   �rr%z&_mask_cipher_secret.<locals>.<genexpr>5s;�����C�C�T�Q��U�A��E�S��Z�Z�/�0�C�C�C�C�C�Cr)rr�zip�join)�secret�mask�pairs�cipherr$s    @r�_mask_cipher_secretr2-s~���
 �!�!�D��E��0�0�0�0��0�0�0�2P�2P�2P�2P�4�2P�2P�2P�Q�Q�E�
�W�W�C�C�C�C�U�C�C�C�
C�
C�F��&�=�rc����|dt�}|td�}t�t�fd�|D���fd�|D����}d��fd�|D����S)z�
    Given a token (assumed to be a string of CSRF_ALLOWED_CHARS, of length
    CSRF_TOKEN_LENGTH, and that its first half is a mask), use it to decrypt
    the second half to produce the original secret.
    Nc3�B�K�|]}��|��V��dSrrr!s  �rr%z'_unmask_cipher_token.<locals>.<genexpr>Bs-�����/�/�A����Q���/�/�/�/�/�/rc3�B�K�|]}��|��V��dSrrr!s  �rr%z'_unmask_cipher_token.<locals>.<genexpr>Bs-�����1O�1O�Q�%�+�+�a�.�.�1O�1O�1O�1O�1O�1Orr'c3�4�K�|]\}}�||z
V��dSrrr*s   �rr%z'_unmask_cipher_token.<locals>.<genexpr>Cs/�����2�2�D�A�q�5��Q��<�2�2�2�2�2�2r)rrr,r-)�tokenr/r0r$s   @r�_unmask_cipher_tokenr89s�����$�$�$�%�D��$�%�%�&�E��E��/�/�/�/��/�/�/�1O�1O�1O�1O�$�1O�1O�1O�P�P�E�
�7�7�2�2�2�2�E�2�2�2�2�2�2rc�8�tt����Sr)r2rrrr�_get_new_csrf_tokenr:Fs���3�5�5�6�6�6rc���d|jvr&t��}t|��|jd<nt|jd��}d|jd<t|��S)a�
    Return the CSRF token required for a POST form. The token is an
    alphanumeric value. A new token is created if one is not already set.

    A side effect of calling this function is to make the csrf_protect
    decorator and the CsrfViewMiddleware add a CSRF cookie and a 'Vary: Cookie'
    header to the outgoing response.  For this reason, you may need to use this
    function lazily, as is done by the csrf context processor.
    �CSRF_COOKIET�CSRF_COOKIE_USED)�METArr2r8)�request�csrf_secrets  r�	get_tokenrAJsb���G�L�(�(�*�,�,��&9�+�&F�&F���]�#�#�*�7�<�
�+F�G�G��'+�G�L�#�$��{�+�+�+rc�f�|j�dt��d���d|_dS)zi
    Change the CSRF token in use for a request - should be done on login
    for security purposes.
    T)r=r<N)r>�updater:�csrf_cookie_needs_reset)r?s r�rotate_tokenrE]sD��
�L��� �*�,�,������'+�G�#�#�#rc���tjd|��rt��St|��tkr|St|��t
krt
|��St��S)Nz[^a-zA-Z0-9])�re�searchr:r)�CSRF_TOKEN_LENGTHrr2)r7s r�_sanitize_tokenrJisg��	�y���'�'�*�"�$�$�$�	�U���(�	(�	(���	�U���)�	)�	)�#�5�)�)�)�� � � rc�V�tt|��t|����Sr)r	r8)�request_csrf_token�
csrf_tokens  r�_compare_masked_tokensrNzs-��!��/�0�0��Z�(�(���rc�<�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	S)
�CsrfViewMiddlewarez�
    Require a present and correct csrfmiddlewaretoken for POST requests that
    have a CSRF cookie, and set an outgoing CSRF cookie.

    This middleware should be used in conjunction with the {% csrf_token %}
    template tag.
    c��d|_dS)NT)�csrf_processing_done)�selfr?s  r�_acceptzCsrfViewMiddleware._accept�s��(,��$��trc�v�t��||���}td||j||t���|S)N)�reasonzForbidden (%s): %s)�responser?�logger)rr
�pathrX)rSr?rVrWs    r�_rejectzCsrfViewMiddleware._reject�sM��&�$�&�&�w�v�>�>�>��� �&�'�,����		
�	
�	
�	
��rc�$�tjr=	|j�t��S#t
$rt
d���wxYw	|jtj}n#t$rYdSwxYwt|��}||krd|_|S)Nz�CSRF_USE_SESSIONS is enabled, but request.session is not set. SessionMiddleware must appear before CsrfViewMiddleware in MIDDLEWARE.T)r�CSRF_USE_SESSIONS�session�get�CSRF_SESSION_KEY�AttributeErrorr�COOKIES�CSRF_COOKIE_NAME�KeyErrorrJrD)rSr?�cookie_tokenrMs    r�
_get_tokenzCsrfViewMiddleware._get_token�s����%�	�
���*�*�+;�<�<�<��!�
�
�
�*�%����
����
�&��x�/H�I�����
�
�
��t�t�
����)��6�6�J��\�)�)�37��/��s�-�A�A#�#
A1�0A1c
��tjrL|j�t��|jdkr|jd|jt<dSdS|�tj|jdtjtj	tj
tjtjtj
���t|d��dS)Nr<)�max_age�domainrY�secure�httponly�samesite)�Cookie)rr\r]r^r_r>�
set_cookierb�CSRF_COOKIE_AGE�CSRF_COOKIE_DOMAIN�CSRF_COOKIE_PATH�CSRF_COOKIE_SECURE�CSRF_COOKIE_HTTPONLY�CSRF_COOKIE_SAMESITEr�rSr?rWs   r�
_set_tokenzCsrfViewMiddleware._set_token�s����%�	6���"�"�#3�4�4���]�8S�S�S�4;�L��4O��� 0�1�1�1�T�S�
����)���]�+� �0��2��.��2�!�6�!�6�
 �	
�	
�	
�
�x��5�5�5�5�5rc�L�|�|��}|�||jd<dSdS)Nr<)rer>)rSr?rMs   r�process_requestz"CsrfViewMiddleware.process_request�s3���_�_�W�-�-�
��!�*4�G�L��'�'�'�"�!rc���t|dd��rdSt|dd��rdS|jdv�r�t|dd��r|�|��S|����r�|j�d�����|�|t��St����d�j	�j
fvr|�|t��S�j	dkr|�|t��Stjrtjntj}|� |���}|d	vr|�d
|��}n&	|���}n#t&$rYnwxYwt)tj��}|�|�|��t/�fd�|D����s2t0����z}|�||��S|�|��}	|	�|�|t6��Sd}
|jdkr-	|j�d
d��}
n#t:$rYnwxYw|
dkr%|j�tjd��}
t?|
��}
tA|
|	��s|�|tB��S|�|��S)NrRF�csrf_exempt)�GET�HEAD�OPTIONS�TRACE�_dont_enforce_csrf_checks�HTTP_REFERERr'�https)�443�80�:c3�B�K�|]}t�j|��V��dSr)r�netloc)r"�host�referers  �rr%z2CsrfViewMiddleware.process_view.<locals>.<genexpr>s/�����W�W�D�>�'�.�$�?�?�W�W�W�W�W�Wr�POST�csrfmiddlewaretoken)"�getattr�methodrT�	is_securer>r^rZ�REASON_NO_REFERERr�schemer��REASON_MALFORMED_REFERER�REASON_INSECURE_REFERERrr\�SESSION_COOKIE_DOMAINro�get_port�get_hostr�list�CSRF_TRUSTED_ORIGINS�append�any�REASON_BAD_REFERER�geturlre�REASON_NO_CSRF_COOKIEr��OSError�CSRF_HEADER_NAMErJrN�REASON_BAD_TOKEN)rSr?�callback�
callback_args�callback_kwargs�good_referer�server_port�
good_hostsrVrMrLr�s           @r�process_viewzCsrfViewMiddleware.process_view�s����7�2�E�:�:�	��4��8�]�E�2�2�	��4��>�!D�D�D��w� ;�U�C�C�
-��|�|�G�,�,�,�� � �"�"�9
9� "�,�*�*�>�:�:���?��<�<��1B�C�C�C�"�7�+�+���'�.�'�.�9�9�9��<�<��1I�J�J�J��>�W�,�,��<�<��1H�I�I�I� �1�5�H�2�2�!�4��
 �+�")�"2�"2�"4�"4�K�"�-�7�7�2>�,�,���'L����'.�'7�'7�'9�'9����)����������
"�(�"?�@�@�
��+��%�%�l�3�3�3��W�W�W�W�J�W�W�W�W�W�9�/�'�.�.�2B�2B�B�F��<�<���8�8�8�
����1�1�J��!��|�|�G�-B�C�C�C�"$���~��'�'��)0��)9�)9�:O�QS�)T�)T�&�&�������D�
����"�R�'�'�&-�\�%5�%5�h�6O�QS�%T�%T�"�!0�1C�!D�!D��)�*<�j�I�I�
?��|�|�G�-=�>�>�>��|�|�G�$�$�$s$�E � 
E-�,E-�-I	�	
I�Ic���t|dd��st|dd��r|S|j�dd��s|S|�||��d|_|S)NrDF�csrf_cookie_setr=T)r�r>r^rur�rts   r�process_responsez#CsrfViewMiddleware.process_response=st���w� 9�5�A�A�	 ��x�!2�E�:�:�
 ����|��� 2�E�:�:�	��O�	
�����*�*�*�#'�� ��rN)�__name__�
__module__�__qualname__�__doc__rTrZrerurwr�r�rrrrPrP�s������������������.6�6�6�$5�5�5�n%�n%�n%�`����rrP)0r��loggingrG�string�urllib.parser�django.confr�django.core.exceptionsrr�django.urlsr�django.utils.cacher�django.utils.cryptor	r
�django.utils.deprecationr�django.utils.httpr�django.utils.logr
�	getLoggerrXr�r�r�r�r�r�rrI�
ascii_letters�digitsrr_rrr2r8r:rArErJrNrPrrr�<module>r�s��������	�	�	�	�
�
�
�
�!�!�!�!�!�!� � � � � � �G�G�G�G�G�G�G�G�$�$�$�$�$�$�1�1�1�1�1�1�H�H�H�H�H�H�H�H�4�4�4�4�4�4�,�,�,�,�,�,�)�)�)�)�)�)�	��	�1�	2�	2��;��W��.��5��L��_�����*�*���)�F�M�9����4�4�4�
S�S�S�	�	�	�
3�
3�
3�7�7�7�,�,�,�&	+�	+�	+�!�!�!�"���F�F�F�F�F��F�F�F�F�Fr

Youez - 2016 - github.com/yon3zu
LinuXploit