Skip to main content

Python harness for the crossfuzz differential fuzzer

Project description

crossfuzz

Python harness for crossfuzz, a coverage-guided differential fuzzer across C, C++, Go, Java, JavaScript/TypeScript, Python, and Rust. The coordinator sends the same generated input to multiple implementations of the same function, collects coverage from every target, and flags any divergence in outputs.

This package is the Python side: it handles the shared-memory IPC, pipe protocol, and branch-arc coverage collection so you only have to write the target function.

Install

pip install crossfuzz

You also need the crossfuzz coordinator binary — see the main repo for build/install instructions.

Quick start

Write a target script that calls crossfuzz.fuzz(your_function):

import crossfuzz

def my_target(data: bytes) -> bytes:
    # Your code under test. Raise an exception to signal an error.
    return data

crossfuzz.fuzz(my_target)

Point the coordinator at it from a crossfuzz.toml config:

[[target]]
name = "python_impl"
language = "python"
binary = "python3"
args = ["my_target.py"]

Then run the campaign with crossfuzz run crossfuzz.toml.

API

  • crossfuzz.fuzz(target, settings=None) — persistent fuzz loop. target(data: bytes) -> bytes.
  • crossfuzz.filter(target, settings=None) — persistent filter loop. target(data: bytes) -> tuple[bytes, bool].
  • crossfuzz.compare(target, settings=None) — custom comparator loop. target(input: bytes, names: list[str], outputs: list[bytes]) -> str.
  • crossfuzz.Settings(instrument=True, warmup=0, transform=False) — configuration. Set instrument=False for thin HTTP-trigger harnesses where coverage comes from an instrumented server process.

Platform

POSIX only — the harness uses mmap and inherited file descriptors 3/4 to talk to the coordinator. Windows is not supported.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

crossfuzz-0.0.2.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

crossfuzz-0.0.2-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file crossfuzz-0.0.2.tar.gz.

File metadata

  • Download URL: crossfuzz-0.0.2.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for crossfuzz-0.0.2.tar.gz
Algorithm Hash digest
SHA256 43a5818bd8b7eceeaa20e518a5ea2c86e4a396fbdae00acc98ab215a23edd77a
MD5 e1afd5d01963d3674e734c41c7800e4a
BLAKE2b-256 87700a257f14e10a127276a33c24896155888685dee406ebecd0b155dccad6d7

See more details on using hashes here.

File details

Details for the file crossfuzz-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: crossfuzz-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for crossfuzz-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9948998470cfcf8df034f25679870eaf493f4aeba9cb9f39c1b353efb7a2b119
MD5 db8c93792ace61c39857135a33f48829
BLAKE2b-256 d628fe25161e4684139f6189a6bf31bb55c2c94b419b29152214647adf48fd27

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page