Linux cpanel.rrshost.in 5.15.0-25-generic #25-Ubuntu SMP Wed Mar 30 15:54:22 UTC 2022 x86_64
Apache
: 109.123.238.221 | : 172.70.100.160
128 Domain
8.2.28
aev999
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
HASH IDENTIFIER
README
+ Create Folder
+ Create File
/
usr /
lib /
python3 /
dist-packages /
uaclient /
[ HOME SHELL ]
Name
Size
Permission
Action
__pycache__
[ DIR ]
drwxr-xr-x
clouds
[ DIR ]
drwxr-xr-x
entitlements
[ DIR ]
drwxr-xr-x
jobs
[ DIR ]
drwxr-xr-x
__init__.py
0
B
-rw-r--r--
actions.py
3.36
KB
-rw-r--r--
apt.py
16.47
KB
-rw-r--r--
cli.py
56.08
KB
-rw-r--r--
config.py
45.47
KB
-rw-r--r--
contract.py
18.15
KB
-rw-r--r--
data_types.py
5.91
KB
-rw-r--r--
defaults.py
1.5
KB
-rw-r--r--
event_logger.py
6.83
KB
-rw-r--r--
exceptions.py
10.67
KB
-rw-r--r--
gpg.py
813
B
-rw-r--r--
lock.py
3.51
KB
-rw-r--r--
messages.py
19.2
KB
-rw-r--r--
pip.py
756
B
-rw-r--r--
security.py
42.83
KB
-rw-r--r--
security_status.py
5.68
KB
-rw-r--r--
serviceclient.py
5.63
KB
-rw-r--r--
snap.py
2.92
KB
-rw-r--r--
status.py
11.17
KB
-rw-r--r--
types.py
308
B
-rw-r--r--
util.py
30.31
KB
-rw-r--r--
version.py
1.98
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : snap.py
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
Close