- GRAYBYTE UNDETECTABLE CODES -

403Webshell
Server IP : 184.154.167.98  /  Your IP : 18.224.70.66
Web Server : Apache
System : Linux pink.dnsnetservice.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
User : puertode ( 1767)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3.6/site-packages/cloudinit/sources/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3.6/site-packages/cloudinit/sources/__pycache__/DataSourceAkamai.cpython-36.pyc
3

\�me�2�	@s.ddlZddlZddlZddlmZddlmZddlm	Z	ddl
mZmZm
Z
mZddlmZmZmZddlmZmZddlmZdd	lmZmZmZeje�Zd
dd�d
ddd�ddddddgd�ZGdd�de	�Z Gdd�dej!�Z"Gdd�de"�Z#e#ej$ffe"ej$ej%ffgZ&eej!d�dd�Z'dS)�N)�	b64decode)�suppress)�Enum)�Any�List�Tuple�Union)�sources�
url_helper�util)�find_fallback_nic�get_interfaces_by_mac)�EphemeralIPNetwork)�get_dmi_config�get_local_instance_id�is_on_akamaizhttp://169.254.169.254zhttp://[fd00:a9fe:a9fe::1])�ipv4�ipv6z	/v1/tokenz/v1/instancez
/v1/user-data)�token�metadata�userdataTzf2:3)�	base_urls�paths�allow_local_stage�allow_init_stage�
allow_dhcp�
allow_ipv4�
allow_ipv6�preferred_mac_prefixesc@seZdZdZdZdZdZdS)�MetadataAvailabilityResultzj
    Used to indicate how this instance should behave based on the availability
    of metadata to it
    r��N)�__name__�
__module__�__qualname__�__doc__�
NOT_AVAILABLE�	AVAILABLE�DEFER�r)r)�&/usr/lib/python3.6/DataSourceAkamai.pyr-src@s�eZdZdZdZdd�Zdeeed�dd�Ze	d�d	d
�Z
e	d�dd�Ze	d�d
d�Ze
eeeefefd�dd�Zdeed�dd�Zed�dd�Zed�dd�ZdS)�DataSourceAkamai�AkamaiFcCsJtjd�tjj||||�t�|_tjt	�tj
|ddgi�tg�|_dS)NzSetting up Akamai DataSourceZ
datasourcer,)
�LOG�debugr	�
DataSource�__init__�dictrrZ
mergemanydictrZget_cfg_by_path�BUILTIN_DS_CONFIG�ds_cfg)�self�sys_cfg�distrorr)r)r*r0<s
zDataSourceAkamai.__init__)�	path_name�use_v6�returncCs\||jdkrtdj|���d}|s0|jdr4d}|jd|}|jd|}dj||�S)z�
        Looks up the path for a given name and returns a full url for it.  If
        use_v6 is passed in, the IPv6 base url is used; otherwise the IPv4 url
        is used unless IPv4 is not allowed in ds_cfg
        rzUnknown path name {}rrrrz{}{})r3�
ValueError�format)r4r7r8Zversion_keyZbase_url�pathr)r)r*�
_build_urlNszDataSourceAkamai._build_url)r9cCsZ|jdr|jds0|jdr@|jdr@tjd�tjS|jrN|j�S|j�SdS)z�
        Returns whether metadata should be retrieved at this stage, at the next
        stage, or never, in the form of a MetadataAvailabilityResult.
        rrrrz*Configuration prohibits fetching metadata.N)r3r-�inforr&�local_stage�_should_fetch_data_local�_should_fetch_data_network)r4r)r)r*�_should_fetch_data`s
z#DataSourceAkamai._should_fetch_datacCsH|jdstjd�tjS|jdrB|jdrBtjd�tjStjS)z�
        Returns whether metadata should be retrieved during the local stage, or
        if it should wait for the init stage.
        rz)Configuration prohibits local stage setuprrz9Configuration does not allow for ephemeral network setup.)r3r-r>rr(r')r4r)r)r*r@ts

z)DataSourceAkamai._should_fetch_data_localcCs |jdstjd�tjStjS)zS
        Returns whether metadata should be fetched during the init stage.
        rz1Configuration does not allow for init stage setup)r3r-r>rr(r')r4r)r)r*rA�s

z+DataSourceAkamai._should_fetch_data_networkcs�g}|jr�t�}d}|jd}x0|j�D]$\�}t�fdd�|D��r(|}Pq(W|dkrhtjd�t�}g}|jdr�|jt	|j
|ddd	�df�|jd
r�|jdr�|jt	|j
|dd�df�n4|jdr�|jt�df�|jd
r�|jt�df�|S)
z�
        Returns a list of context managers which should be tried when setting
        up a network context.  If we're running in init mode, this return a
        noop since networking should already be configured.
        Nrcsg|]}�j|��qSr))�
startswith)�.0�prefix)�macr)r*�
<listcomp>�szBDataSourceAkamai._get_network_context_managers.<locals>.<listcomp>zGFailed to find default interface, attempting DHCP on fallback interfacerFT)rrrr)r)r?r
r3�items�anyr-�warningr�appendrr6�noop)r4�network_context_managersZ
interfacesZ	interfaceZpreferred_prefixes�infr))rFr*�_get_network_context_managers�sN





z.DataSourceAkamai._get_network_context_managers)r8r9cCs4y�tj|jd|d�ddddddid	�}|jd
krBtjd|j�dSt|�}tj|jd
|d�dddd|d�d�}tjt|��|_	tj|jd|d�dddd|id�}t|�|_
yt|j
�j�|_
Wn0t
jk
r�}ztjd|�WYdd}~XnXWn<tjk
�r.}ztjd|�rdnd|�dSd}~XnXdS)z�
        Runs through the sequence of requests necessary to retrieve our
        metadata and user data, creating a token for use in doing so, capturing
        the results.
        r)r8ZPUT�r!�zMetadata-Token-Expiry-SecondsZ300)Zrequest_method�timeout�sec_between�retries�headers��z-Fetching token returned %s; not fetching dataTrzapplication/json)ZAcceptzMetadata-Token)rRrSrTrUrzMetadata-Tokenz*Failed to base64 decode userdata due to %sNz1Failed to retrieve metadata using IPv%s due to %s�6�4F)r
Zreadurlr=�coder-r>�str�json�loadsrZuserdata_rawr�decode�binascii�ErrorrJZUrlError)r4r8Ztoken_responserrr�er)r)r*�_fetch_metadata�sP

"z DataSourceAkamai._fetch_metadatacCs�tjd�t�stjd�dSt�}d|i|_|j�}|tjkrf|tj	krXtjd�dStjd�dS|j
�}xP|D]>\}}|�,|j|d�}|r�|jjd	|�|jd<PWd
QRXqtWtj
d�dS)zW
        Overrides _get_data in the DataSource class to actually retrieve data
        z#Getting data from Akamai DataSourcez#Not running on Akamai, not running.Fzinstance-idz5Metadata is not available, returning local data only.TzFConfigured not to fetch data at this stage; waiting for a later stage.)r8�idNzHFailed to contact metadata service, falling back to local metadata only.)r-r.rr>rrrBrr'r&rOra�getrJ)r4Zlocal_instance_idZavailabilityrMZmanagerr8�doner)r)r*�	_get_data's6




zDataSourceAkamai._get_datacCstj|j�d�S)zj
        A local-only check to see if the instance id matches the id we see on
        the system
        zsystem-serial-number)r	Zinstance_id_matches_system_uuidZget_instance_id)r4r5r)r)r*�check_instance_id[sz"DataSourceAkamai.check_instance_idN)F)F)r"r#r$Zdsnamer?r0rZ�boolr=rrBr@rArrrrrrOrarerfr)r)r)r*r+8s
"MD4r+c@seZdZdZdZdS)�DataSourceAkamaiLocalz�
    A subclass of DataSourceAkamai that runs the same functions, but during the
    init-local stage.  This allows configuring networking via cloud-init, as
    networking hasn't been configured yet.
    TN)r"r#r$r%r?r)r)r)r*rhesrh)r9cCstj|t�S)N)r	Zlist_from_depends�datasources)Zdependsr)r)r*�get_datasource_listsrj)(r^r[Zlogging�base64r�
contextlibrrL�enumrZtypingrrrrZ	cloudinitr	r
rZ
cloudinit.netrr
Zcloudinit.net.ephemeralrZ cloudinit.sources.helpers.akamairrrZ	getLoggerr"r-r2rr/r+rhZDEP_FILESYSTEMZDEP_NETWORKrirjr)r)r)r*�<module>s@

/


Youez - 2016 - github.com/yon3zu
LinuXploit