__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
"""Plugin utilities."""
import logging
from typing import List
from certbot import util
from certbot.compat import os
from certbot.compat.misc import STANDARD_BINARY_DIRS
logger = logging.getLogger(__name__)
def get_prefixes(path: str) -> List[str]:
"""Retrieves all possible path prefixes of a path, in descending order
of length. For instance:
* (Linux) `/a/b/c` returns `['/a/b/c', '/a/b', '/a', '/']`
* (Windows) `C:\\a\\b\\c` returns `['C:\\a\\b\\c', 'C:\\a\\b', 'C:\\a', 'C:']`
:param str path: the path to break into prefixes
:returns: all possible path prefixes of given path in descending order
:rtype: `list` of `str`
"""
prefix = os.path.normpath(path)
prefixes: List[str] = []
while prefix:
prefixes.append(prefix)
prefix, _ = os.path.split(prefix)
# break once we hit the root path
if prefix == prefixes[-1]:
break
return prefixes
def path_surgery(cmd: str) -> bool:
"""Attempt to perform PATH surgery to find cmd
Mitigates https://github.com/certbot/certbot/issues/1833
:param str cmd: the command that is being searched for in the PATH
:returns: True if the operation succeeded, False otherwise
"""
path = os.environ["PATH"]
added = []
for d in STANDARD_BINARY_DIRS:
if d not in path:
path += os.pathsep + d
added.append(d)
if any(added):
logger.debug("Can't find %s, attempting PATH mitigation by adding %s",
cmd, os.pathsep.join(added))
os.environ["PATH"] = path
if util.exe_exists(cmd):
return True
expanded = " expanded" if any(added) else ""
logger.debug("Failed to find executable %s in%s PATH: %s", cmd,
expanded, path)
return False
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| __pycache__ | Folder | 0755 |
|
|
| __init__.py | File | 23 B | 0644 |
|
| common.py | File | 17.11 KB | 0644 |
|
| dns_common.py | File | 13.7 KB | 0644 |
|
| dns_common_lexicon.py | File | 12.65 KB | 0644 |
|
| dns_test_common.py | File | 2.57 KB | 0644 |
|
| dns_test_common_lexicon.py | File | 15.35 KB | 0644 |
|
| enhancements.py | File | 6.65 KB | 0644 |
|
| storage.py | File | 4.19 KB | 0644 |
|
| util.py | File | 1.77 KB | 0644 |
|