parasyte/node-capstone

CsOption API not exported

Closed this issue · 4 comments

I'm trying to use the SKIPDATA option, but looks like the API this module exposes doesn't provide access to the cs_option API, in addition, the enum is not updated to the last version, so there's no such option.

As long as the option API is private and used internally by the module I would suggest adding a .skipdata = to enable or disable this mode.

@radare I just started working on my own next branch to support Capstone 2.2: https://github.com/parasyte/node-capstone/tree/next

There's a dependency issue blocking me from supporting SKIPDATA currently; I have no way to provide a JavaScript function to the native library as a callback. There is some discussion on this in the node-capstone announcement thread on the Capstone mailing list: http://sourceforge.net/p/capstone/mailman/capstone-users/thread/80F40B99-7EFB-4D6F-8282-C766D2677350%40kodewerx.org/#msg32372077

I'll get the SKIPDATA mode working, but it is going to be a lot of effort. :)

@radare SKIPDATA is now partially supported (string only; no callback, yet) with 1c3f5c2

var capstone = require("capstone");
var code = new Buffer([ 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF ]);
var cs = new capstone.Cs(
    capstone.ARCH_MIPS,
    capstone.MODE_32 | capstone.MODE_BIG_ENDIAN
);

// Enabled SKIPDATA mode with ".db" instruction
cs.skipdata = new capstone.CsSkipdata(".db");

cs.disasm(code, 0x1000).forEach(function (insn) {
    console.log(
        "0x%s:\t%s\t%s",
        insn.address.toString(16), insn.mnemonic, insn.op_str
    );
});
cs.close();

Now fixed in next branch. I didn't need to write a new module after all! ffi supports callbacks already, it's just undocumented and required a lot of trial-and-error.

Cool! Thanks

On 26 May 2014, at 11:37, Jay Oster notifications@github.com wrote:

Now fixed in next branch. I didn't need to write a new module after all! fii supports callbacks already, it's just undocumented and required a lot of trial-and-error.


Reply to this email directly or view it on GitHub.