403Webshell
Server IP : 15.235.198.142  /  Your IP : 216.73.216.178
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux ballsack 6.8.0-45-generic #45-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 30 12:02:04 UTC 2024 x86_64
User : www-data ( 33)
PHP Version : 8.3.6
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/share/netplan/netplan_cli/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/share/netplan/netplan_cli/__pycache__/configmanager.cpython-312.pyc
�

*C�e���p�dZddlZddlZddlZddlZddlZddlZddlmZGd�de	�Z
Gd�de�Zy)znetplan configuration manager�N)�Optionalc�t�eZdZdifd�Zd�Zed��Zed��Zdd�Zd�Z	dd	�Z
d
�Zd�Zd�Z
d
�Zdd�Zy)�
ConfigManager�/c�>�||_tjd��|_tj
j
|jd�|_tj
j
|jd�|_||_	t�|_d|_y)N�netplan_)�prefix�etc�run)
r	�tempfile�mkdtemp�tempdir�os�path�join�temp_etc�temp_run�extra_files�set�new_interfaces�np_state)�selfr	rs   �//usr/share/netplan/netplan_cli/configmanager.py�__init__zConfigManager.__init__sh������'�'�z�:��������T�\�\�5�9��
������T�\�\�5�9��
�&���!�e���15��
�c�T�|j�Jd��t|j|�S�Nz.Must call parse() before accessing the config.)r�getattr)r�attrs  r�__getattr__zConfigManager.__getattr__(s)���}�}�(�Z�*Z�Z�(��t�}�}�d�+�+rc��|j�Jd��i}|j|jj�|j|jj�|j|jj�|Sr)r�update�	ethernets�modems�wifis�r�
interfacess  r�physical_interfacesz!ConfigManager.physical_interfaces,sk���}�}�(�Z�*Z�Z�(��
����$�-�-�1�1�2����$�-�-�.�.�/����$�-�-�-�-�.��rc�6�|j�Jd��i}|j|jj�|j|jj�|j|jj�|j|jj
�|j|jj�|j|jj�|j|jj�|Sr)	rr"�bridges�bonds�
dummy_devices�tunnels�virtual_ethernets�vlans�vrfsr&s  r�virtual_interfacesz ConfigManager.virtual_interfaces5s����}�}�(�Z�*Z�Z�(��
����$�-�-�/�/�0����$�-�-�-�-�.����$�-�-�5�5�6����$�-�-�/�/�0����$�-�-�9�9�:����$�-�-�-�-�.����$�-�-�,�,�-��rNc�z�tj�}	|j|j��|r|D]}|j	|��tj
�|_|jj|�tj�5}|jj|��tjdj!|j#���ddd�|jS#tj$r}tt|���d}~wwxYw#1swY|jSxYw)z�
        Parse all our config files to return an object that describes the system's
        entire configuration, so that it can later be interrogated.

        Returns a libnetplan State wrapper
        )�rootdirN)�output_filezMerged config:
{})�netplan�Parser�load_yaml_hierarchyr	�	load_yaml�Stater�import_parser_results�NetplanException�ConfigurationError�strr�
TemporaryFile�
_dump_yaml�logging�debug�format�read)r�extra_config�parser�f�e�tmps      r�parsezConfigManager.parseCs�����!��
	-��&�&�t�{�{�&�;��%�(�A��$�$�Q�'�(�$�M�M�O�D�M��M�M�/�/��7�
�
#�
#�
%�	C���M�M�$�$��$�5��M�M�.�5�5�c�h�h�j�A�B�	C��}�}����'�'�	-�$�S��V�,�,��	-��	C��}�}��s%�A*C7�AD&�7D#�
D�D#�&D:c��|D]}|j|||��|jj|�d|_y�N)�
_copy_filerr"r)r�config_dict�config_files   r�addzConfigManager.add`sC��&�	C�K��O�O�K��[�)A�B�	C�������,���
rc�`�|rb|jtjj|jd�tjj|j
d��|jtjj|jd�tjj|jdd�d��|jtjj|jd�tjj|jd	d
�d��y)Nzetc/netplanr5�%run/NetworkManager/system-connections�NetworkManagerzsystem-connectionsT)�
missing_ok�run/systemd/network�systemd�network)�
_copy_treerrrr	rr)r�backup_config_dirs  r�backupzConfigManager.backuphs�����O�O�B�G�G�L�L����m�D��G�G�L�L����	�B�
D���������T�[�[�2Y�Z������T�]�]�4D�FZ�[�#'�	�	)�	
��������T�[�[�2G�H������T�]�]�I�y�I�#'�	�	)rc�&�	t|j�D]1}tj|j|�|j|=�3dj	|j
�}dj	|j
�}tjj|�rwtjtjj|jd��|j|tjj|jd��tjj|�rxtjtjj|jd��|j|tjj|jd��yy#t$rX}tjdj	|��tjd�t!j"d�Yd}~yd}~wwxYw)Nz${}/NetworkManager/system-connectionsz{}/systemd/networkrQrTz8Something really bad happened while reverting config: {}zZYou should verify the netplan YAML in /etc/netplan and probably run 'netplan apply' again.���)�dictrr�unlinkrBrr�exists�shutil�rmtreerr	rW�	Exceptionr@�error�sys�exit)r�
extra_file�temp_nm_path�temp_networkd_pathrGs     r�revertzConfigManager.revertssl��	�"�4�#3�#3�4�
1�
��	�	�$�*�*�:�6�7��$�$�Z�0�
1�B�H�H����W�L�!5�!<�!<�T�]�]�!K���w�w�~�~�l�+��
�
�b�g�g�l�l�4�;�;�8_�`�a����� "�����T�[�[�:a� b�d��w�w�~�~�0�1��
�
�b�g�g�l�l�4�;�;�8M�N�O���� 2� "�����T�[�[�:O� P�R�2���		�
�M�M�T�[�[�\]�^�_��M�M�v�w��H�H�R�L�L��		�s�F+F/�/	H�8AH�Hc�B�tj|j�yrK)r_r`r�rs r�cleanupzConfigManager.cleanup�s���
�
�d�l�l�#rc�D�	|j�y#t$rYywxYwrK)rk�FileNotFoundErrorrjs r�__del__zConfigManager.__del__�s"��	��L�L�N�� �	��	�s��	�c�0�tj||�yrK)r_�copy)r�src�dsts   rrLzConfigManager._copy_file�s�����C��rc�V�	tj||�y#t$r|rYy�wxYwrK)r_�copytreerm)rrqrrrSs    rrWzConfigManager._copy_tree�s-��	��O�O�C��%�� �	����		�s��(�(rK)T)F)�__name__�
__module__�__qualname__rr �propertyr(r1rIrOrYrhrkrnrLrW�rrrrsa��!�r�6�,����������:�	)��4$���rrc��eZdZdZy)r<zL
    Configuration could not be parsed or has otherwise failed to apply
    N)rurvrw�__doc__ryrrr<r<�s���	rr<)
r{r@r5rr_rcr�typingr�objectrrar<ryrr�<module>r~s:��$$���	�
�
���C�F�C�L	��	r

Youez - 2016 - github.com/yon3zu
LinuXploit