[ Th3_Err0r Bypassed ]




Upload:

Command:

liwaavux@216.73.217.113: ~ $
from __future__ import annotations

import os
import stat


def raise_on_exist_ro_file(filename: str) -> None:
    try:
        file_stat = os.stat(filename)  # use stat to do exists + can write to check without race condition
    except OSError:
        return None  # swallow does not exist or other errors

    if file_stat.st_mtime != 0:  # if os.stat returns but modification is zero that's an invalid os.stat - ignore it
        if not (file_stat.st_mode & stat.S_IWUSR):
            raise PermissionError(f"Permission denied: {filename!r}")


__all__ = [
    "raise_on_exist_ro_file",
]

Filemanager

Name Type Size Permission Actions
__pycache__ Folder 0755
__init__.py File 1.22 KB 0644
_api.py File 8.15 KB 0644
_error.py File 399 B 0644
_soft.py File 1.61 KB 0644
_unix.py File 1.42 KB 0644
_util.py File 594 B 0644
_windows.py File 1.72 KB 0644
py.typed File 0 B 0644
version.py File 142 B 0644