GithubHelp home page GithubHelp logo

killvxk / afl-wasm Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dwfault/afl-wasm

0.0 1.0 0.0 1.31 MB

forked from afl http://lcamtuf.coredump.cx/afl/

Makefile 2.86% C 83.41% Shell 7.40% C++ 4.12% HTML 0.73% JavaScript 0.78% Rich Text Format 0.01% Python 0.68%

afl-wasm's Introduction

```
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.');
```

afl-wasm's People

Contributors

dwfault avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.