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 :  /lib/python3.9/site-packages/sos/policies/runtimes/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3.9/site-packages/sos/policies/runtimes/__pycache__/lxd.cpython-39.pyc
a

ܓ�iI�@s@ddlZddlmZddlmZddlmZGdd�de�ZdS)�N)�ContainerRuntime)�sos_get_command_output)�
is_executablec@sLeZdZdZdZdZdd�Zddd�Zd	d
�Zdd�Z	d
d�Z
ddd�ZdS)�LxdContainerRuntimez,Runtime class to use for systems running LXD�lxd�lxccCsFtd|jj�rB|jj�d�rB|jj�d�s8|jj�d�rBd|_dSdS)Nrrzsnap.lxd.daemonTF)r�policy�sysrootZpackage_managerZpkg_by_nameZinit_systemZ
is_running�active)�self�r�=/usr/lib/python3.9/site-packages/sos/policies/runtimes/lxd.py�check_is_actives���z#LxdContainerRuntime.check_is_activeFcCsxg}|j�d�}|jrtt||jjd�}|ddkrtt�|d�}|D].}|ddksX|rD|�|dd|d	f�qD|S)
z�Get a list of containers present on the system.

        :param get_all: If set, include stopped containers as well
        :type get_all: ``bool``
        z list --format json��chroot�statusr�outputZRunningZexpanded_configz
volatile.uuid�name)�binaryr
rrr	�json�loads�append)rZget_allZ
containersZ_cmd�out�out_json�	containerrrr
�get_containers"s
��z"LxdContainerRuntime.get_containerscCslg}|jrht|j�d�|jjd�}|ddkrht�|d�}|D]&}d|vr@|�|dd|df�q@|S)	z�Get a list of images present on the system

        :returns: A list of 2-tuples containing (image_name, image_id)
        :rtype: ``list``
        z image list --format jsonrrrrZ
update_source�aliasZfingerprint�r
rrrr	rrr)rZimagesrr�entrrr
�
get_images:s
�
�zLxdContainerRuntime.get_imagescCs�g}d}|jr�t|j�d�|jjd�}|ddkrvt�|d�}|D]0}|ddkrDd|d	vrD|d	dd
}qvqDt|j�d|�d�|jjd�}|ddkr�t�|d�}|D]}|�|d�q�|S)
z�Get a list of container volumes present on the system

        :returns: A list of volume IDs on the system
        :rtype: ``list``
        �defaultz profile list --format jsonrrrrr�rootZdevicesZpoolz storage volume list z --format jsonr)rZvolsZstg_poolrrZprofilerrrr
�get_volumesPs0
�
��zLxdContainerRuntime.get_volumescCs|j�d|�d�S)a!Get the command string used to dump container logs from the
        runtime

        :param container: The name or ID of the container to get logs for
        :type container: ``str``

        :returns: Formatted runtime command to get logs from `container`
        :type: ``str``
        z info z --show-log)r)rrrrr
�get_logs_commandqs
z$LxdContainerRuntime.get_logs_commandNcCs:|r |j�d|�d|�d|��S|j�d|�|�d|��S)a,Generate the command string used to copy a file out of a container
        by way of the runtime.

        :param container:   The name or ID of the container
        :type container:    ``str``

        :param path:        The path to copy from the container. Note that at
                            this time, no supported runtime supports globbing
        :type path:         ``str``

        :param dest:        The destination on the *host* filesystem to write
                            the file to
        :type dest:         ``str``

        :param sizelimit:   Limit the collection to the last X bytes of the
                            file at PATH
        :type sizelimit:    ``int``

        :returns:   Formatted runtime command to copy a file from a container
        :rtype:     ``str``
        � z	 tail -c z file pull )Zrun_cmdr)rr�path�destZ	sizelimitrrr
�get_copy_command}sz$LxdContainerRuntime.get_copy_command)F)N)�__name__�
__module__�__qualname__�__doc__rrrrrr"r#r'rrrr
rs

!r)rZsos.policies.runtimesrZ
sos.utilitiesrrrrrrr
�<module>s

Youez - 2016 - github.com/yon3zu
LinuXploit