Giter Club home page Giter Club logo

capstone.js's Introduction

Capstone.js

Port of the Capstone disassembler framework for JavaScript. Powered by Emscripten.

Notes: Capstone is a lightweight multi-architecture disassembly framework originally developed by Nguyen Anh Quynh and released under BSD license. More information about contributors and license terms can be found in the files CREDITS.TXT and LICENSE.TXT of the capstone submodule in this repository.

Installation

To add Capstone.js to your web application, include it with:

<script src="capstone.min.js"></script>

or install it with the Bower command:

bower install capstonejs

Usage

// Input: Machine code bytes and offset where they are located
var buffer = [0x55, 0x31, 0xD2, 0x89, 0xE5, 0x8B, 0x45, 0x08];
var offset = 0x10000;

// Initialize the decoder
var d = new cs.Capstone(cs.ARCH_X86, cs.MODE_32);

// Output: Array of cs.Instruction objects
var instructions = d.disasm(buffer, offset);

// Display results;
instructions.forEach(function (instr) {
    console.log("0x%s:\t%s\t%s",
        instr.address.toString(16),
        instr.mnemonic,
        instr.op_str
    );
});

// Delete decoder
d.close();

Building

To build the Capstone.js library, clone the master branch of this repository, and do the following:

  1. Initialize the original Capstone submodule: git submodule update --init.

  2. Install the latest Python 2.x (64-bit), CMake and the Emscripten SDK. Follow the respective instructions and make sure all environment variables are configured correctly. Under Windows MinGW (specifically mingw32-make) is required.

  3. Install the development dependencies with: npm install.

  4. Finally, build the source with: grunt build.

capstone.js's People

Contributors

alexaltea avatar matthewelse avatar yurydelendik avatar m4b avatar

Watchers

 avatar James Cloos 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.