Skip to main content

No project description provided

Project description

Corpus Replicator

Task Status Matrix PyPI

Corpus Replicator is a corpus generation tool that enables the creation of multiple unique output files based on templates. The primary intended use case is the creation of a seed corpus that can be used by fuzzers. Support for additional output formats can be added via the creation of Recipes. If a desired format is unsupported, support can be added via the creation of a CorpusGenerator.

The goal is to create an efficient corpus that maximizes code coverage and minimizes file size. Small unique files that execute quickly are preferred.

Currently four media types can be generated animation, audio, image and video.

Requirements

Corpus Replicator relies on FFmpeg.

Installation

pip install corpus-replicator

Example

This is an example recipe file.

# "base" contains required entries and default flags
base:
  codec: "h264"       # name of the codec
  container: "mp4"    # container/file extension
  library: "libx264"  # name of library
  medium: "video"     # supported medium
  tool: "ffmpeg"      # name of supported tool
  default_flags:
    encoder:          # "encoder" flag group
      ["-c:v", "libx264"]
    resolution:       # "resolution" flag group
      ["-s", "320x240"]

# variations allow flags to be added and overwritten
# one file will be generated for each entry in a flag group
variation:
  resolution:         # flag group - overwrites default flag group in "base"
  - ["-s", "640x480"]
  - ["-s", "32x18"]
  - ["-s", "64x64"]
  monochrome:         # flag group - adds new flag group
  - ["-vf", "hue=s=0"]

Running the recipe will generate a corpus:

$ corpus-replicator example.yml video -t test
Generating templates...
1 recipe(s) will be used with 1 template(s) to create 4 file(s).
Generating 4 'video/libx264/h264/mp4' file(s) using template 'test'...
Optimizing corpus, checking for duplicates...
Done.

Resulting corpus:

$ ls generated-corpus/
video-h264-libx264-test-monochrome-00.mp4
video-h264-libx264-test-resolution-01.mp4
video-h264-libx264-test-resolution-00.mp4
video-h264-libx264-test-resolution-02.mp4

A more complex corpus can be generated by using multiple Recipes and Templates at once.

Recipes are stored in src/corpus_replicator/recipes.

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

corpus-replicator-1.1.2.tar.gz (27.7 kB view details)

Uploaded Source

Built Distribution

corpus_replicator-1.1.2-py3-none-any.whl (40.3 kB view details)

Uploaded Python 3

File details

Details for the file corpus-replicator-1.1.2.tar.gz.

File metadata

  • Download URL: corpus-replicator-1.1.2.tar.gz
  • Upload date:
  • Size: 27.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.18

File hashes

Hashes for corpus-replicator-1.1.2.tar.gz
Algorithm Hash digest
SHA256 f75c72b4e5f7337cc1e0b6c92ab3749b5ec6864ef56195a22679b86340cc64c4
MD5 300289b7f3025444c0097a85f9154515
BLAKE2b-256 17f342dc7ebee750dc32ecad2e52d7da631ca066b5f0e8de55048385d4a4ce2b

See more details on using hashes here.

File details

Details for the file corpus_replicator-1.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for corpus_replicator-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 966c028f82ca7ae754e5a0a28a0381fa920b8168c3440603f76c5328df503260
MD5 ee93f3d56c3e0804ce2488d6b0d392f8
BLAKE2b-256 4f6c5e73b0839e88392bc7264374a3bdb16e25110369b8c3c26dcaf72728f705

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