• This repository has been archived on 14/Aug/2021
  • Stars
    star
    475
  • Rank 91,834 (Top 2 %)
  • Language
    Python
  • License
    Mozilla Public Li...
  • Created over 9 years ago
  • Updated about 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Generation-based, context-free grammar fuzzer. Refer to https://github.com/posidron/dharma for a maintained version.

Archived β€” please see https://github.com/posidron/dharma for maintained version.

Logo

Generation-based, context-free grammar fuzzer.

Build Status IRC

Table of Contents

Run

All roads lead to Rome but Python 3.x is the prefered vehicle.

pip

pip install dharma
dharma --help

pipenv

pipenv install --dev
pipenv run dharma --help

package

python -m dharma --help

Docker

docker build -t dharma .
docker run --rm -it dharma -grammars dharma/grammars/canvas2d.dg

Examples

Generate a single test-case and print it to stdout. Multiple grammars can be appended to the -grammars argument.

dharma -grammars dharma/grammars/canvas2d.dg

Generating multiple test-cases and save the result to disk.

dharma -grammars dharma/grammars/canvas2d.dg -storage . -count 5

Generate test-cases and serve them in a template via WebSocket. Launch dharma/grammars/var/index.html in the browser after Dharma launched.

dharma -grammars dharma/grammars/canvas2d.dg -server -template dharma/grammars/var/templates/html5/default.html

Benchmark the generator.

time dharma -grammars dharma/grammars/canvas2d.dg -count 10000 > /dev/null

Development

PyLint

In case you run PyLint 1.9.2 and Python 3.7 you need to upgrade PyLint.

pip3 install pylint astroid --pre -U

Dharma Grammar Cheatsheet

Comments

%%% comment

Controls

%const% name := value

Sections

%section% := value
%section% := variable
%section% := variance

Extension Methods

Refer to extensions.py in dharma/core/ and to the xref_registry in the DharmaMachine class to add further extensions.

%range%(0-9)
%range%(0.0-9.0)
%range%(a-z)
%range%(!-~)
%range%(0x100-0x200)

%repeat%(+variable+)
%repeat%(+variable+, ", ")

%uri%(path)
%uri%(lookup_key)

%block%(path)

%choice%(foo, "bar", 1)

Assigning Values

digit :=
    %range%(0-9)

sign :=
    +
    -

value :=
    +sign+%repeat%(+digit+)

Using Values

+value+

Assigning Variables

variable :=
    @variable@ = new Foo();

Using Variables

value :=
    !variable!.bar();

Referencing values from common.dg

value :=
    attribute=+common:number+

Calling JavaScript library methods

foo :=
    Random.pick([0,1]);

API Documentation

Dharma in the Public

Dharma mentionings in the news.

More Repositories

1

funfuzz

A collection of fuzzers in a harness for testing the SpiderMonkey JavaScript engine.
Python
628
star
2

fuzzdata

Fuzzing resources for feeding various fuzzers with input. πŸ”§
HTML
493
star
3

peach

Peach is a fuzzing framework which uses a DSL for building fuzzers and an observer based architecture to execute and monitor them.
Python
399
star
4

grizzly

A cross-platform browser fuzzing framework
Python
301
star
5

FuzzManager

A fuzzing management tools collection
HTML
183
star
6

octo

A fuzzing library in JavaScript. ✨
JavaScript
116
star
7

lithium

Line-based testcase reducer
Python
94
star
8

libfuzzer-python-bridge

A Python3 bridge for implementing custom libFuzzer mutators
C++
74
star
9

orion

CI/CD pipeline for building and publishing multiple 🐳 containers as microservices within a mono repository.
Python
45
star
10

quokka

Quokka is a utility to launch and monitor application for faults.
Python
40
star
11

fuzzfetch

Downloader for Firefox/jsshell builds for fuzzing.
Python
35
star
12

ffpuppet

A Python module that aids in the automation of Firefox at the process level
Python
30
star
13

avalanche

Avalanche is a document generator which uses context-free grammars to generate randomized outputs for fuzz-testing.
Python
29
star
14

laniakea

Laniakea is a utility for managing instances at various cloud providers and aids in setting up a fuzzing cluster.
Python
27
star
15

virgo

Crowdsourced fuzzing cluster. πŸš€
JavaScript
22
star
16

framboise

Framboise is a fuzzer for in-depth testing of WebAPIs.
JavaScript
21
star
17

ec2SpotPrices

[Deprecated and unmaintained] Uses boto to retrieve current spot instance prices on Amazon EC2.
Python
19
star
18

corpus-replicator

A corpus generation tool
Python
18
star
19

domfuzz

DOM fuzzers - not maintained anymore
JavaScript
16
star
20

snapshot-fuzzing

Custom Agent and Tooling for using Nyx with Firefox
C
15
star
21

marifuzz

[Deprecated and unmaintained] A user interaction fuzzer for Firefox OS, based on the Marionette framework.
Python
12
star
22

site-scout

Python
11
star
23

prefpicker

Manage & generate prefs.js files
Python
9
star
24

bugmon

Automatic analysis of SpiderMonkey and Firefox bugs on Bugzilla
Python
9
star
25

openh264fuzz

A lightweight fuzzer for the encoder and decoder of OpenH264
Python
9
star
26

autobisect

Automatic Bisection Firefox and SpiderMonkey Bugs
C++
7
star
27

faulty

Bucket repository of infrastructure and managment scripts for fuzzing IPC Protocol Definition Language (IPDL) protocols.
JavaScript
6
star
28

dolly

A Cookiecutter project template for projects in Python.
Python
5
star
29

orangfuzz

[Deprecated and unmaintained] An experimental UI fuzzer based on the orangutan framework for Firefox OS devices
Python
5
star
30

reachable

Repository for Project Reachable
Python
3
star
31

photon

A utility for managing RAM disks.
Python
3
star
32

hedwig

Hedwig is a commit monitor for GitHub using the GitHub REST API.
Python
3
star
33

hermes

Hermes is the codename for the integrated Message Manager fuzzer in Firefox.
2
star
34

guided-fuzzing-daemon

Python
2
star
35

mozilla-build-configs

Build configurations of Firefox for Fuzzing and Sanitizer builds.
2
star
36

fuzzing-tc

Code for Taskcluster Tasks in Fuzzing
Python
2
star
37

psbootstrap

psbootstrap assists in creating files needed to bootstrap a Windows machine for Mozilla development in EC2.
PowerShell
2
star
38

fuzzpriv

JavaScript
1
star
39

bugmon-tc

Tools for running Bugmon in TaskCluster
Python
1
star