INNER CODE UNIT · Python

_artifact_allowed

Nour833/StegoForge · web/app.py:30

def _artifact_allowed(path: Path) -> bool:
    if not path.exists() or not path.is_file():
        return False
    if path.name.startswith(ARTIFACT_PREFIX):
        return True
    if path.name.endswith("_fingerprint_heatmap.png") and path.parent.resolve() == Path.cwd().resolve():
        return True
    return False


def _persist_artifact(data: bytes, suffix: str = ".bin") -> str:
    suffix = suffix if suffix.startswith(".") else f".{suffix}"
    with tempfile.NamedTemporaryFile(prefix=ARTIFACT_PREFIX, suffix=suffix, delete=False) as tmp:
        tmp.write(data)
        tmp.flush()
        return tmp.name

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…