Skip to main content

Python harness for the cross_fuzz differential fuzzer

Project description

crossfuzz

Python harness for cross_fuzz, 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.1.tar.gz (5.9 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.1-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: crossfuzz-0.0.1.tar.gz
  • Upload date:
  • Size: 5.9 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.1.tar.gz
Algorithm Hash digest
SHA256 6601904a3b2818e847a9100afda850e66308c15b6fed20cb65c66a01cfc8ab0a
MD5 fd2375c521954f30ee5573b68f245c1d
BLAKE2b-256 d2f0f0b78ad8e11f2b56d3b0b4b81e9f3dc0d744f7b725a6c1171dcb858708b7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: crossfuzz-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.1 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 60f58b932cd716f230766d51a048d255613df075e583f1d74eefb7a4cfab7241
MD5 c9063d46806cc013601a24c915646d1c
BLAKE2b-256 74403bf5c4445cc1bf95828f7cf50e781363df26ee96b9ac6766c85768242956

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