404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@3.128.202.43: ~ $
3

,�[q9�@s@dZddlmZmZddlZddlZddlZddlZddlZddl	Z	yddl
mZddl
mZWn,e
k
r�ddlmZddlmZYnXy(ddlmZddlmZdd	lmZWn8e
k
r�ddlmZddlmZdd	lmZYnXyddlZWn e
k
�rddljZYnXd
ZdZejdej�Zejd
�ZdZ ej!d�Z"ej#ddkZ$e$�rje%Z&e'Z(ne)Z&e%Z(d<dd�Zdd�Zdd�Zdd�Z*dd�Z+e,e �e,d�BZ-dd�Z.dd �Z/d!d"�Z0d#d$�Z1d%efd&d'�Z2d(d)�Z3d*d+�Z4d%efd,d-�Z5d.d/�Z6d=d1d2�Z7d3d4�Z8d>d6d7�Z9Gd8d9�d9e:�Z;Gd: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|jd�n|}t||�}t|t�r6|jd�}|S)Nzutf-8)�
isinstance�unicode_type�encode�_quote�
bytes_type�decode)�sZsafe�r�/usr/lib/python3.6/common.pyr@s



rcCs t|�}t|t�r|jd�}|S)Nzutf-8)�_unquoterrr)rrrrrJs

rcCs,t|�}t|�}t|t�r|S|jd�SdS)Nzutf-8)�encode_params_utf8�
_urlencoderr
r)�paramsZutf8_params�
urlencodedrrrr	Ts

r	cCsPg}xF|D]>\}}|jt|t�r*|jd�n|t|t�r@|jd�n|f�q
W|S)ziEnsures that all parameters in a list of 2-element tuples are encoded to
    bytestrings using UTF-8
    zutf-8)�appendrr
r)rZencoded�k�vrrrr]s rcCsPg}xF|D]>\}}|jt|t�r*|jd�n|t|t�r@|jd�n|f�q
W|S)zfEnsures that all parameters in a list of 2-element tuples are decoded to
    unicode using UTF-8.
    zutf-8)rrrr)rZdecodedrrrrr�decode_params_utf8is rz=&;:%+~,*@!()/?cCst|r.t|�tkr.d}t|t|�t|f��tj|�r@td��trZt|t�rZ|jd�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.zutf-8T)�keep_blank_values)�setr�
ValueError�INVALID_HEX_PATTERN�search�PY3rr
r�urlparse�	parse_qslr)�query�errorrrrr�	urldecodexs

r(cCs�t|t�st|t�r<yt|�}Wq�tk
r8d}Yq�Xnnt|d�r�yt|�Wn.tk
rjd}Yq�tk
r�d}Yq�Xtt|t�r�|j	�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__)rrr
r(r �hasattr�dict�	TypeError�list�itemsr)�rawrrrr�extract_params�s 


r0cCstttd��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
    �@)r
r�generate_timestamprrrr�generate_nonce�sr3cCstttj���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�timerrrrr2�s	r2�cs$t��dj��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|]}�j��VqdS)N)Zchoice)�.0�x)�chars�randrr�	<genexpr>�sz!generate_token.<locals>.<genexpr>)r�join�range)�lengthr:r)r:r;r�generate_token�sr@cCsTddl}tjj�}|j|tj|jd�d�}|j|j�|j||d�}t	|d�}|S)Nr)Zseconds)�scopeZexp�RS256zUTF-8)
�jwt�datetimeZutcnowrAZ	timedeltaZ
expires_in�update�claimsr�
to_unicode)Zprivate_pemZrequestrCZnowrF�tokenrrr�generate_signed_token�s

rIcCsddl}|j||dgd�S)NrrB)Z
algorithms)rCr)Z
public_pemrHrCrrr�verify_signed_token�srJcCs
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.
    )r@)r?r:rrr�generate_client_idsrKcCs2t|t�r|j�}tj|dd�}|j|�t|�S)z)Extend a query with a list of two-tuples.T)r)rr+r.r$r%�extendr	)r&rZqueryparamsrrr�add_params_to_qss


rMFc	CsFtj|�\}}}}}}|r&t||�}n
t||�}tj||||||f�S)z5Add a list of two-tuples to the uri query components.)r$rMZ
urlunparse)	�urirZfragmentZschZnet�pathZparr&Zfrarrr�add_params_to_uris

rPcCsLt|�t|�krdSd}x*t||�D]\}}|t|�t|�AO}q$W|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�resultr9�yrrr�safe_string_equals!s	rX�UTF-8cs�t|t�r|St|t�r$t|�d�St|d�r�yt|�Wn4tk
rNYnJtk
rn�fdd�|D�SXt|d�r�|j�}t�fdd�|D��S|S)z:Convert a number of different types of objects to unicode.)�encodingr)c3s|]}t|��VqdS)N)rG)r8�i)rZrrr<Bszto_unicode.<locals>.<genexpr>r.c3s&|]\}}t|��t|��fVqdS)N)rG)r8rr)rZrrr<Gs)rr
rr*r+r,r r.)�datarZr)rZrrG3s



rGcsbeZdZdZiZdd�Zdd�Z�fdd�Z�fdd	�Zddd�Z	�fd
d�Z
�fdd�Z�ZS)�CaseInsensitiveDictz3Basic case insensitive dict with strings only keys.cCs2tdd�|D��|_x|D]}||||<qWdS)Ncss|]}|j�|fVqdS)N)�lower)r8rrrrr<Ssz/CaseInsensitiveDict.__init__.<locals>.<genexpr>)r+�proxy)�selfr\rrrr�__init__Rs
zCaseInsensitiveDict.__init__cCs|j�|jkS)N)r^r_)r`rrrr�__contains__Wsz CaseInsensitiveDict.__contains__cs.|j|j�}tt|�j|�|j|j�=dS)N)r_r^�superr]�__delitem__)r`r�key)�	__class__rrrdZszCaseInsensitiveDict.__delitem__cs|j|j�}tt|�j|�S)N)r_r^rcr]�__getitem__)r`rre)rfrrrg_szCaseInsensitiveDict.__getitem__NcCs||kr||S|S)Nr)r`r�defaultrrr�getcszCaseInsensitiveDict.getcs$tt|�j||�||j|j�<dS)N)rcr]�__setitem__r_r^)r`rr)rfrrrjfszCaseInsensitiveDict.__setitem__cs8tt|�j||�x t||�D]}||j|j�<qWdS)N)rcr]rEr+r_r^)r`�args�kwargsr)rfrrrEjszCaseInsensitiveDict.update)N)
�__name__�
__module__�__qualname__�__doc__r_rarbrdrgrirjrE�
__classcell__rr)rfrr]Ls
r]c@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.
    �GETN�utf-8cs��fdd�}||�|_||�|_t||p*i��|_||�|_t|j�|_g|_i|_dddddddddddddddddddddddddddd�|_	|j	j
tt|j
���|j	j
t|jp�g��|j	j
|j�dS)Ncs�rt|��S|S)N)rG)r9)rZrr�<lambda>�sz"Request.__init__.<locals>.<lambda>)Zaccess_tokenZclientZ	client_idZ
client_secret�codeZextra_credentialsZ
grant_typeZredirect_uriZ
refresh_tokenZ
request_tokenZ
response_typerAZscopes�staterH�userZtoken_type_hintZ
response_modeZnonceZdisplay�promptrFZmax_ageZ
ui_localesZ
id_token_hintZ
login_hintZ
acr_values)rN�http_methodr]�headers�bodyr0�decoded_bodyZoauth_paramsZ
validator_log�_paramsrEr+r(�	uri_query)r`rNrzr|r{rZrr)rZrrasL



zRequest.__init__cCs ||jkr|j|St|��dS)N)r~�AttributeError)r`�namerrr�__getattr__�s

zRequest.__getattr__cCsH|j}|jj�}|r$tjdt|��}d|kr4d|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�strrNrz)r`r|r{rrr�__repr__�s
zRequest.__repr__cCstj|j�jS)N)r$rNr&)r`rrrr�szRequest.uri_querycCs|js
gStj|jddd�S)NT)rZstrict_parsing)rr$r%)r`rrr�uri_query_params�s
zRequest.uri_query_paramscCsTtjt�}dd�|jpg|jD�}x|D]}||d7<q*Wdd�|j�D�S)Ncss|]}|dVqdS)rNr)r8�prrrr<�sz+Request.duplicate_params.<locals>.<genexpr>�cSsg|]\}}|dkr|�qS)r�r)r8r�crrr�
<listcomp>�sz,Request.duplicate_params.<locals>.<listcomp>)�collections�defaultdictr4r}r�r.)r`Z	seen_keysZall_keysrrrr�duplicate_params�s

zRequest.duplicate_params)rsNNrt)rmrnrorprar�r��propertyrr�r�rrrrrrps

/
rr)r)F)rY)>rpZ
__future__rrr�rDZlogging�re�sysr5Zsecretsrr�ImportErrorZrandomrZurllibrrrrr	rZurllib.parser$�parseZUNICODE_ASCII_CHARACTER_SETZCLIENT_ID_CHARACTER_SET�compile�
IGNORECASEr�r!Zalways_safeZ	getLogger�log�version_infor#r�r
�bytesrZunicoderrrrr(r0r3r2r@rIrJrKrMrPrXrGr+r]�objectrrrrrr�<module>sr




	1		


$

Filemanager

Name Type Size Permission Actions
__init__.cpython-36.opt-1.pyc File 826 B 0644
__init__.cpython-36.pyc File 826 B 0644
common.cpython-36.opt-1.pyc File 13.21 KB 0644
common.cpython-36.pyc File 13.21 KB 0644
signals.cpython-36.opt-1.pyc File 1.81 KB 0644
signals.cpython-36.pyc File 1.81 KB 0644
uri_validate.cpython-36.opt-1.pyc File 4.48 KB 0644
uri_validate.cpython-36.pyc File 4.48 KB 0644