Skip to main content

libfuzzer

Project description

libfuzzer

This is raw bindings for libfuzzer which works as a library.

Example:

#!/usr/bin/env python3

from libfuzzer import *
import os
import sys

Counters = CreateLibFuzzerCounters(4096)

def TestOneInput(input):
    # Instrument the code manually.
    l = len(input)

    if l == 0:
        Counters[0] += 1
    elif l == 8:
        Counters[1] += 1
    elif l == 16:
        Counters[2] += 1
        os.abort()
    else:
        Counters[3] += 1
    
    Counters[4] += 1
    return 0

def Initialize(argv):
    return 0

def Mutator(data, max_size, seed):
    return LLVMFuzzerMutate(data, max_size)

def CrossOver(data1, data2, out, seed):
    return 0

# If you are using -fork=1, make sure run it like `python3 ./example.py` or
# `./example.py` instead of `python3 example.py`.
LLVMFuzzerRunDriver(sys.argv, TestOneInput, Initialize, Mutator, CrossOver, Counters)

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

libfuzzer-0.0.2.tar.gz (4.3 kB view hashes)

Uploaded Source

Built Distributions

libfuzzer-0.0.2-py3-none-manylinux1_x86_64.whl (229.1 kB view hashes)

Uploaded Python 3

libfuzzer-0.0.2-py3-none-manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (229.7 kB view hashes)

Uploaded Python 3 manylinux: glibc 2.17+ x86-64

libfuzzer-0.0.2-py3-none-manylinux1_i686.whl (239.3 kB view hashes)

Uploaded Python 3

libfuzzer-0.0.2-py3-none-manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (239.9 kB view hashes)

Uploaded Python 3 manylinux: glibc 2.17+ i686

Supported by

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