403Webshell
Server IP : 77.50.203.18  /  Your IP : 192.168.0.10
Web Server : Apache/2.4.62 (CentOS Stream) OpenSSL/3.5.7 mpm-itk/2.4.7-04 PHP/8.4.23
System : Linux web2 5.14.0-722.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Jul 6 09:07:51 UTC 2026 x86_64
User : warsnews.ru ( 1001)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3.9/site-packages/sos/report/plugins/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3.9/site-packages/sos/report/plugins/__pycache__/gcp.cpython-39.opt-1.pyc
a

ܓ�i6�@sVddlZddlmZddlmZddlmZddlmZm	Z	m
Z
Gdd�dee	�ZdS)�N)�Any)�request)�URLError)�Plugin�IndependentPlugin�	PluginOptc@s�eZdZdZdZdZedddd�gZdZd	Z	d
Z
dZdd
�Zdd�Z
dd�Zed�dd�Zeed�dd�Zdd�Zeeed�dd��ZdS)�GCPzGoogle Cloud Platform�gcp)Zvirt�keep-piiFzyStop the plugin from removing PIIs like project name or organization ID from the metadata retrieved from Metadata server.)�defaultZdescz(/sys/devices/virtual/dmi/id/product_namezBhttp://metadata.google.internal/computeMetadata/v1/?recursive=truez[--REDACTED--]NcCsZz@t|jdd��}d|��vWd�WS1s40YWntyTYdS0dS)zo
        Checks if this plugin should be executed based on the presence of
        GCE entry in sysfs.
        zutf-8)�encodingzGoogle Compute EngineNF)�open�PRODUCT_PATH�read�OSError)�selfZsys_file�r�:/usr/lib/python3.9/site-packages/sos/report/plugins/gcp.py�
check_enabled$s
0zGCP.check_enabledcCs$|jddgd�|jddgd�dS)z�
        Collect the following info:
         * `gcloud auth list` output
         * Any google services output from journal
        zgcloud auth listr	��tagszgoogle*)ZunitsrN)Zadd_cmd_outputZadd_journal�rrrr�setup/sz	GCP.setupcCs�|jddgd��p}z,|��|_|��|�tj|jdd��Wn2typ}z|�t|��WYd}~n
d}~00Wd�n1s�0Yd}|j	j
�d�}|r�|�|�dS)Nz
metadata.jsonr	r�)�indentzAcurl -v --connect-timeout 10https://rhui.googlecloud.com/zone.txtzgoogle-rhui-client)
Zcollection_file�get_metadata�metadata�scrub_metadata�write�json�dumps�RuntimeError�strZpolicyZpackage_managerZall_pkgs_by_name_regexZcollect_cmd_output)rZmfile�errZcurl_commandZrhui_packagerrr�collect<s
B�zGCP.collect)�returncCs|�|j�}t�|�S)zq
        Retrieves metadata from the Metadata Server and transforms it into a
        dictionary object.
        )�_query_address�METADATA_QUERYr�loads)rZ
response_bodyrrrrOszGCP.get_metadata)�urlr%c
Cs�zvtj|ddid�}t�|��F}|jdkrHtd|j�d�|������|����Wd�WS1sj0YWn6ty�}ztdt|��|�WYd}~n
d}~00dS)	zf
        Query the given url address with headers required by Google Metadata
        Server.
        zMetadata-FlavorZGoogle)Zheaders��z2Failed to communicate with Metadata Server (code: z): Nz,Failed to communicate with Metadata Server: )	rZRequestZurlopen�coder!r�decoderr")rr)ZreqZresponser#rrrr&Ws$
�
��0
��zGCP._query_addresscs���d�rdS�jdd��jdd�t���ttd������fdd����j��_���jdd	d
����jdd	d�dS)a"
        Remove all PII information from metadata, unless a keep-pii option
        is specified.

        Note: PII information collected by this plugin, like
        project number, account names etc. might be required by Google
        Cloud Support for faster issue resolution.
        r
NZprojectZ	projectIdZnumericProjectId)�datar%cs�t|t�r2d|vr�j|d<�fdd�|��D�St|t�rN�fdd�|D�St|t�rp|���j����j�St|t�r�|�kr��jS|S|S)N�tokencsi|]\}}�|��|��qSrr)�.0�k�v��scrubrr�
<dictcomp>��z5GCP.scrub_metadata.<locals>.scrub.<locals>.<dictcomp>csg|]}�|��qSrr)r/�valuer2rr�
<listcomp>�r5z5GCP.scrub_metadata.<locals>.scrub.<locals>.<listcomp>)�
isinstance�dict�REDACTED�items�listr"�replace�int)r-�Z
project_idZproject_numberZproject_number_intr3rrrr3zs



�
z!GCP.scrub_metadata.<locals>.scrubZ
attributeszssh-keysZsshKeys)Z
get_optionrr"r�safe_redact_keyrrr?rrjs	
��zGCP.scrub_metadata)�dict_obj�keycCs||vr|j||<dS)z
 Redact keys N)r:)�clsrArBrrrr@�szGCP.safe_redact_key)�__name__�
__module__�__qualname__Z
short_descZplugin_nameZprofilesrZoption_listrr'r:rrrr$r9rr"r&r�classmethodr@rrrrrs&��
'r)r�typingrZurllibrZurllib.errorrZsos.report.pluginsrrrrrrrr�<module>s


Youez - 2016 - github.com/yon3zu
LinuXploit