__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
from __future__ import annotations
import logging
import os
import zipfile
from virtualenv.info import IS_WIN, ROOT
LOGGER = logging.getLogger(__name__)
def read(full_path):
sub_file = _get_path_within_zip(full_path)
with zipfile.ZipFile(ROOT, "r") as zip_file, zip_file.open(sub_file) as file_handler:
return file_handler.read().decode("utf-8")
def extract(full_path, dest):
LOGGER.debug("extract %s to %s", full_path, dest)
sub_file = _get_path_within_zip(full_path)
with zipfile.ZipFile(ROOT, "r") as zip_file:
info = zip_file.getinfo(sub_file)
info.filename = dest.name
zip_file.extract(info, str(dest.parent))
def _get_path_within_zip(full_path):
full_path = os.path.realpath(os.path.abspath(str(full_path)))
prefix = f"{ROOT}{os.sep}"
if not full_path.startswith(prefix):
msg = f"full_path={full_path} should start with prefix={prefix}."
raise RuntimeError(msg)
sub_file = full_path[len(prefix) :]
if IS_WIN:
# paths are always UNIX separators, even on Windows, though __file__ still follows platform default
sub_file = sub_file.replace(os.sep, "/")
return sub_file
__all__ = [
"extract",
"read",
]
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| __pycache__ | Folder | 0755 |
|
|
| path | Folder | 0755 |
|
|
| subprocess | Folder | 0755 |
|
|
| __init__.py | File | 0 B | 0644 |
|
| error.py | File | 323 B | 0644 |
|
| lock.py | File | 4.67 KB | 0644 |
|
| zipapp.py | File | 1.2 KB | 0644 |
|