-
Notifications
You must be signed in to change notification settings - Fork 1
forked from afl http://lcamtuf.coredump.cx/afl/
dwfault/afl-wasm
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
``` var importObject = { env: { print_number: function (number) { print('[+] importObject callback.'); print(number); } } }; var wasmCode = new Uint8Array([0x0, 0x61, 0x73, 0x6d, 0x1, 0x0, 0x0, 0x0, 0x1, 0x7, 0x1, 0x60, 0x2, 0x7f, 0x7f, 0x1, 0x7f, 0x3, 0x2, 0x1, 0x0, 0x4, 0x4, 0x1, 0x70, 0x0, 0x4, 0x6, 0x2e, 0x5, 0x7f, 0x0, 0x41, 0x2a, 0xb, 0x7d, 0x0, 0x43, 0x0, 0x0, 0x0, 0x3f, 0xb, 0x7c, 0x0, 0x44, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe0, 0x3f, 0xb, 0x7d, 0x0, 0x43, 0x0, 0x0, 0xc0, 0x7f, 0xb, 0x7c, 0x0, 0x44, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xb, 0x7, 0x40, 0x7, 0x5, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x1, 0x0, 0x3, 0x73, 0x75, 0x6d, 0x0, 0x0, 0x6, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x3, 0x0, 0x7, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x31, 0x3, 0x1, 0x7, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x32, 0x3, 0x2, 0x7, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x33, 0x3, 0x3, 0x7, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x34, 0x3, 0x4, 0x9, 0x7, 0x1, 0x0, 0x41, 0x0, 0xb, 0x1, 0x0, 0xa, 0x9, 0x1, 0x7, 0x0, 0x20, 0x1, 0x20, 0x0, 0x6a, 0xb]); //var wasmCode = new Uint8Array([0x0, 0x61, 0x73, 0x6d, 0x1, 0x0, 0x0, 0x0, 0x1, 0x8, 0x2, 0x60, 0x1, 0x7f, 0x0, 0x60, 0x0, 0x0, 0x2, 0x19, 0x1, 0x7, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x73, 0xd, 0x69, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x5f, 0x66, 0x75, 0x6e, 0x63, 0x0, 0x0, 0x3, 0x2, 0x1, 0x1, 0x7, 0x11, 0x1, 0xd, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x5f, 0x66, 0x75, 0x6e, 0x63, 0x0, 0x1, 0xa, 0x8, 0x1, 0x6, 0x0, 0x41, 0x12, 0x10, 0x0, 0xb]); ///////////////////////////////////////////////////////////////////////////INIT try { var wasmModule = new WebAssembly.Module(wasmCode); var wasmInstance = new WebAssembly.Instance(wasmModule, importObject); print('[+] wasmCode validate.'); print(WebAssembly.validate(wasmCode)); } catch (e) { print(e); } ///////////////////////////////////////////////////////////////////////////EXPORTS try { var wasmInstanceExported = wasmInstance.exports; print('[+] wasmInstanceExported.'); try { var wasmInstanceExportedTable = wasmInstance.exports.table; for (var i = 0; i < 100; i++) { print(wasmInstanceExportedTable.get(i)); } } catch (e) { print(e); } try { print(wasmInstanceExported.main(0)); } catch (e) { print(e); } try { for (var i in wasmInstanceExported) { try { print(eval('wasmInstanceExported.' + i + ';')); } catch (e) { print(e); } try { print(eval('wasmInstanceExported.' + i + '(0);')); } catch (e) { print(e); } } } catch (e) { print(e); } var wasmModuleExports = WebAssembly.Module.exports(wasmModule); var varExports = []; print('[+] wasmModuleExported.') for (var i of wasmModuleExports) { print(i + ' : ' + i.kind + ' : ' + i.name); varExports.push(i.name); } for (var i of varExports) { try { print(eval('wasmInstanceExported.' + i + ';')); } catch (e) { print(e); } try { print(eval('wasmInstanceExported.' + i + '(0);')); } catch (e) { print(e); } } } catch (e) { print(e) }; ///////////////////////////////////////////////////////////////////////////IMPORTS try { var wasmModuleImports = WebAssembly.Module.imports(wasmModule); var varImports = []; print('[+] wasmModuleImported.') for (var i of wasmModuleImports) { print(i + ' : ' + i.kind + ' : ' + i.name + ' : ' + i.module); varImports.push(i.name); } } catch (e) { print(e) }; /////////////////////////////////////////////////////////////////////////MEMORY try { var wasmMemory = wasmInstance.exports.memory; print('[+] wasmMemory.'); print(wasmMemory); print(wasmMemory instanceof WebAssembly.Memory); } catch (e) { print(e); } //////////////////////////////////////////////////////////////////////// print('[+] End.'); ```
Releases
No releases published
Packages 0
No packages published