Grammar-based Fuzzer that uses WebIDL as a grammar.
Project description
idl2js
Grammar-based Fuzzer that uses WebIDL as a grammar.
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.9.3-complete.jar
Generate parser
make grammar
Run tests
make unit
Examples
from pathlib import Path
from pprint import pprint
from idl2js import InterfaceTarget, Transpiler
class Blob(InterfaceTarget):
kind = 'Blob'
def main():
transpiler = Transpiler(idls=(str(Path('blob.webidl').resolve()),))
transpiler.transpile(
targets=[
Blob,
]
)
pprint(transpiler.js_instances)
if __name__ == '__main__':
main()
Output
try {v_e94935e94c7945829b5caeb9ba0201b8 = ['cwg']} catch(e){},
try {v_4291cb5afec94ab3a460aefec633a11e = {type: 'wwny', endings: 'transparent'}} catch(e){},
try {v_21068e2708dd47cd8c147e7ada78a3a0 = new Blob(v_e94935e94c7945829b5caeb9ba0201b8, v_4291cb5afec94ab3a460aefec633a11e)} catch(e){},
try {v_58e162f31a56467cab976d37a37c4811 = ['p', v_21068e2708dd47cd8c147e7ada78a3a0]} catch(e){},
try {v_5b148aa1d99e47d08642f65b2506d8e6 = {type: 'nrlsqlvc', endings: 'transparent'}} catch(e){},
try {v_9828d85447f94e67accf856e0c09d2f9 = new Blob(v_58e162f31a56467cab976d37a37c4811, v_5b148aa1d99e47d08642f65b2506d8e6)} catch(e){},
try {v_181663ba04e740699e6b59e8cb6bf49c = [v_9828d85447f94e67accf856e0c09d2f9, 'rkffvhfhtx']} catch(e){},
try {v_c40591cfedec48cc8f367b32b92157fc = {type: 'jl', endings: 'native'}} catch(e){},
try {v_6a1bcadcadbb4985b4a2951c4600f8b7 = new Blob(v_181663ba04e740699e6b59e8cb6bf49c, v_c40591cfedec48cc8f367b32b92157fc)} catch(e){},
try {v_9c73ddd4f3f845c3a39e6cc908047b4e = [v_6a1bcadcadbb4985b4a2951c4600f8b7, 'bafassyvz']} catch(e){},
try {v_9f8d17f370924cbb87314b057600f348 = {type: 'utnlst', endings: 'transparent'}} catch(e){},
try {v_26948eb73f774ac39365c5b09229d4cd = new Blob(v_9c73ddd4f3f845c3a39e6cc908047b4e, v_9f8d17f370924cbb87314b057600f348)} catch(e){}
Links
- searchfox - webidl
- original webidl parser
- TSJS-lib-generator
- ECMAScript® 2021 Language Specification
- Web IDL
- Web IDL Spec
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.1.tar.gz
(298.6 kB
view hashes)
Built Distribution
idl2js-0.1.1-py3-none-any.whl
(118.1 kB
view hashes)