404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@18.221.157.203: ~ $
3

\�meF7�@sddlZddlZddlZddlmZddlmZmZmZm	Z	m
Z
ddlmZddl
mZmZddlmZddlmZddlmZeje�Zd	Zd
eiZd;ZdZdZddiZdZGdd�d�Z Gdd�dej!�Z"Gdd�de"�Z#dd�Z$dd�Z%d<dd�Z&d=d d!�Z'd"d#�Z(e#ej)ffe"ej)ej*ffgZ+d$d%�Z,ed&k�rddl-Z-ddl.Z.dd'lm/Z/e-j0d(d)�Z1e1j2d*d+d,ed-�e1j2d.d/d0d1dd2�e1j3�Z4e'e4j5e4j6d3�Z7d4e7k�r�ye7d4j8�e7d4<Wn<e9k
�r�e.j:j;d5�e7d4=e/e7d4�j8�e7d6<YnXe<ej=e7d7dd>d:��dS)?�N)�	b64decode)�dmi�net�sources�
url_helper�util)�ug_util)�
EventScope�	EventType)�NoDHCPLeaseError)�EphemeralDHCPv4)�DataSourceHostnamez3http://metadata.google.internal/computeMetadata/v1/�metadata_url�instance-id�availability-zone�local-hostnamezLhttp://metadata.google.internal/computeMetadata/v1/instance/guest-attributes�hostkeyszMetadata-Flavor�GoogleZens4c@seZdZdd�Zddd�ZdS)�GoogleMetadataFetchercCs||_||_||_dS)N)�metadata_address�num_retries�sec_between_retries)�selfrrr�r�#/usr/lib/python3.6/DataSourceGCE.py�__init__ szGoogleMetadataFetcher.__init__Fc	Cs�d}y0|j|}|r|d7}tj|t|j|jd�}Wn6tjk
rj}zd}tj|||�WYdd}~Xn<X|j	dkr�|r�t
j|j�}q�|jj
d�}ntjd||j	�|S)Nz/?recursive=True)�url�headersZretriesZsec_betweenzurl %s raised exception %s��zutf-8zurl %s returned code %s)rr�readurl�HEADERSrrZUrlError�LOG�debug�coderZ
decode_binary�contents�decode)	r�path�is_text�is_recursive�valuer�resp�exc�msgrrr�	get_value%s&
 
zGoogleMetadataFetcher.get_valueN)F)�__name__�
__module__�__qualname__rr-rrrrrsrc@s|eZdZdZdZejejej	hiZ
dd�Zdd�Ze
dd��Zd	d
�Zdd�Zd
d�Zddd�Ze
dd��Ze
dd��ZdS)�
DataSourceGCE�GCEFcCsrtjj||||�d|_|r<tj||�\}}tj|�\|_}t�|_t	j
t	j|ddgi�tg�|_
|j
d|_dS)NZ
datasourcer2r)r�
DataSourcer�default_userrZnormalize_users_groupsZextract_default�dict�metadatarZ
mergemanydictZget_cfg_by_path�BUILTIN_DS_CONFIGZds_cfgr)rZsys_cfg�distro�pathsZusersZ_groupsZ_user_configrrrrJs
zDataSourceGCE.__init__cCs�|j�}|j�r*tj�}t|kr6|jt�|jdt�tjd|�t	|�dksVt
d��x�|D]�}t|j|d�}yh|�Zy t
jtjdt|j|d�d�}Wn2tk
r�}ztjd	||�w\WYdd}~XnXWdQRXWntk
r�w\YnX|d
r\||_tjd|�Pq\W|jdk�rFtjd|j�nt
jtjdt|j|d�d�}|d
�s||d
�rjtj|d�ntj|d�dS|d|_|d|_dS)Nrz"Looking for the primary NIC in: %s�z3The instance has to have at least one candidate NIC)ZifacezCrawl of GCE metadata service)�address�
url_params)�kwargsz,Error fetching IMD with candidate NIC %s: %s�successzPrimary NIC found: %s.z(Did not find a fallback interface on %s.�platform_reports_gce�reasonFz	meta-dataz	user-dataT)Zget_url_params�perform_dhcp_setuprZfind_candidate_nics�DEFAULT_PRIMARY_INTERFACE�remove�insertr!r"�len�AssertionErrorrr8rZlog_time�read_mdr�	ExceptionrZ_fallback_interface�warningZ
cloud_namer6Zuserdata_raw)rr<Zcandidate_nicsZ
candidate_nicZnetwork_context�ret�errr�	_get_dataYsf

"



zDataSourceGCE._get_datacCsdS)Nr)rrrr�launch_index�szDataSourceGCE.launch_indexcCs
|jdS)Nzinstance-id)r6)rrrr�get_instance_id�szDataSourceGCE.get_instance_idcCs|jd}t||j�S)Nzpublic-keys-data)r6�_parse_public_keysr4)r�public_keys_datarrr�get_public_ssh_keys�s
z!DataSourceGCE.get_public_ssh_keyscCsx|D]}t|�qWdS)N)�#_write_host_key_to_guest_attributes)rr�keyrrr�publish_host_keys�s
zDataSourceGCE.publish_host_keyscCst|jdjd�dd�S)Nzlocal-hostname�.rF)r
r6�split)rZfqdnZ
resolve_ipZ
metadata_onlyrrr�get_hostname�szDataSourceGCE.get_hostnamecCs
|jdS)Nzavailability-zone)r6)rrrr�availability_zone�szDataSourceGCE.availability_zonecCs|jjdd�dS)N�-r:r)rX�rsplit)rrrr�region�szDataSourceGCE.regionN)FFF)r.r/r0ZdsnamerAr	ZNETWORKr
ZBOOT_NEW_INSTANCEZBOOTZdefault_update_eventsrrL�propertyrMrNrQrTrWrXr[rrrrr1?s
B
r1c@seZdZdZdS)�DataSourceGCELocalTN)r.r/r0rArrrrr]�sr]cCsRdtt|f}|jd�}tj||tddd�}|j�rBtjd|�ntjd|�dS)Nz%s/%s/%szutf-8ZPUTF)r�datarZrequest_methodZcheck_statusz&Wrote %s host key to guest attributes.z0Unable to write %s host key to guest attributes.)	�GUEST_ATTRIBUTES_URL�HOSTKEY_NAMESPACE�encoderrr �okr!r")Zkey_type�	key_valuerr*rrrrR�s
rRcCs�y|jdd�dd�\}}Wnttfk
r4dSX|dkrBdSytj|�}Wntk
rddSXd|krrdS|d}d}ytjj||�}Wntk
r�dSXtjj�|kS)N��Fz
google-sshZexpireOnz%Y-%m-%dT%H:%M:%S+0000)rV�
ValueError�AttributeError�json�loads�datetimeZstrptimeZutcnow)�
public_keyZschemaZjson_strZjson_objZ
expire_strZ
format_strZexpire_timerrr�_has_expired�s&rlcCs|g}|s|Sxj|D]b}|stdd�|D��r2q|jdd�}t|�dkrLq|\}}|d|fkrt|�r|j|�qW|S)Ncss|]}t|�dkVqdS)�N)�ord)�.0�crrr�	<genexpr>�sz%_parse_public_keys.<locals>.<genexpr>�:r:re�	cloudinit)�allrVrErl�append)rPr4Zpublic_keysrkZsplit_public_key�userrSrrrrO�s
rOTc	Cs|dkrt}ddddd�}t�|d<|r>|dr>d|d<|Stj|�sdtjd|�d||d<|Sd(d*d,d.d0g}t||j|j�}i}xn|D]f\}}}	}
}d}x&|D]}
|j	|
|
|�}|dk	r�|}q�W|	�r�|dk�r�d}|||d<|S|||<q�Wt
j|d�pd�}t
j|d�pd�}|jd�|jd�g}|jdd�j
�}|dk�rz|jd��rz|j|jd��|j|jd��djdd�|D��}|j�|d<|d�r�|djd�d1|d<d |k�r
|d jd!�}|jd"�}|d#k�r�t|�}n|�rtjd$|�||d <||d%<d
|d&<|S)2NF)z	meta-dataz	user-datar>r@r?zNot running on GCE.r@z%s is not resolvablezaddress "%s" is not resolvable�instance-id�instance/idT�availability-zone�
instance/zone�local-hostname�instance/hostname�
instance-data�instance/attributes�project-data�project/attributesz)required key %s returned nothing. not GCEz{}ZsshKeyszssh-keyszblock-project-ssh-keys��true�
cSsg|]}|r|�qSrr)rorSrrr�
<listcomp>;szread_md.<locals>.<listcomp>zpublic-keys-data�/r:z	user-datazutf-8zuser-data-encoding�base64z(unknown user-data-encoding: %s, ignoringz	meta-datar>�rx)rwr�TTF�rz)ryr�TTF�r|)r{r�TTF�r~)r}r�FFT�r�)rr�FFT���)�	MD_V1_URLr?rZis_resolvable_urlr!r"rrrr-rhri�get�lowerru�join�
splitlinesrVrarrI)r;r<�platform_checkrJZurl_mapZmetadata_fetcherZmdZmkeyr9Zrequiredr'r(r)r&Z	new_valuer,Z
instance_dataZproject_dataZ
valid_keysZ
block_projectrPZud�encodingrrrrGsn







rGcCsPtjd�pd}|dks|dkr"dStjd�p.d}|jd�r>dStjd||�d	S)
Nzsystem-product-namezN/AzGoogle Compute EnginerTzsystem-serial-numberzGoogleCloud-z6Not running on google cloud. product-name=%s serial=%sF)rZ
read_dmi_data�
startswithr!r")Zpname�serialrrrr?Qs

r?cCstj|t�S)N)rZlist_from_depends�datasources)Zdependsrrr�get_datasource_listisr��__main__)�	b64encodezQuery GCE Metadata Service)�descriptionz
--endpointZURLz The url of the metadata service.)�metavar�help�defaultz--no-platform-checkr�zIgnore smbios platform checkZstore_false)�destr��actionr�)r;r�z	user-dataz/User-data cannot be decoded. Writing as base64
z
user-data-b64r:�,�: )�indentZ	sort_keysZ
separators)rrr)N)NNT)r�r�)>rjrhZloggingr�rrsrrrrrZcloudinit.distrosrZcloudinit.eventr	r
Zcloudinit.net.dhcprZcloudinit.net.ephemeralrZcloudinit.sourcesr
Z	getLoggerr.r!r�r7ZREQUIRED_FIELDSr_r`r rBrr3r1r]rRrlrOrGr?ZDEP_FILESYSTEMZDEP_NETWORKr�r��argparse�sysr��ArgumentParser�parser�add_argument�
parse_args�argsZendpointr�r^r%�UnicodeDecodeError�stderr�write�print�dumpsrrrr�<module>sn
 {"

M




Filemanager

Name Type Size Permission Actions
DataSourceAkamai.cpython-36.opt-1.pyc File 8.18 KB 0644
DataSourceAkamai.cpython-36.pyc File 8.18 KB 0644
DataSourceAliYun.cpython-36.opt-1.pyc File 3.22 KB 0644
DataSourceAliYun.cpython-36.pyc File 3.22 KB 0644
DataSourceAltCloud.cpython-36.opt-1.pyc File 6.74 KB 0644
DataSourceAltCloud.cpython-36.pyc File 6.74 KB 0644
DataSourceAzure.cpython-36.opt-1.pyc File 47.95 KB 0644
DataSourceAzure.cpython-36.pyc File 47.95 KB 0644
DataSourceBigstep.cpython-36.opt-1.pyc File 1.84 KB 0644
DataSourceBigstep.cpython-36.pyc File 1.84 KB 0644
DataSourceCloudSigma.cpython-36.opt-1.pyc File 3.62 KB 0644
DataSourceCloudSigma.cpython-36.pyc File 3.62 KB 0644
DataSourceCloudStack.cpython-36.opt-1.pyc File 5.97 KB 0644
DataSourceCloudStack.cpython-36.pyc File 5.97 KB 0644
DataSourceConfigDrive.cpython-36.opt-1.pyc File 8.18 KB 0644
DataSourceConfigDrive.cpython-36.pyc File 8.18 KB 0644
DataSourceDigitalOcean.cpython-36.opt-1.pyc File 3.65 KB 0644
DataSourceDigitalOcean.cpython-36.pyc File 3.65 KB 0644
DataSourceEc2.cpython-36.opt-1.pyc File 23.49 KB 0644
DataSourceEc2.cpython-36.pyc File 23.49 KB 0644
DataSourceExoscale.cpython-36.opt-1.pyc File 5.92 KB 0644
DataSourceExoscale.cpython-36.pyc File 5.92 KB 0644
DataSourceGCE.cpython-36.opt-1.pyc File 9.83 KB 0644
DataSourceGCE.cpython-36.pyc File 9.93 KB 0644
DataSourceHetzner.cpython-36.opt-1.pyc File 3.78 KB 0644
DataSourceHetzner.cpython-36.pyc File 3.78 KB 0644
DataSourceIBMCloud.cpython-36.opt-1.pyc File 12.44 KB 0644
DataSourceIBMCloud.cpython-36.pyc File 12.44 KB 0644
DataSourceLXD.cpython-36.opt-1.pyc File 13.31 KB 0644
DataSourceLXD.cpython-36.pyc File 13.31 KB 0644
DataSourceMAAS.cpython-36.opt-1.pyc File 11.86 KB 0644
DataSourceMAAS.cpython-36.pyc File 11.86 KB 0644
DataSourceNWCS.cpython-36.opt-1.pyc File 3.77 KB 0644
DataSourceNWCS.cpython-36.pyc File 3.77 KB 0644
DataSourceNoCloud.cpython-36.opt-1.pyc File 7.97 KB 0644
DataSourceNoCloud.cpython-36.pyc File 7.97 KB 0644
DataSourceNone.cpython-36.opt-1.pyc File 1.47 KB 0644
DataSourceNone.cpython-36.pyc File 1.47 KB 0644
DataSourceOVF.cpython-36.opt-1.pyc File 9.15 KB 0644
DataSourceOVF.cpython-36.pyc File 9.15 KB 0644
DataSourceOpenNebula.cpython-36.opt-1.pyc File 11.75 KB 0644
DataSourceOpenNebula.cpython-36.pyc File 11.75 KB 0644
DataSourceOpenStack.cpython-36.opt-1.pyc File 7.91 KB 0644
DataSourceOpenStack.cpython-36.pyc File 7.91 KB 0644
DataSourceOracle.cpython-36.opt-1.pyc File 10.99 KB 0644
DataSourceOracle.cpython-36.pyc File 10.99 KB 0644
DataSourceRbxCloud.cpython-36.opt-1.pyc File 7.19 KB 0644
DataSourceRbxCloud.cpython-36.pyc File 7.19 KB 0644
DataSourceScaleway.cpython-36.opt-1.pyc File 10.84 KB 0644
DataSourceScaleway.cpython-36.pyc File 10.84 KB 0644
DataSourceSmartOS.cpython-36.opt-1.pyc File 24.51 KB 0644
DataSourceSmartOS.cpython-36.pyc File 24.51 KB 0644
DataSourceUpCloud.cpython-36.opt-1.pyc File 4.36 KB 0644
DataSourceUpCloud.cpython-36.pyc File 4.36 KB 0644
DataSourceVMware.cpython-36.opt-1.pyc File 23.66 KB 0644
DataSourceVMware.cpython-36.pyc File 23.66 KB 0644
DataSourceVultr.cpython-36.opt-1.pyc File 3.44 KB 0644
DataSourceVultr.cpython-36.pyc File 3.44 KB 0644
__init__.cpython-36.opt-1.pyc File 30.52 KB 0644
__init__.cpython-36.pyc File 30.52 KB 0644