Warning: chmod(): Operation not permitted in /var/www/html/glamautowash.com/wp-content/plugins/translatepress-developer/index.php on line 8
403WebShell
403Webshell
Server IP : 178.128.116.179  /  Your IP : 216.73.216.247
Web Server : nginx/1.30.3
System : Linux glamautowash 6.8.0-71-generic #71-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 16:52:38 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.4.22
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/sos/report/plugins/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/sos/report/plugins/__pycache__/charmed_mysql.cpython-312.pyc
�

G%@i�&��L�ddlZddlZddlmZmZmZddlmZGd�dee�Zy)�N)�Plugin�	PluginOpt�UbuntuPlugin)�
is_executablec	���eZdZdZdZdZgd�ZdZdZdZ	dZ
d	Zd
ddd
dd�Ze
dded��e
dded��e
dded��e
dded��gZd�Zd�Zd�Zd �Zd!�Zd"�Zd#�Zd$�Zd%�Zy&)'�CharmedMySQLa�
    The Charmed MySQL plugin is used to collect MySQL configuration and logs
    from the Charmed MySQL snap package or K8s deployment.
    It also collects MySQL Router and MySQL Shell configuration and logs
    where available, journal logs for the snap, and snap info.

    If the `dumpdbs` option is set to `True`, the plugin will also try and
    collect the names of the databases that the user has access to. The
    `mysql` user is used by default, but that can be set using the `dbuser`
    option. When using the `dumpdbs` option, you must then provide the
    password for the user using the `dbpass` option or the `MYSQL_PWD`
    environment variable.
    z
Charmed MySQL�
charmed_mysql)zshow databases;z*select * from mysql.juju_units_operations;zPselect * from performance_schema.replication_group_members order by MEMBER_HOST;z"show global status like "%conne%";z,select * from performance_schema.host_cache;zshow ENGINE InnoDB STATUS;z
charmed-mysqlz/var/snap/charmed-mysql/commonz/var/snap/charmed-mysql/current�kubectlz app.kubernetes.io/name=mysql-k8sz
/etc/mysqlz/var/log/mysqlz/etc/mysqlrouterz/var/log/mysqlrouterz/var/log/mysqlsh)�
MYSQL_CONF�
MYSQL_LOGS�MYSQL_ROUTER_CONF�MYSQL_ROUTER_LOGS�MYSQL_SHELL_LOGS�dbuser�mysqlz%Username for database dump collection)�default�val_type�desc�dbpass�z%Password for database dump collection�dumpdbsFzGet name of all databases�
logs_since�48hz9How far back to fetch logs with kubectl --since, K8s onlyc��|jd�}|jd�}dtjvr4|s2|jj	d�tjd}||fS|s|jjd�y||fS)Nrr�	MYSQL_PWDzWMYSQL_PWD present: Using MYSQL_PWD environment variable, user did not provide password.zHdumpdbs_error: option is set, but username and password are not provided)NN)�
get_option�os�environ�soslog�info�warning)�self�db_user�db_passs   �B/usr/lib/python3/dist-packages/sos/report/plugins/charmed_mysql.py�_get_db_credentialsz CharmedMySQL._get_db_credentials[s����/�/�(�+���/�/�(�+���"�*�*�$�W��K�K���1�
��j�j��-�G�������K�K���#�
������c���|j|j�d|j�d��}|ddk(r3tt	|dj�j
���SgS)Nz get pods -A -l z- -o jsonpath='{.items[*].metadata.namespace}'�statusr�output)�exec_cmd�kube_cmd�selector�list�set�strip�split)r"�
namespacess  r%�_determine_namespacesz"CharmedMySQL._determine_namespacesnsi���]�]��}�}�o�-�d�m�m�_�=;�
;�
�
��h��1�$���J�x�0�6�6�8�>�>�@�A�B�B��	r'c��|j|j�d|�d|j�d��}|ddk(r!|dj�j	�SgS)N� -n z
 get pods -l z( -o jsonpath='{.items[*].metadata.name}'r)rr*)r+r,r-r0r1)r"�	namespace�podss   r%�_get_pod_nameszCharmedMySQL._get_pod_nameswsc���}�}��}�}�o�T�)��M�$�-�-��I6�
6�
����>�Q����>�'�'�)�/�/�1�1��	r'c��|j�d|��}|j|�d|j�d�|�d|j��g�|j|�d|j�d|�d��d}|j|�}|j	�}|j
j
�D]R\}}|D]H}	tj|�d	|	�d	|��d
��|�d|�d
|	�d|�d
|�d	|	�d	|��
}
|j|
��J�T|j|�d�|�d�g�|jd��r|j�\}}|r|syd|��}
d|
�d�}d
jd�|jD��}tj �5}d}|d	z|z}t#|dd��5}|j%|�ddd�|D]m}	|�d|�d
|	�d|��}|j|�|�d|�d
|�d
|	�d|��	}
|j|
�|�d|�d
|	�d|�d|�d|�d|��
}|j||	�d ��!��o	ddd�yy#1swY��xYw#1swYyxYw)"Nr5z get all -l z -o widez describe pods -l z	 logs -l z	 --since=z* --all-containers=true --prefix --all-podsr�/T)�exist_okz cp -c � �:z/*/MYSQL_CONF/*.pemz/*/MYSQL_CONF/*.keyr�-h 127.0.0.1 -u�mysql � -ec3�@K�|]}|jdd����y�w)�"z\"N)�replace)�.0�querys  r%�	<genexpr>z6CharmedMySQL._collect_per_namespace.<locals>.<genexpr>�s#�������
�
�d�F�+��s��	mysql_pwd�w�utf8)�encodingz	 exec -c z
 -- mkdir -p z -- sh -lc 'MYSQL_PWD=$(cat z) z "z
"' && rm -rf z_dbs.txt)�suggest_filename)r,�add_cmd_outputr-r8�get_cmd_output_path�
conf_paths�itemsr�makedirsr+�add_forbidden_pathrr&�join�
mysql_queries�tempfile�TemporaryDirectory�open�write)r"r6rr,�
mysql_contr7�dump_files_path�name�path�pod�copy_cmdr#r$�opts�sql_cmd�queries�tmpdir�pwd_file�pwd_path�f�	mkdir_cmd�queries_cmds                      r%�_collect_per_namespacez#CharmedMySQL._collect_per_namespace�s���m�m�_�D���4��	
����j��T�]�]�O�8�<��j�*�4�=�=�/�:�
�	�	
����j�	�$�-�-��	�*��F8�
8�	
�
�
��"�"�9�-���2�2�4���/�/�/�/�1�	(�J�D�$��
(������/�q���Q�t�f�=��M��j��
�|�1�S�E��4�&��&�'�q���Q�t�f�6���
�
�h�'�

(�	(�	
�����2�3���2�3�!
�	��?�?�9�%�#�7�7�9��G�W��'��$�W�I�.�D��t�f�C�(�G��h�h��!�/�/���G�
�,�,�.�
�&�&��!�C�<�(�2���(�C�&�9�%�Q��G�G�G�$�%� ��C�#�*�I�j�\��3�%�@$�$*�8�-���M�M�)�,�$�*�G�J�<�q�#�*�A�c�U�!�H�:�7���M�M�(�+�$�*�I�j�\��3�%�@3�3;�*�B�"�)�3�w�i�0%�%+�H�.� ��'�'�#�,/�5��)9�(��'�
�
�&� %�%��	
�
�s%�>H:�H.�)A:H:�.H7	�3H:�:Ic��|D�cgc]+}|jtjj���-}}tjj|g|���Scc}w�N)�lstriprr[�seprR)r"�base�parts�p�stripped_partss     r%�_join_conf_pathzCharmedMySQL._join_conf_path�sD��9>�?�A�!�(�(�2�7�7�;�;�/�?��?��w�w�|�|�D�2�>�2�2��@s�0Ac�x�|jd�}|j�}|D]}|j||��y)Nr)rr3rg)r"rr2r6s    r%�_process_k8szCharmedMySQL._process_k8s�s=���_�_�\�2�
��/�/�1�
�#�	?�I��'�'�	�:�>�	?r'c��|j|j|j|jdd�|j|j|jdd�g�|j	|j|j|jd�|j|j
|jd�|j|j|jd�|j|j
|jd�|j|j
|jd�g�|j
d�|jd	�|jd
�rY|j�\}}|r|syd|i}d|��}d
|�d�}|j|jD�cgc]
}|�d|�d���c}|��yycc}w)Nrz*.pemz*.keyrr
rrzsnap.charmed-mysql.*zsnap info charmed-mysqlrrr>r?r@z '�')�env)rQrp�snap_path_currentrN�
add_copy_spec�snap_path_common�add_journalrLrr&rS)r"r#r$�	mysql_envr^r_rEs       r%�
_process_snapzCharmedMySQL._process_snap�s������� � ��&�&�����-��
�

� � ��&�&�����-��
�
!
�	�	
���� � ��&�&�����-�
�
� � ��%�%�����-�
�
� � ��&�&���� 3�4�
�
� � ��%�%���� 3�4�
�
� � ��%�%���� 2�3�
�#
�	�0	
���/�0�	
���5�6��?�?�9�%�#�7�7�9��G�W��'��$�g�.�I�$�W�I�.�D��t�f�C�(�G����59�5G�5G�H�E�G�9�B�u�g�Q�'�H��
 �
�&��Is�0G
c��|j|j�ryt|j|j�xrt|j
��S)NT)�is_installed�snap_packagerr,�sysroot�boolr3�r"s r%�
check_enabledzCharmedMySQL.check_enabledsH�����T�.�.�/��
�$�-�-����6�
/���+�+�-�.�	
r'c��|j|j�r|j�t|j|j
�r|j
�yyri)r}r~r{rr,rrrr�s r%�setupzCharmedMySQL.setupsE�����T�.�.�/���� ��������5�����6r'N)�__name__�
__module__�__qualname__�__doc__�
short_desc�plugin_namerSr~rxrvr,r-rNr�strr��option_listr&r3r8rgrprrr{r�r��r'r%rrs����!�J�!�K��M�.#�L�7��9���H�1�H�#�&�/�3�.��J�	��g��8�	
�	��b�3�8�	
�	��u�t�,�	
�	��%�#�L�	
��K�& �&��L�\3�?�:�x	
� r'r)	rrT�sos.report.pluginsrrr�
sos.utilitiesrrr�r'r%�<module>r�s&��
��>�>�'�T �6�<�T r'

Youez - 2016 - github.com/yon3zu
LinuXploit