#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.11"
# dependencies = [
#     "curl-cffi>=0.15.0",
# ]
# ///
from toadex.bug_bank_detector import Target, run

DETECTOR_ID = "replace-with-specific-bug-id"
DETECTOR_TITLE = "Replace with a concise vulnerability title"
DETECTOR_SEVERITY = "unknown"
DETECTOR_DESCRIPTION = "Replace with the vulnerability and its direct security impact."


async def fingerprint(target: Target) -> bool:
    """Identify the named software, rejecting unrelated hosts after one request."""
    response = await target.get("/")
    if response.status_code != 200 or "replace-product-signal" not in response.text:
        return False
    # Add a confirmatory request here only when the first response is not decisive.
    return True


async def vulnerable(target: Target) -> bool:
    """Return true only when the vulnerability-specific check succeeds."""
    response = await target.get("/replace-with-vulnerability-check")
    return response.status_code == 200 and "replace-proof-signal" in response.text


if __name__ == "__main__":
    raise SystemExit(run(fingerprint=fingerprint, vulnerable=vulnerable))
