Skip to main content

Python bindings for radamsa fuzzing library.

Project description

pyradamsa

pyradamsa provides an interface for calling libradamsa methods from within Python, allowing one to perform mutations on byte blocks (aka fuzzing). For more details see radamsa (a general-purpose fuzzer) and libradamsa (precompiled radamsa library).

Usage

import pyradamsa

rad = pyradamsa.Radamsa()

mydata = b'GET /auth?pass=HelloWorld HTTP1.1'
fuzzed = rad.fuzz(mydata, seed=1337)
print(fuzzed)

> b'GET /auth?pass=HelloWorld HTTP\xc0\xb1.1'

# seed is randomly set if not provided
rad.fuzz(mydata)
> b'\tG\xf3\xa0\x81\x9c\xf7dLET \xe2\x81/aut\xf3\xa0\x80\xafHTTP2.rld HTTP2.rld HTTP3.2\xe1\xa0\x8e9'
rad.fuzz(mydata)
> b'GET /auth?pass=HelloWorld HTTP1.340282366920938463463374607431768211455'
etc.

# enforce static seed on initialization
rad = pyradamsa.Radamsa(seed=0)

# max_mut enforces a maximum length for returned data
# it defaults to (data length + an offset of 4096 bytes)
fuzzed = rad.fuzz(mydata, seed=1337, max_mut=10)
> b'GET /auth?'

# the offset may be overwritten on init
rad = pyradamsa.Radamsa(mut_offset=2048)

Building

Currently wheels are available for linux i686 and x86_64

# Clone the repo
git clone --recurse-submodules https://github.com/tsundokul/pyradamsa.git
cd pyradamsa

# patch memory leak when reinitializing owl vm
patch libradamsa/libradamsa.c realloc.patch

# OPTIONAL: when using manylinux (https://github.com/pypa/manylinux)
docker run --rm -it -v `pwd`:/io quay.io/pypa/manylinux2010_x86_64 /bin/bash
cd /io && alias python='/opt/python/cp35-cp35m/bin/python3.5'
export PATH="/opt/python/cp35-cp35m/bin/:${PATH}"

# Install requirements
python -m pip install -r requirements.txt

# Build C extension (libradamsa.so)
python setup.py build_ext

# Run tests
./run_tests

# Build wheel
python setup.py bdist_wheel

Contributing

  • Fork the repo
  • Check out a feature or bug branch
  • Add your changes
  • Update README when needed
  • Submit a pull request to upstream repo
  • Add description of your changes
  • Ensure tests are passing
  • Ensure branch is mergeable

MIT License, 2020 @tim17d

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

pyradamsa-0.1.0-cp32-abi3-manylinux1_x86_64.whl (545.1 kB view details)

Uploaded CPython 3.2+

pyradamsa-0.1.0-cp32-abi3-manylinux1_i686.whl (550.4 kB view details)

Uploaded CPython 3.2+

File details

Details for the file pyradamsa-0.1.0-cp32-abi3-manylinux1_x86_64.whl.

File metadata

  • Download URL: pyradamsa-0.1.0-cp32-abi3-manylinux1_x86_64.whl
  • Upload date:
  • Size: 545.1 kB
  • Tags: CPython 3.2+
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.0

File hashes

Hashes for pyradamsa-0.1.0-cp32-abi3-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 9bca8fb92542dffae2a8dac747be60142fe49c3ca091e599d002b70ffcdce858
MD5 3f844568bb975d14abd245f08daf8252
BLAKE2b-256 195d136e77cbe58ddd64cfe6ba56816b046f1408b653af13ed76acb1f371cc70

See more details on using hashes here.

File details

Details for the file pyradamsa-0.1.0-cp32-abi3-manylinux1_i686.whl.

File metadata

  • Download URL: pyradamsa-0.1.0-cp32-abi3-manylinux1_i686.whl
  • Upload date:
  • Size: 550.4 kB
  • Tags: CPython 3.2+
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.0

File hashes

Hashes for pyradamsa-0.1.0-cp32-abi3-manylinux1_i686.whl
Algorithm Hash digest
SHA256 2286829fce4b5357b616cbb249a6838faa76847f88d1a6960c0732990d53f17e
MD5 7ab9ce176b27a8caf91c5229947c204e
BLAKE2b-256 1e4bef0da24c3dddaef68f471277a7a1ed93d288b6bef90ff776091e8d4485a8

See more details on using hashes here.

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