Linux anchor 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64
Apache/2.4.18 (Ubuntu)
Server IP : 10.10.100.4 & Your IP : 216.73.217.150
Domains :
Cant Read [ /etc/named.conf ]
User : www-data
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
usr /
lib /
python3 /
dist-packages /
uaclient /
Delete
Unzip
Name
Size
Permission
Date
Action
__pycache__
[ DIR ]
drwxr-xr-x
2022-07-09 11:30
clouds
[ DIR ]
drwxr-xr-x
2022-07-09 11:30
entitlements
[ DIR ]
drwxr-xr-x
2022-07-09 11:30
jobs
[ DIR ]
drwxr-xr-x
2022-07-09 11:30
__init__.py
0
B
-rw-r--r--
2020-10-15 16:52
actions.py
3.48
KB
-rw-r--r--
2022-05-18 21:44
apt.py
18.11
KB
-rw-r--r--
2022-05-18 21:44
cli.py
62.34
KB
-rw-r--r--
2022-05-18 21:44
config.py
31.85
KB
-rw-r--r--
2022-05-18 21:44
contract.py
21.14
KB
-rw-r--r--
2022-05-18 21:44
daemon.py
3.93
KB
-rw-r--r--
2022-05-18 21:44
data_types.py
5.91
KB
-rw-r--r--
2022-05-18 21:44
defaults.py
1.58
KB
-rw-r--r--
2022-05-18 21:44
event_logger.py
7.9
KB
-rw-r--r--
2022-05-18 21:44
exceptions.py
11.41
KB
-rw-r--r--
2022-05-18 21:44
gpg.py
813
B
-rw-r--r--
2021-04-29 18:29
lock.py
3.51
KB
-rw-r--r--
2022-04-01 15:27
messages.py
24.9
KB
-rw-r--r--
2022-05-18 21:44
pip.py
756
B
-rw-r--r--
2022-04-01 15:27
security.py
43
KB
-rw-r--r--
2022-05-18 21:44
security_status.py
6.69
KB
-rw-r--r--
2022-05-18 21:44
serviceclient.py
5.8
KB
-rw-r--r--
2022-05-18 21:44
snap.py
2.92
KB
-rw-r--r--
2022-04-01 15:27
status.py
22.92
KB
-rw-r--r--
2022-05-18 21:44
types.py
308
B
-rw-r--r--
2022-04-01 15:27
util.py
32.71
KB
-rw-r--r--
2022-05-18 21:44
version.py
1.94
KB
-rw-r--r--
2022-06-20 16:29
Save
Rename
import logging from typing import List, Optional from uaclient import apt, event_logger, exceptions, messages, util SNAP_CMD = "/usr/bin/snap" SNAP_INSTALL_RETRIES = [0.5, 1.0, 5.0] HTTP_PROXY_OPTION = "proxy.http" HTTPS_PROXY_OPTION = "proxy.https" event = event_logger.get_event_logger() def is_installed() -> bool: """Returns whether or not snap is installed""" return "snapd" in apt.get_installed_packages() def configure_snap_proxy( http_proxy: Optional[str] = None, https_proxy: Optional[str] = None, retry_sleeps: Optional[List[float]] = None, ) -> None: """ 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. """ if not util.which(SNAP_CMD): logging.debug( "Skipping configure snap proxy. {} does not exist.".format( SNAP_CMD ) ) return if http_proxy or https_proxy: event.info(messages.SETTING_SERVICE_PROXY.format(service="snap")) if http_proxy: util.subp( ["snap", "set", "system", "proxy.http={}".format(http_proxy)], retry_sleeps=retry_sleeps, ) if https_proxy: util.subp( ["snap", "set", "system", "proxy.https={}".format(https_proxy)], retry_sleeps=retry_sleeps, ) def unconfigure_snap_proxy( protocol_type: str, retry_sleeps: Optional[List[float]] = None ) -> None: """ 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. """ if not util.which(SNAP_CMD): logging.debug( "Skipping unconfigure snap proxy. {} does not exist.".format( SNAP_CMD ) ) return util.subp( ["snap", "unset", "system", "proxy.{}".format(protocol_type)], retry_sleeps=retry_sleeps, ) def get_config_option_value(key: str) -> Optional[str]: """ 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 """ try: out, _ = util.subp(["snap", "get", "system", key]) return out.strip() except exceptions.ProcessExecutionError: return None