Skip to content

Instantly share code, notes, and snippets.

@parasyte
Last active August 29, 2015 14:01
Show Gist options
  • Save parasyte/1fe794b018b7d8b50ef0 to your computer and use it in GitHub Desktop.
Save parasyte/1fe794b018b7d8b50ef0 to your computer and use it in GitHub Desktop.
x86_64 example using Capstone bindings for node.js
var capstone = require("capstone");
var code = new Buffer([
0x55, 0x48, 0x8b, 0x05, 0xb8, 0x13, 0x00, 0x00
]);
var cs = new capstone.Cs(capstone.ARCH_X86, capstone.MODE_64);
cs.detail = true;
cs.disasm(code, 0x1000).forEach(function (insn) {
console.log(
"0x%s:\t%s\t%s\t%s",
insn.address.toString(16), insn.mnemonic, insn.op_str,
JSON.stringify(insn.detail)
);
});
cs.close();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment