Skip to main content

Grammar-based Fuzzer that uses WebIDL as a grammar.

Project description

idl2js

Grammar-based Fuzzer that uses WebIDL as a grammar.

Build Status Codecov Python Version License

Quick start

pip install idl2js

Build from source

Get source and install dependencies

git clone https://gitlab.com/PrVrSs/idl2js.git
cd idl2js
poetry install

Download ANTLR tool

wget https://www.antlr.org/download/antlr-4.10.1-complete.jar

Generate parser

make grammar

Run tests

make unit

Examples

import logging
from pathlib import Path
from pprint import pprint

from idl2js import InterfaceTarget, Transpiler


class Module(InterfaceTarget):
    kind = 'Module'


class Global(InterfaceTarget):
    kind = 'Global'


class Table(InterfaceTarget):
    kind = 'Table'


class Memory(InterfaceTarget):
    kind = 'Memory'


def main():
    logging.getLogger('idl2js').setLevel(logging.DEBUG)

    transpiler = Transpiler(
        idls=(
            str((Path(__file__).parent / 'webassembly.webidl').resolve()),
        )
    )

    transpiler.transpile(
        targets=[
            Module,
            Global,
            Table,
            Memory,
        ]
    )

    pprint(transpiler.js_instances)


if __name__ == '__main__':
    main()

Output

try {v_0805c1325a3048aca879de7ce5f8c9a5 = new Int8Array()} catch(e){}
try {v_cfa435d6211f41df8a6af0a8543b3b37 = new WebAssembly.Module(v_0805c1325a3048aca879de7ce5f8c9a5)} catch(e){}
try {v_5deaeb375b774b54b6140be12322296a = {value: 'v128', mutable: true}} catch(e){}
try {v_788c98fd9d97444688f48fedb824130b = 'meoein'} catch(e){}
try {v_c3fcd21aecdd4ef6bb2060cbb0bd70fb = new WebAssembly.Global(v_5deaeb375b774b54b6140be12322296a, v_788c98fd9d97444688f48fedb824130b)} catch(e){}
try {v_73a4bd166ae34681a13acc70c2a67876 = {element: 'anyfunc', initial: 290477176, maximum: 3297392043}} catch(e){}
try {v_061571cb277b42beb33546c8d8c3ed07 = 'pahfbx'} catch(e){}
try {v_0c4bc44857394e40a9ade62f0eaadfca = new WebAssembly.Table(v_73a4bd166ae34681a13acc70c2a67876, v_061571cb277b42beb33546c8d8c3ed07)} catch(e){}
try {v_06ab1c4441d543ae8d4289c13a07c895 = {initial: 2477011723, maximum: 3809510539}} catch(e){}
try {v_5e251ff6ba8647e48a2d633ba42386f8 = new WebAssembly.Memory(v_06ab1c4441d543ae8d4289c13a07c895)} catch(e){}

Links

Contributing

Any help is welcome and appreciated.

License

idl2js is licensed under the terms of the Apache-2.0 License (see the file LICENSE).

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

idl2js-0.1.3.tar.gz (195.2 kB view details)

Uploaded Source

Built Distribution

idl2js-0.1.3-py3-none-any.whl (119.8 kB view details)

Uploaded Python 3

File details

Details for the file idl2js-0.1.3.tar.gz.

File metadata

  • Download URL: idl2js-0.1.3.tar.gz
  • Upload date:
  • Size: 195.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.4 Linux/5.13.0-39-generic

File hashes

Hashes for idl2js-0.1.3.tar.gz
Algorithm Hash digest
SHA256 47f21ffe13453c7f43dc721876e7bd8cef83087ea2323dedd01f806a101da091
MD5 7dd5f429de3df7e735fa6d521f43ba51
BLAKE2b-256 e22f5e2f44f14738120bb9d699655aec17f44ccf8b2d5ac923272f67c756ef66

See more details on using hashes here.

File details

Details for the file idl2js-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: idl2js-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 119.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.4 Linux/5.13.0-39-generic

File hashes

Hashes for idl2js-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3372a3dd0929489224e4338683bd29c6095c2f4017a8075eb34a3e7e158cffcd
MD5 035e083b8ebdce020f7303b49288c0ec
BLAKE2b-256 eaa5f3d9b541e751e2c7c3eb0d18dd88043c2bfa879c6cec1b496cb3d3b9686d

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