404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@3.136.18.192: ~ $
3

�~�fY �@s�ddlZddlZddlZddlmZmZmZddlmZddl	m
Z
mZddl	mZ
ddl	mZddlmZddlmZeje�ZGd	d
�d
�ZGdd�de
j�Zd
d�Zdd�Zdd�Zee
je
jffgZdd�ZdS)�N)�gaierror�getaddrinfo�	inet_ntoa)�pack)�sources�subp)�
url_helper)�util)�dhcp)�ec2c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�CloudStackPasswordServerClienta�
    Implements password fetching from the CloudStack password server.

    http://cloudstack-administration.readthedocs.org/
       en/latest/templates.html#adding-password-management-to-your-templates
    has documentation about the system.  This implementation is following that
    found at
    https://github.com/shankerbalan/cloudstack-scripts/
       blob/master/cloud-set-guest-password-debian
    cCs
||_dS)N)�virtual_router_address)�selfr
�r�*/usr/lib/python3.6/DataSourceCloudStack.py�__init__*sz'CloudStackPasswordServerClient.__init__c
Cs:tjddddddddd	d
j|�dj|j�g�\}}|j�S)NZwgetz--quietz--tries�3z	--timeoutZ20z--output-document�-z--headerzDomU_Request: {0}z{0}:8080)r�formatr
�strip)rZdomu_request�output�_rrr�_do_request-sz*CloudStackPasswordServerClient._do_requestcCs4|jd�}|dkrdS|dkr&td��|jd�|S)NZsend_my_password��saved_passwordZbad_requestz-Error when attempting to fetch root password.)rr)r�RuntimeError)r�passwordrrr�get_passwordBs

z+CloudStackPasswordServerClient.get_passwordN)�__name__�
__module__�__qualname__�__doc__rrrrrrrrs
rc@sLeZdZdZdZdZdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
edd��ZdS)�DataSourceCloudStackZ
CloudStack�x�2cCsXtjj||||�tjj|jd�|_d|_t�|_	|j	s@t
d��d|j	f|_i|_dS)NZcsZlatestzNo virtual router found!z
http://%s/)
r�
DataSourcer�os�path�join�seed_dir�api_ver�get_vr_address�vr_addrr�metadata_address�cfg)rZsys_cfgZdistro�pathsrrrrTszDataSourceCloudStack.__init__cCs~|j�}|jdkrdStj|jd�g}tj�}tj||j|jtj	d�\}}|r\tj
d|�ntjd|ttj�|��t
|�S)NrFzlatest/meta-data/instance-id)�urlsZmax_waitZtimeoutZ	status_cbzUsing metadata source: '%s'z>Giving up on waiting for the metadata from %s after %s seconds)Zget_url_paramsZmax_wait_seconds�uhelpZcombine_urlr-�timeZwait_for_urlZtimeout_seconds�LOGZwarning�debugZcritical�int�bool)rZ
url_paramsr0�
start_timeZurlZ	_responserrr�wait_for_metadata_service`s$
z.DataSourceCloudStack.wait_for_metadata_servicecCs|jS)N)r.)rrrr�get_config_objsz#DataSourceCloudStack.get_config_objcCsi}tj||jdd�r>|d|_|d|_tjd|j�dSy�|j�sLdStj�}t	j
|j|j�|_t	j
|j|j�|_tjdttj�|��t|j�}y|j�}Wn$tk
r�tjtd	|j�YnX|r�d|d
did�|_dStk
�r
tjtd|j�dSXdS)
N�/)�basez	user-dataz	meta-dataz%Using seeded cloudstack data from: %sTFz)Crawl of metadata service took %s secondsz/Failed to fetch password from virtual router %sZexpire)Z
ssh_pwauthrZchpasswdz(Failed fetching from metadata service %s)r	Zread_optional_seedr)Zuserdata_raw�metadatar3r4r8r2rZget_instance_userdatar*r-Zget_instance_metadatar5rr,r�	ExceptionZlogexcr.)rZseed_retr7Zpassword_clientZset_passwordrrr�	_get_data�sH


zDataSourceCloudStack._get_datacCs
|jdS)Nzinstance-id)r<)rrrr�get_instance_id�sz$DataSourceCloudStack.get_instance_idcCs
|jdS)Nzavailability-zone)r<)rrrr�availability_zone�sz&DataSourceCloudStack.availability_zoneN)
rrr ZdsnameZurl_max_waitZurl_timeoutrr8r9r>r?�propertyr@rrrrr"Ls0r"cCsBytdd�}Wntk
r,tjd�dSX|dddSdS)Nzdata-server�PzDNS Entry data-server not foundr�)rrr3r4)Zaddrinforrr�get_data_server�s
rDcCs^tjd�j�}xJ|D]B}|jd�}|ddkrttdt|dd���}tjd|�|SqWdS)	Nz/proc/net/route�	�Z00000000z<L��z"Found default route, gateway is %s)	r	Z	load_file�
splitlines�splitrrr5r3r4)�lines�line�itemsZgwrrr�get_default_gateway�s

rNcCsjt�}|rtjd|�|Stjd�}|r8tjd|�|Stjj�}|rZtjj|�}|rZ|Stjd�t�S)Nz4Found metadata server '%s' via data-server DNS entryZSERVER_ADDRESSz-Found SERVER_ADDRESS '%s' via networkd_leasesz$No DHCP found, using default gateway)	rDr3r4r
Znetworkd_get_option_from_leasesZIscDhclientZget_latest_leaseZ!parse_dhcp_server_from_lease_filerN)Zlatest_addressZ
lease_filerrrr+�s&


r+cCstj|t�S)N)rZlist_from_depends�datasources)Zdependsrrr�get_datasource_list�srP) Zloggingr&r2Zsocketrrr�structrZ	cloudinitrrrr1r	Z
cloudinit.netr
Zcloudinit.sources.helpersrZ	getLoggerrr3rr%r"rDrNr+ZDEP_FILESYSTEMZDEP_NETWORKrOrPrrrr�<module>s"
.n
&

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