d-capstone 0.0.2
a binding for capstone library
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
d-capstone
A simple header of capstone library. Converted with dstep.
How to user
in your dub.json
"d-capstone": "master"
Usage
Example program at documentation.
import std.stdio;
import std.string;
import capstone.capstone;
void main()
{
const string code = "\x55\x48\x8b\x05\xb8\x13\x00\x00";
csh handle;
cs_insn *insn;
if (cs_open(cs_arch.CS_ARCH_X86, cs_mode.CS_MODE_64, &handle) != cs_err.CS_ERR_OK) {
return;
}
auto count = cs_disasm(handle, cast(ubyte*)code.ptr, code.length, 0x1000, 0, &insn);
if (count > 0) {
foreach (j; 0..count) {
writefln("0x%x\t%s\t\t%s", insn[j].address, insn[j].mnemonic, insn[j].op_str);
}
cs_free(insn, count);
}
else {
throw new Exception("Failed to disassemble given code!");
}
cs_close(&handle);
}
output is
0x1000 push rbp
0x1001 mov rax, qword ptr [rip + 0x13b8]
LISENCE
MIT
- Registered by theoldmoon0602
- 0.0.2 released 6 years ago
- theoldmoon0602/d-capstone
- MIT
- Copyright © 2018, theoldmoon0602
- Authors:
- Dependencies:
- none
- Versions:
-
0.0.2 2018-Oct-18 ~master 2018-Oct-18 - Download Stats:
-
-
0 downloads today
-
0 downloads this week
-
2 downloads this month
-
19 downloads total
-
- Score:
- 0.6
- Short URL:
- d-capstone.dub.pm