Skip to main content

enochecker3

A FastAPI based checker library for writing async checkers in python. It is called enochecker3 even though enochecker2 never existed, because it is intended to be the reference implementation for version 3 of the enochecker API specification which is yet to come.

Quick Start

Install enochecker3 using

pip3 install enochecker3

Create an example.py file with the following content:

import secrets
from typing import Optional

from httpx import AsyncClient

from enochecker3 import (
    ChainDB,
    Enochecker,
    GetflagCheckerTaskMessage,
    MumbleException,
    PutflagCheckerTaskMessage,
)
from enochecker3.utils import FlagSearcher, assert_equals, assert_in

checker = Enochecker("ExampleService", 1337)


@checker.putflag(0)
async def putflag_test(
    task: PutflagCheckerTaskMessage,
    client: AsyncClient,
    db: ChainDB,
) -> None:
    token = secrets.token_hex(32)
    r = await client.post("/note", json={"token": token, "flag": task.flag})
    assert_equals(r.status_code, 200, "storing note with flag failed")

    await db.set("token", token)


@checker.getflag(0)
async def getflag_test(
    task: GetflagCheckerTaskMessage, client: AsyncClient, db: ChainDB
) -> None:
    try:
        token = await db.get("token")
    except KeyError:
        raise MumbleException("Missing database entry from putflag")

    r = await client.get(f"/note/{token}")
    assert_equals(r.status_code, 200, "getting note with flag failed")
    assert_in(task.flag, r.text, "flag missing from note")


@checker.exploit(0)
async def exploit_test(searcher: FlagSearcher, client: AsyncClient) -> Optional[str]:
    r = await client.get(
        "/note/*",
    )
    assert not r.is_error

    if flag := searcher.search_flag(r.text):
        return flag

Start the checker using

uvicorn --reload example:checker.app

And browse to (http://localhost:8000/docs) to explore the web interface, which allows you to send requests to the checker.

Telemetry

The checker supports OpenTelemetry, with this configuration:

  • Set the environment variable OTEL_EXPORTER_OTLP_ENDPOINT to the URL of your OpenTelemetry collector.
  • Set the environment variable OTEL_EXPORTER_OTLP_HEADERS_AUTHORIZATION to your authentication token.

Built-In Dependencies

See docs/builtin_dependencies.md

Adding Custom Dependencies

See docs/adding_custom_dependencies.md

Good to Know / FAQ

See docs/faq.md

Metadata

Release files for enochecker3 0.14.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for enochecker3 0.14.0
File Size Uploaded Provenance Actions
enochecker3-0.14.0.tar.gz 21.2 kB Without provenance Details for enochecker3-0.14.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for enochecker3 0.14.0
File Interpreter ABI Platform Actions
enochecker3-0.14.0-py3-none-any.whl Python 3 none any Details for enochecker3-0.14.0-py3-none-any.whl

Total release size: 40.8 kB

Release files / enochecker3-0.14.0.tar.gz

Download URL enochecker3-0.14.0.tar.gz
Size 21.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d1d8473a03da19509f29c980256f3b2e9acd9a522fcfe3f7e95121aa9b991c29
BLAKE2b-256 checksum
How to use checksums
35e6b28f997901409707e37740178b4956bb18da6dc186b119612063e5a6f445
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / enochecker3-0.14.0-py3-none-any.whl

Download URL enochecker3-0.14.0-py3-none-any.whl
Size 19.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e9b4fc8641c02fad5332b32cd82874ae63f1a796b1a2bce58e4d636456726432
BLAKE2b-256 checksum
How to use checksums
813240dc701afdd02d0d748adf41fc3a1cc5066996f6c02149c6c98194ca82d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Security for enochecker3 0.14.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page