403Webshell
Server IP : 3.96.16.70  /  Your IP : 216.73.216.15
Web Server : Apache
System : Linux ip-172-31-26-103.ca-central-1.compute.internal 6.1.163-186.299.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Feb 24 16:35:42 UTC 2026 x86_64
User : ec2-user ( 1000)
PHP Version : 8.4.18
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3.9/site-packages/oauthlib/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3.9/site-packages/oauthlib/__pycache__/common.cpython-39.pyc
a

D�]r9�@s4dZddlmZmZddlZddlZddlZddlZddlZddl	Z	zddl
mZddl
mZWn*e
y�ddlmZddlmZYn0z(ddlmZddlmZdd	lmZWn6e
y�ddlmZddlmZdd	lmZYn0zddlZWn e
�yddlmZYn0d
ZdZe�dej�Ze�d
�ZdZ e�!d�Z"ej#ddkZ$e$�rbe%Z&ne'Z&d<dd�Zdd�Zdd�Zdd�Z(dd�Z)e*e �e*d�BZ+dd�Z,dd �Z-d!d"�Z.d#d$�Z/d%efd&d'�Z0d(d)�Z1d*d+�Z2d%efd,d-�Z3d.d/�Z4d=d1d2�Z5d3d4�Z6d>d6d7�Z7Gd8d9�d9e8�Z9Gd:d;�d;e:�Z;dS)?z|
oauthlib.common
~~~~~~~~~~~~~~

This module provides data structures and utilities common
to all implementations of OAuth.
�)�absolute_import�unicode_literalsN)�randbits)�SystemRandom)�getrandbits)�quote)�unquote)�	urlencodeZ>abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789z_ !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}z&([^&;]*(?:password|token)[^=]*=)[^&;]+z&%[^0-9A-Fa-f]|%[0-9A-Fa-f][^0-9A-Fa-f]zAABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.-Zoauthlib��/cCs:t|t�r|�d�n|}t||�}t|t�r6|�d�}|S�N�utf-8)�
isinstance�unicode_type�encode�_quote�bytes�decode)�s�safe�r�3/usr/lib/python3.9/site-packages/oauthlib/common.pyr>s



rcCs t|�}t|t�r|�d�}|Sr)�_unquoterrr)rrrrrHs

rcCs,t|�}t|�}t|t�r|S|�d�SdSr)�encode_params_utf8�
_urlencoderrr)�paramsZutf8_params�
urlencodedrrrr	Rs

r	cCsLg}|D]>\}}|�t|t�r(|�d�n|t|t�r>|�d�n|f�q|S)ziEnsures that all parameters in a list of 2-element tuples are encoded to
    bytestrings using UTF-8
    r
)�appendrrr)rZencoded�k�vrrrr[s�rcCsLg}|D]>\}}|�t|t�r(|�d�n|t|t�r>|�d�n|f�q|S)zfEnsures that all parameters in a list of 2-element tuples are decoded to
    unicode using UTF-8.
    r
)rrrr)rZdecodedrrrrr�decode_params_utf8gs�r z=&;:%+~,*@!()/?'$cCsp|r,t|�tks,d}t|t|�t|f��t�|�r>td��tsVt|t�rV|�d�n|}t	j
|dd�}t|�S)a�Decode a query string in x-www-form-urlencoded format into a sequence
    of two-element tuples.

    Unlike urlparse.parse_qsl(..., strict_parsing=True) urldecode will enforce
    correct formatting of the query string by validation. If validation fails
    a ValueError will be raised. urllib.parse_qsl will only raise errors if
    any of name-value pairs omits the equals sign.
    z�Error trying to decode a non urlencoded string. Found invalid characters: %s in the string: '%s'. Please ensure the request/response body is x-www-form-urlencoded.z%Invalid hex encoding in query string.r
T��keep_blank_values)�setr�
ValueError�INVALID_HEX_PATTERN�search�PY3rrr�urlparse�	parse_qslr )�query�errorrrrr�	urldecodevs

����r,cCs�t|t�st|t�r:zt|�}Wq�ty6d}Yq�0njt|d�r�zt|�Wn*tyfd}Yq�tyzd}Yq�0tt|t�r�|�	�n|�}t
|�}nd}|S)a*Extract parameters and return them as a list of 2-tuples.

    Will successfully extract parameters from urlencoded query strings,
    dicts, or lists of 2-tuples. Empty strings/dicts/lists will return an
    empty list of parameters. Any other input will result in a return
    value of None.
    N�__iter__)rrrr,r$�hasattr�dict�	TypeError�list�itemsr )�rawrrrr�extract_params�s 


r4cCstttd��t��S)a�Generate pseudorandom nonce that is unlikely to repeat.

    Per `section 3.3`_ of the OAuth 1 RFC 5849 spec.
    Per `section 3.2.1`_ of the MAC Access Authentication spec.

    A random 64-bit number is appended to the epoch timestamp for both
    randomness and to decrease the likelihood of collisions.

    .. _`section 3.2.1`: https://tools.ietf.org/html/draft-ietf-oauth-v2-http-mac-01#section-3.2.1
    .. _`section 3.3`: https://tools.ietf.org/html/rfc5849#section-3.3
    �@)rr�generate_timestamprrrr�generate_nonce�sr7cCsttt����S)aDGet seconds since epoch (UTC).

    Per `section 3.3`_ of the OAuth 1 RFC 5849 spec.
    Per `section 3.2.1`_ of the MAC Access Authentication spec.

    .. _`section 3.2.1`: https://tools.ietf.org/html/draft-ietf-oauth-v2-http-mac-01#section-3.2.1
    .. _`section 3.3`: https://tools.ietf.org/html/rfc5849#section-3.3
    )r�int�timerrrrr6�s	r6�cs$t��d���fdd�t|�D��S)aXGenerates a non-guessable OAuth token

    OAuth (1 and 2) does not specify the format of tokens except that they
    should be strings of random characters. Tokens should not be guessable
    and entropy when generating the random characters is important. Which is
    why SystemRandom is used instead of the default random.choice method.
    �c3s|]}����VqdS�N)Zchoice)�.0�x��charsZrandrr�	<genexpr>��z!generate_token.<locals>.<genexpr>)r�join�range�Zlengthr@rr?r�generate_token�srFcCsTddl}tj��}|j|tj|jd�d�}|�|j�|�||d�}t	|d�}|S)Nr)Zseconds)�scopeZexp�RS256�UTF-8)
�jwt�datetimeZutcnowrGZ	timedeltaZ
expires_in�update�claimsr�
to_unicode)Zprivate_pemZrequestrJZnowrM�tokenrrr�generate_signed_token�s
�
rPcCsddl}|j||dgd�S)NrrH)Z
algorithms)rJr)Z
public_pemrOrJrrr�verify_signed_token�srQcCs
t||�S)z�Generates an OAuth client_id

    OAuth 2 specify the format of client_id in
    https://tools.ietf.org/html/rfc6749#appendix-A.
    )rFrErrr�generate_client_idsrRcCs2t|t�r|��}tj|dd�}|�|�t|�S)z)Extend a query with a list of two-tuples.Tr!)rr/r2r(r)�extendr	)r*rZqueryparamsrrr�add_params_to_qss


rTFc	CsFt�|�\}}}}}}|r&t||�}n
t||�}t�||||||f�S)z5Add a list of two-tuples to the uri query components.)r(rT�
urlunparse)	�urir�fragmentZschZnet�pathZparr*Zfrarrr�add_params_to_uris

rYcCsHt|�t|�krdSd}t||�D]\}}|t|�t|�AO}q"|dkS)a Near-constant time string comparison.

    Used in order to avoid timing attacks on sensitive information such
    as secret keys during request verification (`rootLabs`_).

    .. _`rootLabs`: http://rdist.root.org/2010/01/07/timing-independent-array-comparison/

    Fr)�len�zip�ord)�a�b�resultr>�yrrr�safe_string_equalss	rarIcs�t|t�r|St|t�r$t|�d�St|d�r�zt|�Wn4tyLYnLtyn�fdd�|D�YS0t|d�r�|��}t�fdd�|D��S|S)z:Convert a number of different types of objects to unicode.��encodingr-c3s|]}t|��VqdSr<�rN)r=�irbrrrA@rBzto_unicode.<locals>.<genexpr>r2c3s&|]\}}t|��t|��fVqdSr<rd)r=rrrbrrrAErB)rrrr.r/r0r$r2)�datarcrrbrrN1s



rNcsbeZdZdZiZdd�Zdd�Z�fdd�Z�fdd	�Zddd�Z	�fd
d�Z
�fdd�Z�ZS)�CaseInsensitiveDictz3Basic case insensitive dict with strings only keys.cCs.tdd�|D��|_|D]}||||<qdS)Ncss|]}|��|fVqdSr<)�lower)r=rrrrrAQrBz/CaseInsensitiveDict.__init__.<locals>.<genexpr>)r/�proxy)�selfrfrrrr�__init__PszCaseInsensitiveDict.__init__cCs|��|jvSr<)rhri)rjrrrr�__contains__Usz CaseInsensitiveDict.__contains__cs.|j|��}tt|��|�|j|��=dSr<)rirh�superrg�__delitem__�rjr�key��	__class__rrrnXszCaseInsensitiveDict.__delitem__cs|j|��}tt|��|�Sr<)rirhrmrg�__getitem__rorqrrrs]szCaseInsensitiveDict.__getitem__NcCs||vr||S|Sr<r)rjr�defaultrrr�getaszCaseInsensitiveDict.getcs$tt|��||�||j|��<dSr<)rmrg�__setitem__rirh)rjrrrqrrrvdszCaseInsensitiveDict.__setitem__cs<tt|�j|i|��t|i|��D]}||j|��<q$dSr<)rmrgrLr/rirh)rj�args�kwargsrrqrrrLhszCaseInsensitiveDict.update)N)
�__name__�
__module__�__qualname__�__doc__rirkrlrnrsrurvrL�
__classcell__rrrqrrgJs
rgc@sNeZdZdZddd�Zdd�Zd	d
�Zedd��Zed
d��Z	edd��Z
dS)�Requesta:A malleable representation of a signable HTTP request.

    Body argument may contain any data, but parameters will only be decoded if
    they are one of:

    * urlencoded query string
    * dict
    * list of 2-tuples

    Anything else will be treated as raw body data to be passed through
    unmolested.
    �GETNr
cs��fdd�}||�|_||�|_t||p*i��|_||�|_t|j�|_g|_i|_ddddddddddddddddddddddddddddddd�|_	|j	�
tt|j
���|j	�
t|jp�g��dS)Ncs�rt|��S|Sr<rd)r>rbrr�<lambda>�rBz"Request.__init__.<locals>.<lambda>)Zaccess_tokenZclientZ	client_idZ
client_secret�codeZcode_challengeZcode_challenge_methodZ
code_verifierZextra_credentialsZ
grant_typeZredirect_uriZ
refresh_tokenZ
request_tokenZ
response_typerGZscopes�staterO�userZtoken_type_hintZ
response_modeZnonceZdisplay�promptrMZmax_ageZ
ui_localesZ
id_token_hintZ
login_hintZ
acr_values)rV�http_methodrg�headers�bodyr4�decoded_bodyZoauth_paramsZ
validator_log�_paramsrLr/r,�	uri_query)rjrVr�r�r�rcrrrbrrk}sR


�"zRequest.__init__cCs ||jvr|j|St|��dSr<)r��AttributeError)rj�namerrr�__getattr__�s

zRequest.__getattr__cCsH|j}|j��}|r$t�dt|��}d|vr4d|d<d|j|j||fS)Nz<SANITIZED>Z
Authorizationz<SANITIZED>zF<oauthlib.Request url="%s", http_method="%s", headers="%s", body="%s">)r�r��copy�SANITIZE_PATTERN�sub�strrVr�)rjr�r�rrr�__repr__�s
�zRequest.__repr__cCst�|j�jSr<)r(rVr*�rjrrrr��szRequest.uri_querycCs|js
gStj|jddd�S)NT)r"�strict_parsing)r�r(r)r�rrr�uri_query_params�s

�zRequest.uri_query_paramscCsPt�t�}dd�|jpg|jD�}|D]}||d7<q(dd�|��D�S)Ncss|]}|dVqdS)rNr)r=�prrrrA�s�z+Request.duplicate_params.<locals>.<genexpr>�cSsg|]\}}|dkr|�qS)r�r)r=r�crrr�
<listcomp>�rBz,Request.duplicate_params.<locals>.<listcomp>)�collections�defaultdictr8r�r�r2)rjZ	seen_keysZall_keysrrrr�duplicate_params�s
�zRequest.duplicate_params)rNNr
)ryrzr{r|rkr�r��propertyr�r�r�rrrrr~ns
�
2


r~)r)F)rI)<r|Z
__future__rrr�rKZlogging�re�sysr9Zsecretsrr�ImportErrorZrandomrZurllibrrrrr	r�urllib.parser(�parseZUNICODE_ASCII_CHARACTER_SETZCLIENT_ID_CHARACTER_SET�compile�
IGNORECASEr�r%Zalways_safeZ	getLogger�log�version_infor'r�rZunicoderr r#rr,r4r7r6rFrPrQrRrTrYrarNr/rg�objectr~rrrr�<module>sn




	1		


$

Youez - 2016 - github.com/yon3zu
LinuXploit