Skip to main content

DFF Python Implementation

A Python implementation of the DFF (Differential Fuzzing Framework) that uses Unix domain sockets and System V shared memory for high-performance IPC.

Installation

pip install dff-py

Requirements

  • Python 3.9 or higher
  • Linux or macOS

Linux

sudo sysctl -w kernel.shmmax=104857600
sudo sysctl -w kernel.shmall=256000

macOS

sudo sysctl -w kern.sysv.shmmax=104857600
sudo sysctl -w kern.sysv.shmall=256000

Usage

Example Client

import sys
import hashlib
from pathlib import Path

from dff import Client


def process_sha(method: str, inputs: list[bytes]) -> bytes:
    """Process function for SHA256 hashing.

    Args:
        method: The fuzzing method (should be "sha")
        inputs: List of byte arrays to hash

    Returns:
        SHA256 hash of the first input

    Raises:
        ValueError: If method is not "sha" or no inputs provided
    """
    if method != "sha":
        raise ValueError(f"Unknown method: {method}")

    if not inputs:
        raise ValueError("No inputs provided")

    return hashlib.sha256(inputs[0]).digest()


def main() -> None:
    """Main entry point."""
    client = Client("python", process_sha)

    try:
        client.connect()
        client.run()
    except KeyboardInterrupt:
        print("\nShutdown requested")
    except Exception as e:
        print(f"Error: {e}", file=sys.stderr)
        sys.exit(1)
    finally:
        client.close()


if __name__ == "__main__":
    main()

Example Server

import sys
import random
from pathlib import Path

from dff import Server


def data_provider() -> list[bytes]:
    """Generate random data for fuzzing.

    Returns:
        List containing a single random byte array
    """
    MIN_SIZE = 1 * 1024 * 1024  # 1 MB
    MAX_SIZE = 4 * 1024 * 1024  # 4 MB

    # Use a deterministic seed that increments
    if not hasattr(data_provider, "seed_counter"):
        data_provider.seed_counter = 1
    seed = data_provider.seed_counter
    data_provider.seed_counter += 1

    # Generate random data with deterministic seed
    random.seed(seed)
    size = random.randint(MIN_SIZE, MAX_SIZE)
    data = random.randbytes(size)

    return [data]


def main() -> None:
    """Main entry point."""
    server = Server("sha")

    try:
        server.run(data_provider)
    except KeyboardInterrupt:
        print("\nShutdown requested")
    except Exception as e:
        print(f"Server error: {e}", file=sys.stderr)
        sys.exit(1)


if __name__ == "__main__":
    main()

Metadata

Release files for dff-py 0.1.12

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

Source distribution (sdist)

Source distribution for dff-py 0.1.12
File Size Uploaded Provenance Actions
dff_py-0.1.12.tar.gz 9.8 kB Without provenance Details for dff_py-0.1.12.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dff-py 0.1.12
File Interpreter ABI Platform Actions
dff_py-0.1.12-py3-none-any.whl Python 3 none any Details for dff_py-0.1.12-py3-none-any.whl

Total release size: 20.2 kB

Release files / dff_py-0.1.12.tar.gz

Download URL dff_py-0.1.12.tar.gz
Size 9.8 kB
Tags Source
SHA-256 checksum
How to use checksums
3b476fef2e39db69a6455413c243712d19777836d8f5ae9fbd73e6dc017b8a04
BLAKE2b-256 checksum
How to use checksums
5feb98ee7618738c117c23e71eb642a045b18850dfac4b1a635620c074b88bd2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / dff_py-0.1.12-py3-none-any.whl

Download URL dff_py-0.1.12-py3-none-any.whl
Size 10.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
df6cb460d66d01708abe1d875264c351d4819c4140e32aa466962b446ea1b936
BLAKE2b-256 checksum
How to use checksums
b8e3cfbbca03eeda303f3f5bd6e76ff7164288e7c5f8a15e323af872cb8f69eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Security for dff-py 0.1.12

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