hexcore-capstone 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +26 -0
- package/README.md +191 -0
- package/binding.gyp +168 -0
- package/deps/capstone/LEB128.h +38 -0
- package/deps/capstone/MCDisassembler.h +14 -0
- package/deps/capstone/MCFixedLenDisassembler.h +32 -0
- package/deps/capstone/MCInst.c +270 -0
- package/deps/capstone/MCInst.h +165 -0
- package/deps/capstone/MCInstrDesc.c +41 -0
- package/deps/capstone/MCInstrDesc.h +167 -0
- package/deps/capstone/MCRegisterInfo.c +151 -0
- package/deps/capstone/MCRegisterInfo.h +116 -0
- package/deps/capstone/Mapping.c +254 -0
- package/deps/capstone/Mapping.h +174 -0
- package/deps/capstone/MathExtras.h +442 -0
- package/deps/capstone/SStream.c +181 -0
- package/deps/capstone/SStream.h +40 -0
- package/deps/capstone/arch/AArch64/AArch64AddressingModes.h +945 -0
- package/deps/capstone/arch/AArch64/AArch64BaseInfo.c +77 -0
- package/deps/capstone/arch/AArch64/AArch64BaseInfo.h +585 -0
- package/deps/capstone/arch/AArch64/AArch64Disassembler.c +2280 -0
- package/deps/capstone/arch/AArch64/AArch64Disassembler.h +18 -0
- package/deps/capstone/arch/AArch64/AArch64GenAsmWriter.inc +26589 -0
- package/deps/capstone/arch/AArch64/AArch64GenDisassemblerTables.inc +27322 -0
- package/deps/capstone/arch/AArch64/AArch64GenInstrInfo.inc +13194 -0
- package/deps/capstone/arch/AArch64/AArch64GenRegisterInfo.inc +3814 -0
- package/deps/capstone/arch/AArch64/AArch64GenRegisterName.inc +714 -0
- package/deps/capstone/arch/AArch64/AArch64GenRegisterV.inc +673 -0
- package/deps/capstone/arch/AArch64/AArch64GenSubtargetInfo.inc +229 -0
- package/deps/capstone/arch/AArch64/AArch64GenSystemOperands.inc +2863 -0
- package/deps/capstone/arch/AArch64/AArch64GenSystemOperands_enum.inc +21 -0
- package/deps/capstone/arch/AArch64/AArch64InstPrinter.c +3029 -0
- package/deps/capstone/arch/AArch64/AArch64InstPrinter.h +28 -0
- package/deps/capstone/arch/AArch64/AArch64Mapping.c +883 -0
- package/deps/capstone/arch/AArch64/AArch64Mapping.h +43 -0
- package/deps/capstone/arch/AArch64/AArch64MappingInsn.inc +37790 -0
- package/deps/capstone/arch/AArch64/AArch64MappingInsnName.inc +1282 -0
- package/deps/capstone/arch/AArch64/AArch64MappingInsnOp.inc +26994 -0
- package/deps/capstone/arch/AArch64/AArch64Module.c +44 -0
- package/deps/capstone/arch/AArch64/AArch64Module.h +12 -0
- package/deps/capstone/arch/ARM/ARMAddressingModes.h +698 -0
- package/deps/capstone/arch/ARM/ARMBaseInfo.h +486 -0
- package/deps/capstone/arch/ARM/ARMDisassembler.c +5763 -0
- package/deps/capstone/arch/ARM/ARMDisassembler.h +18 -0
- package/deps/capstone/arch/ARM/ARMGenAsmWriter.inc +9545 -0
- package/deps/capstone/arch/ARM/ARMGenDisassemblerTables.inc +15185 -0
- package/deps/capstone/arch/ARM/ARMGenInstrInfo.inc +6632 -0
- package/deps/capstone/arch/ARM/ARMGenRegisterInfo.inc +2102 -0
- package/deps/capstone/arch/ARM/ARMGenRegisterName.inc +231 -0
- package/deps/capstone/arch/ARM/ARMGenRegisterName_digit.inc +231 -0
- package/deps/capstone/arch/ARM/ARMGenSubtargetInfo.inc +162 -0
- package/deps/capstone/arch/ARM/ARMGenSystemRegister.inc +270 -0
- package/deps/capstone/arch/ARM/ARMInstPrinter.c +3364 -0
- package/deps/capstone/arch/ARM/ARMInstPrinter.h +43 -0
- package/deps/capstone/arch/ARM/ARMMapping.c +551 -0
- package/deps/capstone/arch/ARM/ARMMapping.h +40 -0
- package/deps/capstone/arch/ARM/ARMMappingInsn.inc +18772 -0
- package/deps/capstone/arch/ARM/ARMMappingInsnName.inc +475 -0
- package/deps/capstone/arch/ARM/ARMMappingInsnOp.inc +10729 -0
- package/deps/capstone/arch/ARM/ARMModule.c +63 -0
- package/deps/capstone/arch/ARM/ARMModule.h +12 -0
- package/deps/capstone/arch/BPF/BPFConstants.h +88 -0
- package/deps/capstone/arch/BPF/BPFDisassembler.c +464 -0
- package/deps/capstone/arch/BPF/BPFDisassembler.h +27 -0
- package/deps/capstone/arch/BPF/BPFInstPrinter.c +285 -0
- package/deps/capstone/arch/BPF/BPFInstPrinter.h +16 -0
- package/deps/capstone/arch/BPF/BPFMapping.c +513 -0
- package/deps/capstone/arch/BPF/BPFMapping.h +21 -0
- package/deps/capstone/arch/BPF/BPFModule.c +34 -0
- package/deps/capstone/arch/BPF/BPFModule.h +12 -0
- package/deps/capstone/arch/EVM/EVMDisassembler.c +379 -0
- package/deps/capstone/arch/EVM/EVMDisassembler.h +12 -0
- package/deps/capstone/arch/EVM/EVMInstPrinter.c +20 -0
- package/deps/capstone/arch/EVM/EVMInstPrinter.h +17 -0
- package/deps/capstone/arch/EVM/EVMMapping.c +344 -0
- package/deps/capstone/arch/EVM/EVMMapping.h +8 -0
- package/deps/capstone/arch/EVM/EVMMappingInsn.inc +259 -0
- package/deps/capstone/arch/EVM/EVMModule.c +33 -0
- package/deps/capstone/arch/EVM/EVMModule.h +12 -0
- package/deps/capstone/arch/M680X/M680XDisassembler.c +2307 -0
- package/deps/capstone/arch/M680X/M680XDisassembler.h +17 -0
- package/deps/capstone/arch/M680X/M680XDisassemblerInternals.h +57 -0
- package/deps/capstone/arch/M680X/M680XInstPrinter.c +360 -0
- package/deps/capstone/arch/M680X/M680XInstPrinter.h +25 -0
- package/deps/capstone/arch/M680X/M680XModule.c +77 -0
- package/deps/capstone/arch/M680X/M680XModule.h +12 -0
- package/deps/capstone/arch/M680X/cpu12.inc +335 -0
- package/deps/capstone/arch/M680X/hcs08.inc +60 -0
- package/deps/capstone/arch/M680X/hd6301.inc +15 -0
- package/deps/capstone/arch/M680X/hd6309.inc +259 -0
- package/deps/capstone/arch/M680X/insn_props.inc +367 -0
- package/deps/capstone/arch/M680X/m6800.inc +277 -0
- package/deps/capstone/arch/M680X/m6801.inc +39 -0
- package/deps/capstone/arch/M680X/m6805.inc +277 -0
- package/deps/capstone/arch/M680X/m6808.inc +91 -0
- package/deps/capstone/arch/M680X/m6809.inc +352 -0
- package/deps/capstone/arch/M680X/m6811.inc +105 -0
- package/deps/capstone/arch/M68K/M68KDisassembler.c +3668 -0
- package/deps/capstone/arch/M68K/M68KDisassembler.h +30 -0
- package/deps/capstone/arch/M68K/M68KInstPrinter.c +387 -0
- package/deps/capstone/arch/M68K/M68KInstPrinter.h +21 -0
- package/deps/capstone/arch/M68K/M68KInstructionTable.inc +65540 -0
- package/deps/capstone/arch/M68K/M68KModule.c +42 -0
- package/deps/capstone/arch/M68K/M68KModule.h +12 -0
- package/deps/capstone/arch/MOS65XX/MOS65XXDisassembler.c +544 -0
- package/deps/capstone/arch/MOS65XX/MOS65XXDisassembler.h +22 -0
- package/deps/capstone/arch/MOS65XX/MOS65XXDisassemblerInternals.h +23 -0
- package/deps/capstone/arch/MOS65XX/MOS65XXModule.c +79 -0
- package/deps/capstone/arch/MOS65XX/MOS65XXModule.h +12 -0
- package/deps/capstone/arch/MOS65XX/instruction_info.inc +106 -0
- package/deps/capstone/arch/MOS65XX/m6502.inc +256 -0
- package/deps/capstone/arch/MOS65XX/m65816.inc +256 -0
- package/deps/capstone/arch/MOS65XX/m65c02.inc +256 -0
- package/deps/capstone/arch/MOS65XX/mw65c02.inc +256 -0
- package/deps/capstone/arch/Mips/MipsDisassembler.c +1794 -0
- package/deps/capstone/arch/Mips/MipsDisassembler.h +16 -0
- package/deps/capstone/arch/Mips/MipsGenAsmWriter.inc +5725 -0
- package/deps/capstone/arch/Mips/MipsGenDisassemblerTables.inc +6942 -0
- package/deps/capstone/arch/Mips/MipsGenInstrInfo.inc +1805 -0
- package/deps/capstone/arch/Mips/MipsGenRegisterInfo.inc +1679 -0
- package/deps/capstone/arch/Mips/MipsGenSubtargetInfo.inc +52 -0
- package/deps/capstone/arch/Mips/MipsInstPrinter.c +424 -0
- package/deps/capstone/arch/Mips/MipsInstPrinter.h +25 -0
- package/deps/capstone/arch/Mips/MipsMapping.c +1070 -0
- package/deps/capstone/arch/Mips/MipsMapping.h +25 -0
- package/deps/capstone/arch/Mips/MipsMappingInsn.inc +9315 -0
- package/deps/capstone/arch/Mips/MipsModule.c +52 -0
- package/deps/capstone/arch/Mips/MipsModule.h +12 -0
- package/deps/capstone/arch/PowerPC/PPCDisassembler.c +627 -0
- package/deps/capstone/arch/PowerPC/PPCDisassembler.h +17 -0
- package/deps/capstone/arch/PowerPC/PPCGenAsmWriter.inc +11451 -0
- package/deps/capstone/arch/PowerPC/PPCGenDisassemblerTables.inc +6886 -0
- package/deps/capstone/arch/PowerPC/PPCGenInstrInfo.inc +4772 -0
- package/deps/capstone/arch/PowerPC/PPCGenRegisterInfo.inc +1122 -0
- package/deps/capstone/arch/PowerPC/PPCGenRegisterName.inc +278 -0
- package/deps/capstone/arch/PowerPC/PPCGenSubtargetInfo.inc +90 -0
- package/deps/capstone/arch/PowerPC/PPCInstPrinter.c +1238 -0
- package/deps/capstone/arch/PowerPC/PPCInstPrinter.h +15 -0
- package/deps/capstone/arch/PowerPC/PPCMapping.c +570 -0
- package/deps/capstone/arch/PowerPC/PPCMapping.h +40 -0
- package/deps/capstone/arch/PowerPC/PPCMappingInsn.inc +13220 -0
- package/deps/capstone/arch/PowerPC/PPCMappingInsnName.inc +1731 -0
- package/deps/capstone/arch/PowerPC/PPCModule.c +45 -0
- package/deps/capstone/arch/PowerPC/PPCModule.h +12 -0
- package/deps/capstone/arch/PowerPC/PPCPredicates.h +62 -0
- package/deps/capstone/arch/RISCV/RISCVBaseInfo.h +106 -0
- package/deps/capstone/arch/RISCV/RISCVDisassembler.c +433 -0
- package/deps/capstone/arch/RISCV/RISCVDisassembler.h +18 -0
- package/deps/capstone/arch/RISCV/RISCVGenAsmWriter.inc +2651 -0
- package/deps/capstone/arch/RISCV/RISCVGenDisassemblerTables.inc +1776 -0
- package/deps/capstone/arch/RISCV/RISCVGenInsnNameMaps.inc +275 -0
- package/deps/capstone/arch/RISCV/RISCVGenInstrInfo.inc +470 -0
- package/deps/capstone/arch/RISCV/RISCVGenRegisterInfo.inc +426 -0
- package/deps/capstone/arch/RISCV/RISCVGenSubtargetInfo.inc +33 -0
- package/deps/capstone/arch/RISCV/RISCVInstPrinter.c +447 -0
- package/deps/capstone/arch/RISCV/RISCVInstPrinter.h +24 -0
- package/deps/capstone/arch/RISCV/RISCVMapping.c +366 -0
- package/deps/capstone/arch/RISCV/RISCVMapping.h +22 -0
- package/deps/capstone/arch/RISCV/RISCVMappingInsn.inc +1635 -0
- package/deps/capstone/arch/RISCV/RISCVModule.c +42 -0
- package/deps/capstone/arch/RISCV/RISCVModule.h +12 -0
- package/deps/capstone/arch/SH/SHDisassembler.c +2221 -0
- package/deps/capstone/arch/SH/SHDisassembler.h +19 -0
- package/deps/capstone/arch/SH/SHInsnTable.inc +66 -0
- package/deps/capstone/arch/SH/SHInstPrinter.c +438 -0
- package/deps/capstone/arch/SH/SHInstPrinter.h +23 -0
- package/deps/capstone/arch/SH/SHModule.c +39 -0
- package/deps/capstone/arch/SH/SHModule.h +12 -0
- package/deps/capstone/arch/SH/mktable.rb +390 -0
- package/deps/capstone/arch/Sparc/Sparc.h +63 -0
- package/deps/capstone/arch/Sparc/SparcDisassembler.c +500 -0
- package/deps/capstone/arch/Sparc/SparcDisassembler.h +17 -0
- package/deps/capstone/arch/Sparc/SparcGenAsmWriter.inc +5709 -0
- package/deps/capstone/arch/Sparc/SparcGenDisassemblerTables.inc +2028 -0
- package/deps/capstone/arch/Sparc/SparcGenInstrInfo.inc +514 -0
- package/deps/capstone/arch/Sparc/SparcGenRegisterInfo.inc +451 -0
- package/deps/capstone/arch/Sparc/SparcGenSubtargetInfo.inc +27 -0
- package/deps/capstone/arch/Sparc/SparcInstPrinter.c +446 -0
- package/deps/capstone/arch/Sparc/SparcInstPrinter.h +17 -0
- package/deps/capstone/arch/Sparc/SparcMapping.c +665 -0
- package/deps/capstone/arch/Sparc/SparcMapping.h +34 -0
- package/deps/capstone/arch/Sparc/SparcMappingInsn.inc +2643 -0
- package/deps/capstone/arch/Sparc/SparcModule.c +45 -0
- package/deps/capstone/arch/Sparc/SparcModule.h +12 -0
- package/deps/capstone/arch/SystemZ/SystemZDisassembler.c +484 -0
- package/deps/capstone/arch/SystemZ/SystemZDisassembler.h +17 -0
- package/deps/capstone/arch/SystemZ/SystemZGenAsmWriter.inc +11575 -0
- package/deps/capstone/arch/SystemZ/SystemZGenDisassemblerTables.inc +10262 -0
- package/deps/capstone/arch/SystemZ/SystemZGenInsnNameMaps.inc +2348 -0
- package/deps/capstone/arch/SystemZ/SystemZGenInstrInfo.inc +2820 -0
- package/deps/capstone/arch/SystemZ/SystemZGenRegisterInfo.inc +741 -0
- package/deps/capstone/arch/SystemZ/SystemZGenSubtargetInfo.inc +49 -0
- package/deps/capstone/arch/SystemZ/SystemZInstPrinter.c +433 -0
- package/deps/capstone/arch/SystemZ/SystemZInstPrinter.h +15 -0
- package/deps/capstone/arch/SystemZ/SystemZMCTargetDesc.c +195 -0
- package/deps/capstone/arch/SystemZ/SystemZMCTargetDesc.h +51 -0
- package/deps/capstone/arch/SystemZ/SystemZMapping.c +479 -0
- package/deps/capstone/arch/SystemZ/SystemZMapping.h +23 -0
- package/deps/capstone/arch/SystemZ/SystemZMappingInsn.inc +14175 -0
- package/deps/capstone/arch/SystemZ/SystemZModule.c +44 -0
- package/deps/capstone/arch/SystemZ/SystemZModule.h +12 -0
- package/deps/capstone/arch/TMS320C64x/TMS320C64xDisassembler.c +628 -0
- package/deps/capstone/arch/TMS320C64x/TMS320C64xDisassembler.h +19 -0
- package/deps/capstone/arch/TMS320C64x/TMS320C64xGenAsmWriter.inc +684 -0
- package/deps/capstone/arch/TMS320C64x/TMS320C64xGenDisassemblerTables.inc +1352 -0
- package/deps/capstone/arch/TMS320C64x/TMS320C64xGenInstrInfo.inc +298 -0
- package/deps/capstone/arch/TMS320C64x/TMS320C64xGenRegisterInfo.inc +277 -0
- package/deps/capstone/arch/TMS320C64x/TMS320C64xInstPrinter.c +572 -0
- package/deps/capstone/arch/TMS320C64x/TMS320C64xInstPrinter.h +15 -0
- package/deps/capstone/arch/TMS320C64x/TMS320C64xMapping.c +1926 -0
- package/deps/capstone/arch/TMS320C64x/TMS320C64xMapping.h +26 -0
- package/deps/capstone/arch/TMS320C64x/TMS320C64xModule.c +39 -0
- package/deps/capstone/arch/TMS320C64x/TMS320C64xModule.h +12 -0
- package/deps/capstone/arch/TriCore/TriCore.td +134 -0
- package/deps/capstone/arch/TriCore/TriCoreCallingConv.td +61 -0
- package/deps/capstone/arch/TriCore/TriCoreDisassembler.c +1655 -0
- package/deps/capstone/arch/TriCore/TriCoreDisassembler.h +18 -0
- package/deps/capstone/arch/TriCore/TriCoreGenAsmWriter.inc +3691 -0
- package/deps/capstone/arch/TriCore/TriCoreGenCSFeatureName.inc +22 -0
- package/deps/capstone/arch/TriCore/TriCoreGenCSMappingInsn.inc +8938 -0
- package/deps/capstone/arch/TriCore/TriCoreGenCSMappingInsnName.inc +404 -0
- package/deps/capstone/arch/TriCore/TriCoreGenCSMappingInsnOp.inc +7994 -0
- package/deps/capstone/arch/TriCore/TriCoreGenCSOpGroup.inc +32 -0
- package/deps/capstone/arch/TriCore/TriCoreGenDisassemblerTables.inc +4044 -0
- package/deps/capstone/arch/TriCore/TriCoreGenInstrInfo.inc +2693 -0
- package/deps/capstone/arch/TriCore/TriCoreGenRegisterInfo.inc +295 -0
- package/deps/capstone/arch/TriCore/TriCoreGenSubtargetInfo.inc +40 -0
- package/deps/capstone/arch/TriCore/TriCoreInstPrinter.c +488 -0
- package/deps/capstone/arch/TriCore/TriCoreInstrFormats.td +773 -0
- package/deps/capstone/arch/TriCore/TriCoreInstrInfo.td +1873 -0
- package/deps/capstone/arch/TriCore/TriCoreLinkage.h +21 -0
- package/deps/capstone/arch/TriCore/TriCoreMapping.c +241 -0
- package/deps/capstone/arch/TriCore/TriCoreMapping.h +32 -0
- package/deps/capstone/arch/TriCore/TriCoreModule.c +44 -0
- package/deps/capstone/arch/TriCore/TriCoreModule.h +11 -0
- package/deps/capstone/arch/TriCore/TriCoreRegisterInfo.td +153 -0
- package/deps/capstone/arch/WASM/WASMDisassembler.c +1009 -0
- package/deps/capstone/arch/WASM/WASMDisassembler.h +12 -0
- package/deps/capstone/arch/WASM/WASMInstPrinter.c +47 -0
- package/deps/capstone/arch/WASM/WASMInstPrinter.h +18 -0
- package/deps/capstone/arch/WASM/WASMMapping.c +333 -0
- package/deps/capstone/arch/WASM/WASMMapping.h +9 -0
- package/deps/capstone/arch/WASM/WASMModule.c +33 -0
- package/deps/capstone/arch/WASM/WASMModule.h +12 -0
- package/deps/capstone/arch/X86/X86ATTInstPrinter.c +997 -0
- package/deps/capstone/arch/X86/X86BaseInfo.h +50 -0
- package/deps/capstone/arch/X86/X86Disassembler.c +1033 -0
- package/deps/capstone/arch/X86/X86Disassembler.h +28 -0
- package/deps/capstone/arch/X86/X86DisassemblerDecoder.c +2358 -0
- package/deps/capstone/arch/X86/X86DisassemblerDecoder.h +725 -0
- package/deps/capstone/arch/X86/X86DisassemblerDecoderCommon.h +483 -0
- package/deps/capstone/arch/X86/X86GenAsmWriter.inc +49199 -0
- package/deps/capstone/arch/X86/X86GenAsmWriter1.inc +33196 -0
- package/deps/capstone/arch/X86/X86GenAsmWriter1_reduce.inc +2531 -0
- package/deps/capstone/arch/X86/X86GenAsmWriter_reduce.inc +2855 -0
- package/deps/capstone/arch/X86/X86GenDisassemblerTables.inc +112961 -0
- package/deps/capstone/arch/X86/X86GenDisassemblerTables2.inc +102151 -0
- package/deps/capstone/arch/X86/X86GenDisassemblerTables_reduce.inc +28047 -0
- package/deps/capstone/arch/X86/X86GenDisassemblerTables_reduce2.inc +18827 -0
- package/deps/capstone/arch/X86/X86GenInstrInfo.inc +15158 -0
- package/deps/capstone/arch/X86/X86GenInstrInfo_reduce.inc +1564 -0
- package/deps/capstone/arch/X86/X86GenRegisterInfo.inc +1549 -0
- package/deps/capstone/arch/X86/X86GenRegisterName.inc +292 -0
- package/deps/capstone/arch/X86/X86GenRegisterName1.inc +291 -0
- package/deps/capstone/arch/X86/X86ImmSize.inc +335 -0
- package/deps/capstone/arch/X86/X86InstPrinter.h +26 -0
- package/deps/capstone/arch/X86/X86InstPrinterCommon.c +116 -0
- package/deps/capstone/arch/X86/X86InstPrinterCommon.h +16 -0
- package/deps/capstone/arch/X86/X86IntelInstPrinter.c +1061 -0
- package/deps/capstone/arch/X86/X86Lookup16.inc +16874 -0
- package/deps/capstone/arch/X86/X86Lookup16_reduce.inc +2308 -0
- package/deps/capstone/arch/X86/X86Mapping.c +2266 -0
- package/deps/capstone/arch/X86/X86Mapping.h +96 -0
- package/deps/capstone/arch/X86/X86MappingInsn.inc +105977 -0
- package/deps/capstone/arch/X86/X86MappingInsnName.inc +1527 -0
- package/deps/capstone/arch/X86/X86MappingInsnName_reduce.inc +348 -0
- package/deps/capstone/arch/X86/X86MappingInsnOp.inc +75700 -0
- package/deps/capstone/arch/X86/X86MappingInsnOp_reduce.inc +7729 -0
- package/deps/capstone/arch/X86/X86MappingInsn_reduce.inc +10819 -0
- package/deps/capstone/arch/X86/X86MappingReg.inc +280 -0
- package/deps/capstone/arch/X86/X86Module.c +94 -0
- package/deps/capstone/arch/X86/X86Module.h +12 -0
- package/deps/capstone/arch/XCore/XCoreDisassembler.c +794 -0
- package/deps/capstone/arch/XCore/XCoreDisassembler.h +17 -0
- package/deps/capstone/arch/XCore/XCoreGenAsmWriter.inc +772 -0
- package/deps/capstone/arch/XCore/XCoreGenDisassemblerTables.inc +853 -0
- package/deps/capstone/arch/XCore/XCoreGenInstrInfo.inc +267 -0
- package/deps/capstone/arch/XCore/XCoreGenRegisterInfo.inc +110 -0
- package/deps/capstone/arch/XCore/XCoreInstPrinter.c +250 -0
- package/deps/capstone/arch/XCore/XCoreInstPrinter.h +18 -0
- package/deps/capstone/arch/XCore/XCoreMapping.c +297 -0
- package/deps/capstone/arch/XCore/XCoreMapping.h +26 -0
- package/deps/capstone/arch/XCore/XCoreMappingInsn.inc +1287 -0
- package/deps/capstone/arch/XCore/XCoreModule.c +41 -0
- package/deps/capstone/arch/XCore/XCoreModule.h +12 -0
- package/deps/capstone/cs.c +1664 -0
- package/deps/capstone/cs_priv.h +101 -0
- package/deps/capstone/cs_simple_types.h +886 -0
- package/deps/capstone/include/capstone/arm.h +991 -0
- package/deps/capstone/include/capstone/arm64.h +3159 -0
- package/deps/capstone/include/capstone/bpf.h +209 -0
- package/deps/capstone/include/capstone/capstone.h +875 -0
- package/deps/capstone/include/capstone/evm.h +188 -0
- package/deps/capstone/include/capstone/m680x.h +537 -0
- package/deps/capstone/include/capstone/m68k.h +613 -0
- package/deps/capstone/include/capstone/mips.h +956 -0
- package/deps/capstone/include/capstone/mos65xx.h +204 -0
- package/deps/capstone/include/capstone/platform.h +122 -0
- package/deps/capstone/include/capstone/ppc.h +2108 -0
- package/deps/capstone/include/capstone/riscv.h +531 -0
- package/deps/capstone/include/capstone/sh.h +465 -0
- package/deps/capstone/include/capstone/sparc.h +520 -0
- package/deps/capstone/include/capstone/systemz.h +2601 -0
- package/deps/capstone/include/capstone/tms320c64x.h +359 -0
- package/deps/capstone/include/capstone/tricore.h +567 -0
- package/deps/capstone/include/capstone/wasm.h +250 -0
- package/deps/capstone/include/capstone/x86.h +1986 -0
- package/deps/capstone/include/capstone/xcore.h +235 -0
- package/deps/capstone/include/platform.h +110 -0
- package/deps/capstone/include/windowsce/intrin.h +12 -0
- package/deps/capstone/include/windowsce/stdint.h +133 -0
- package/deps/capstone/utils.c +140 -0
- package/deps/capstone/utils.h +54 -0
- package/index.d.ts +448 -0
- package/index.js +64 -0
- package/index.mjs +25 -0
- package/package.json +82 -0
- package/prebuilds/win32-x64/hexcore-capstone.node +0 -0
- package/src/capstone_wrapper.cpp +910 -0
- package/src/capstone_wrapper.h +147 -0
- package/src/disasm_async_worker.h +215 -0
- package/src/main.cpp +145 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,448 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HexCore Capstone - TypeScript Definitions
|
|
3
|
+
* Modern N-API bindings for Capstone disassembler engine
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) HikariSystem. All rights reserved.
|
|
6
|
+
* Licensed under MIT License.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/// <reference types="node" />
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Architecture constants
|
|
13
|
+
*/
|
|
14
|
+
export const ARCH: {
|
|
15
|
+
readonly ARM: number;
|
|
16
|
+
readonly ARM64: number;
|
|
17
|
+
readonly MIPS: number;
|
|
18
|
+
readonly X86: number;
|
|
19
|
+
readonly PPC: number;
|
|
20
|
+
readonly SPARC: number;
|
|
21
|
+
readonly SYSZ: number;
|
|
22
|
+
readonly XCORE: number;
|
|
23
|
+
readonly M68K: number;
|
|
24
|
+
readonly TMS320C64X: number;
|
|
25
|
+
readonly M680X: number;
|
|
26
|
+
readonly EVM: number;
|
|
27
|
+
readonly WASM?: number;
|
|
28
|
+
readonly BPF?: number;
|
|
29
|
+
readonly RISCV?: number;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Mode constants
|
|
34
|
+
*/
|
|
35
|
+
export const MODE: {
|
|
36
|
+
readonly LITTLE_ENDIAN: number;
|
|
37
|
+
readonly BIG_ENDIAN: number;
|
|
38
|
+
readonly ARM: number;
|
|
39
|
+
readonly THUMB: number;
|
|
40
|
+
readonly MCLASS: number;
|
|
41
|
+
readonly V8: number;
|
|
42
|
+
readonly MODE_16: number;
|
|
43
|
+
readonly MODE_32: number;
|
|
44
|
+
readonly MODE_64: number;
|
|
45
|
+
readonly MICRO: number;
|
|
46
|
+
readonly MIPS3: number;
|
|
47
|
+
readonly MIPS32R6: number;
|
|
48
|
+
readonly MIPS2: number;
|
|
49
|
+
readonly V9: number;
|
|
50
|
+
readonly QPX: number;
|
|
51
|
+
readonly M68K_000: number;
|
|
52
|
+
readonly M68K_010: number;
|
|
53
|
+
readonly M68K_020: number;
|
|
54
|
+
readonly M68K_030: number;
|
|
55
|
+
readonly M68K_040: number;
|
|
56
|
+
readonly M68K_060: number;
|
|
57
|
+
readonly RISCV32?: number;
|
|
58
|
+
readonly RISCV64?: number;
|
|
59
|
+
readonly RISCVC?: number;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Option type constants
|
|
64
|
+
*/
|
|
65
|
+
export const OPT: {
|
|
66
|
+
readonly SYNTAX: number;
|
|
67
|
+
readonly DETAIL: number;
|
|
68
|
+
readonly MODE: number;
|
|
69
|
+
readonly MEM: number;
|
|
70
|
+
readonly SKIPDATA: number;
|
|
71
|
+
readonly SKIPDATA_SETUP: number;
|
|
72
|
+
readonly MNEMONIC: number;
|
|
73
|
+
readonly UNSIGNED: number;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Option value constants
|
|
78
|
+
*/
|
|
79
|
+
export const OPT_VALUE: {
|
|
80
|
+
readonly OFF: number;
|
|
81
|
+
readonly ON: number;
|
|
82
|
+
readonly SYNTAX_DEFAULT: number;
|
|
83
|
+
readonly SYNTAX_INTEL: number;
|
|
84
|
+
readonly SYNTAX_ATT: number;
|
|
85
|
+
readonly SYNTAX_NOREGNAME: number;
|
|
86
|
+
readonly SYNTAX_MASM: number;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Error code constants
|
|
91
|
+
*/
|
|
92
|
+
export const ERR: {
|
|
93
|
+
readonly OK: number;
|
|
94
|
+
readonly MEM: number;
|
|
95
|
+
readonly ARCH: number;
|
|
96
|
+
readonly HANDLE: number;
|
|
97
|
+
readonly CSH: number;
|
|
98
|
+
readonly MODE: number;
|
|
99
|
+
readonly OPTION: number;
|
|
100
|
+
readonly DETAIL: number;
|
|
101
|
+
readonly MEMSETUP: number;
|
|
102
|
+
readonly VERSION: number;
|
|
103
|
+
readonly DIET: number;
|
|
104
|
+
readonly SKIPDATA: number;
|
|
105
|
+
readonly X86_ATT: number;
|
|
106
|
+
readonly X86_INTEL: number;
|
|
107
|
+
readonly X86_MASM: number;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Memory operand structure
|
|
112
|
+
*/
|
|
113
|
+
export interface MemoryOperand {
|
|
114
|
+
segment?: number;
|
|
115
|
+
base: number;
|
|
116
|
+
index?: number;
|
|
117
|
+
scale?: number;
|
|
118
|
+
disp: number;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* x86 operand structure
|
|
123
|
+
*/
|
|
124
|
+
export interface X86Operand {
|
|
125
|
+
type: number;
|
|
126
|
+
size: number;
|
|
127
|
+
access: number;
|
|
128
|
+
avxBcast: number;
|
|
129
|
+
avxZeroOpmask: boolean;
|
|
130
|
+
reg?: number;
|
|
131
|
+
imm?: number;
|
|
132
|
+
mem?: MemoryOperand;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* x86 instruction detail
|
|
137
|
+
*/
|
|
138
|
+
export interface X86Detail {
|
|
139
|
+
prefix: number[];
|
|
140
|
+
opcode: number[];
|
|
141
|
+
rexPrefix: number;
|
|
142
|
+
addrSize: number;
|
|
143
|
+
modRM: number;
|
|
144
|
+
sib: number;
|
|
145
|
+
disp: number;
|
|
146
|
+
sibIndex: number;
|
|
147
|
+
sibScale: number;
|
|
148
|
+
sibBase: number;
|
|
149
|
+
xopCC: number;
|
|
150
|
+
sseCC: number;
|
|
151
|
+
avxCC: number;
|
|
152
|
+
avxSAE: boolean;
|
|
153
|
+
avxRM: number;
|
|
154
|
+
eflags: number;
|
|
155
|
+
operands: X86Operand[];
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* ARM operand structure
|
|
160
|
+
*/
|
|
161
|
+
export interface ArmOperand {
|
|
162
|
+
type: number;
|
|
163
|
+
access: number;
|
|
164
|
+
reg?: number;
|
|
165
|
+
imm?: number;
|
|
166
|
+
fp?: number;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* ARM instruction detail
|
|
171
|
+
*/
|
|
172
|
+
export interface ArmDetail {
|
|
173
|
+
usermode: boolean;
|
|
174
|
+
vectorSize: number;
|
|
175
|
+
vectorData: number;
|
|
176
|
+
cpsMode: number;
|
|
177
|
+
cpsFlag: number;
|
|
178
|
+
cc: number;
|
|
179
|
+
updateFlags: boolean;
|
|
180
|
+
writeback: boolean;
|
|
181
|
+
memBarrier: number;
|
|
182
|
+
operands: ArmOperand[];
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* ARM64 operand structure
|
|
187
|
+
*/
|
|
188
|
+
export interface Arm64Operand {
|
|
189
|
+
type: number;
|
|
190
|
+
access: number;
|
|
191
|
+
reg?: number;
|
|
192
|
+
imm?: number;
|
|
193
|
+
fp?: number;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* ARM64 instruction detail
|
|
198
|
+
*/
|
|
199
|
+
export interface Arm64Detail {
|
|
200
|
+
cc: number;
|
|
201
|
+
updateFlags: boolean;
|
|
202
|
+
writeback: boolean;
|
|
203
|
+
operands: Arm64Operand[];
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* MIPS operand structure
|
|
208
|
+
*/
|
|
209
|
+
export interface MipsOperand {
|
|
210
|
+
type: number;
|
|
211
|
+
reg?: number;
|
|
212
|
+
imm?: number;
|
|
213
|
+
mem?: {
|
|
214
|
+
base: number;
|
|
215
|
+
disp: number;
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* MIPS instruction detail
|
|
221
|
+
*/
|
|
222
|
+
export interface MipsDetail {
|
|
223
|
+
operands: MipsOperand[];
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Instruction detail (when detail mode is enabled)
|
|
228
|
+
*/
|
|
229
|
+
export interface InstructionDetail {
|
|
230
|
+
regsRead: number[];
|
|
231
|
+
regsWrite: number[];
|
|
232
|
+
groups: number[];
|
|
233
|
+
x86?: X86Detail;
|
|
234
|
+
arm?: ArmDetail;
|
|
235
|
+
arm64?: Arm64Detail;
|
|
236
|
+
mips?: MipsDetail;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Disassembled instruction
|
|
241
|
+
*/
|
|
242
|
+
export interface Instruction {
|
|
243
|
+
/** Instruction ID */
|
|
244
|
+
id: number;
|
|
245
|
+
/** Address of this instruction */
|
|
246
|
+
address: number;
|
|
247
|
+
/** Size of this instruction in bytes */
|
|
248
|
+
size: number;
|
|
249
|
+
/** Raw bytes of this instruction */
|
|
250
|
+
bytes: Buffer;
|
|
251
|
+
/** Mnemonic (e.g., "mov", "push") */
|
|
252
|
+
mnemonic: string;
|
|
253
|
+
/** Operand string (e.g., "rax, rbx") */
|
|
254
|
+
opStr: string;
|
|
255
|
+
/** Detailed info (only when detail mode is enabled) */
|
|
256
|
+
detail?: InstructionDetail;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Version information
|
|
261
|
+
*/
|
|
262
|
+
export interface Version {
|
|
263
|
+
major: number;
|
|
264
|
+
minor: number;
|
|
265
|
+
string: string;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Capstone disassembler class
|
|
270
|
+
*
|
|
271
|
+
* @example
|
|
272
|
+
* ```typescript
|
|
273
|
+
* import { Capstone, ARCH, MODE, OPT, OPT_VALUE } from 'hexcore-capstone';
|
|
274
|
+
*
|
|
275
|
+
* // Create disassembler for x86-64
|
|
276
|
+
* const cs = new Capstone(ARCH.X86, MODE.MODE_64);
|
|
277
|
+
*
|
|
278
|
+
* // Enable detail mode for operand info
|
|
279
|
+
* cs.setOption(OPT.DETAIL, OPT_VALUE.ON);
|
|
280
|
+
*
|
|
281
|
+
* // Disassemble code
|
|
282
|
+
* const code = Buffer.from([0x55, 0x48, 0x89, 0xe5]);
|
|
283
|
+
* const instructions = cs.disasm(code, 0x1000);
|
|
284
|
+
*
|
|
285
|
+
* for (const insn of instructions) {
|
|
286
|
+
* console.log(`${insn.address.toString(16)}: ${insn.mnemonic} ${insn.opStr}`);
|
|
287
|
+
* }
|
|
288
|
+
*
|
|
289
|
+
* // Clean up
|
|
290
|
+
* cs.close();
|
|
291
|
+
* ```
|
|
292
|
+
*/
|
|
293
|
+
export class Capstone {
|
|
294
|
+
/**
|
|
295
|
+
* Create a new Capstone disassembler instance
|
|
296
|
+
*
|
|
297
|
+
* @param arch - Architecture constant (use ARCH.X86, ARCH.ARM, etc.)
|
|
298
|
+
* @param mode - Mode flags (use MODE.MODE_64, MODE.LITTLE_ENDIAN, etc.)
|
|
299
|
+
* @throws Error if architecture or mode is invalid
|
|
300
|
+
*
|
|
301
|
+
* @example
|
|
302
|
+
* ```typescript
|
|
303
|
+
* // x86-64 disassembler
|
|
304
|
+
* const cs64 = new Capstone(ARCH.X86, MODE.MODE_64);
|
|
305
|
+
*
|
|
306
|
+
* // ARM Thumb mode
|
|
307
|
+
* const csArm = new Capstone(ARCH.ARM, MODE.THUMB);
|
|
308
|
+
*
|
|
309
|
+
* // MIPS big-endian 32-bit
|
|
310
|
+
* const csMips = new Capstone(ARCH.MIPS, MODE.MODE_32 | MODE.BIG_ENDIAN);
|
|
311
|
+
* ```
|
|
312
|
+
*/
|
|
313
|
+
constructor(arch: number, mode: number);
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Disassemble code buffer (synchronous)
|
|
317
|
+
*
|
|
318
|
+
* **Note:** For large buffers (>1MB), use `disasmAsync()` to avoid blocking.
|
|
319
|
+
*
|
|
320
|
+
* @param code - Buffer containing machine code to disassemble
|
|
321
|
+
* @param address - Base address of the code (for correct jump targets)
|
|
322
|
+
* @param count - Maximum number of instructions to disassemble (0 = all)
|
|
323
|
+
* @returns Array of disassembled instructions
|
|
324
|
+
*
|
|
325
|
+
* @example
|
|
326
|
+
* ```typescript
|
|
327
|
+
* const code = Buffer.from([0x55, 0x48, 0x89, 0xe5, 0xc3]);
|
|
328
|
+
* const insns = cs.disasm(code, 0x401000);
|
|
329
|
+
* // Returns: push rbp, mov rbp,rsp, ret
|
|
330
|
+
* ```
|
|
331
|
+
*/
|
|
332
|
+
disasm(code: Buffer | Uint8Array, address: number, count?: number): Instruction[];
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Disassemble code buffer (asynchronous, non-blocking)
|
|
336
|
+
*
|
|
337
|
+
* Use this method for large buffers to avoid blocking the event loop.
|
|
338
|
+
* The disassembly runs in a background thread and returns a Promise.
|
|
339
|
+
*
|
|
340
|
+
* @param code - Buffer containing machine code to disassemble
|
|
341
|
+
* @param address - Base address of the code (for correct jump targets)
|
|
342
|
+
* @param count - Maximum number of instructions to disassemble (0 = all)
|
|
343
|
+
* @returns Promise resolving to array of disassembled instructions
|
|
344
|
+
*
|
|
345
|
+
* @example
|
|
346
|
+
* ```typescript
|
|
347
|
+
* // Large file async disassembly
|
|
348
|
+
* const largeCode = fs.readFileSync('large_binary.bin');
|
|
349
|
+
* const insns = await cs.disasmAsync(largeCode, 0x401000);
|
|
350
|
+
* console.log(`Disassembled ${insns.length} instructions`);
|
|
351
|
+
* ```
|
|
352
|
+
*/
|
|
353
|
+
disasmAsync(code: Buffer | Uint8Array, address: number, count?: number): Promise<Instruction[]>;
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Set a disassembler option
|
|
357
|
+
*
|
|
358
|
+
* @param type - Option type (OPT.DETAIL, OPT.SYNTAX, etc.)
|
|
359
|
+
* @param value - Option value (OPT_VALUE.ON, OPT_VALUE.SYNTAX_INTEL, etc.)
|
|
360
|
+
* @returns true on success, throws on failure
|
|
361
|
+
*
|
|
362
|
+
* @example
|
|
363
|
+
* ```typescript
|
|
364
|
+
* // Enable detailed instruction info
|
|
365
|
+
* cs.setOption(OPT.DETAIL, OPT_VALUE.ON);
|
|
366
|
+
*
|
|
367
|
+
* // Use Intel syntax (default)
|
|
368
|
+
* cs.setOption(OPT.SYNTAX, OPT_VALUE.SYNTAX_INTEL);
|
|
369
|
+
*
|
|
370
|
+
* // Use AT&T syntax
|
|
371
|
+
* cs.setOption(OPT.SYNTAX, OPT_VALUE.SYNTAX_ATT);
|
|
372
|
+
* ```
|
|
373
|
+
*/
|
|
374
|
+
setOption(type: number, value: number): boolean;
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* Close the disassembler and free resources
|
|
378
|
+
*
|
|
379
|
+
* Always call this when done to prevent memory leaks.
|
|
380
|
+
*/
|
|
381
|
+
close(): void;
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Get register name by ID
|
|
385
|
+
*
|
|
386
|
+
* @param regId - Register ID from instruction details
|
|
387
|
+
* @returns Register name (e.g., "rax", "eip") or null if not found
|
|
388
|
+
*
|
|
389
|
+
* @example
|
|
390
|
+
* ```typescript
|
|
391
|
+
* const insn = cs.disasm(code, 0x1000)[0];
|
|
392
|
+
* if (insn.detail?.x86?.operands[0]?.reg) {
|
|
393
|
+
* console.log(cs.regName(insn.detail.x86.operands[0].reg)); // "rbp"
|
|
394
|
+
* }
|
|
395
|
+
* ```
|
|
396
|
+
*/
|
|
397
|
+
regName(regId: number): string | null;
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* Get instruction name by ID
|
|
401
|
+
*
|
|
402
|
+
* @param insnId - Instruction ID from disassembled instruction
|
|
403
|
+
* @returns Instruction name or null if not found
|
|
404
|
+
*/
|
|
405
|
+
insnName(insnId: number): string | null;
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* Get group name by ID
|
|
409
|
+
*
|
|
410
|
+
* @param groupId - Group ID from instruction details
|
|
411
|
+
* @returns Group name (e.g., "jump", "call", "ret") or null
|
|
412
|
+
*/
|
|
413
|
+
groupName(groupId: number): string | null;
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* Check if the disassembler handle is still open
|
|
417
|
+
* @returns true if open
|
|
418
|
+
*/
|
|
419
|
+
isOpen(): boolean;
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* Get the last error code
|
|
423
|
+
* @returns Error code (use ERR constants)
|
|
424
|
+
*/
|
|
425
|
+
getError(): number;
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* Get error message string
|
|
429
|
+
* @param err - Error code (optional, defaults to last error)
|
|
430
|
+
* @returns Error message
|
|
431
|
+
*/
|
|
432
|
+
strError(err?: number): string;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* Get Capstone version
|
|
437
|
+
* @returns Version information
|
|
438
|
+
*/
|
|
439
|
+
export function version(): Version;
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* Check if an architecture is supported
|
|
443
|
+
* @param arch Architecture constant
|
|
444
|
+
* @returns true if supported
|
|
445
|
+
*/
|
|
446
|
+
export function support(arch: number): boolean;
|
|
447
|
+
|
|
448
|
+
export default Capstone;
|
package/index.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HexCore Capstone - Native Node.js Bindings
|
|
3
|
+
* Modern N-API bindings for Capstone disassembler engine
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) HikariSystem. All rights reserved.
|
|
6
|
+
* Licensed under MIT License.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* const { Capstone, ARCH, MODE } = require('hexcore-capstone');
|
|
10
|
+
*
|
|
11
|
+
* const cs = new Capstone(ARCH.X86, MODE.MODE_64);
|
|
12
|
+
* const code = Buffer.from([0x55, 0x48, 0x89, 0xe5]);
|
|
13
|
+
* const instructions = cs.disasm(code, 0x1000);
|
|
14
|
+
*
|
|
15
|
+
* for (const insn of instructions) {
|
|
16
|
+
* console.log(`${insn.address.toString(16)}: ${insn.mnemonic} ${insn.opStr}`);
|
|
17
|
+
* }
|
|
18
|
+
*
|
|
19
|
+
* cs.close();
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
'use strict';
|
|
23
|
+
|
|
24
|
+
// Load the native addon
|
|
25
|
+
let binding;
|
|
26
|
+
try {
|
|
27
|
+
// Try to load prebuilt binary first
|
|
28
|
+
binding = require('./prebuilds/' + process.platform + '-' + process.arch + '/node.napi.node');
|
|
29
|
+
} catch (e1) {
|
|
30
|
+
try {
|
|
31
|
+
// Fall back to node-gyp built binary
|
|
32
|
+
binding = require('./build/Release/capstone_native.node');
|
|
33
|
+
} catch (e2) {
|
|
34
|
+
try {
|
|
35
|
+
// Try debug build
|
|
36
|
+
binding = require('./build/Debug/capstone_native.node');
|
|
37
|
+
} catch (e3) {
|
|
38
|
+
throw new Error(
|
|
39
|
+
'Failed to load hexcore-capstone native module. ' +
|
|
40
|
+
'Make sure you have run npm install and have the required build tools. ' +
|
|
41
|
+
'Original errors:\n' +
|
|
42
|
+
` Prebuild: ${e1.message}\n` +
|
|
43
|
+
` Release: ${e2.message}\n` +
|
|
44
|
+
` Debug: ${e3.message}`
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Export everything from the binding
|
|
51
|
+
module.exports = binding;
|
|
52
|
+
|
|
53
|
+
// Add convenience aliases
|
|
54
|
+
module.exports.default = binding.Capstone;
|
|
55
|
+
|
|
56
|
+
// Export named constants for easier destructuring
|
|
57
|
+
module.exports.Capstone = binding.Capstone;
|
|
58
|
+
module.exports.ARCH = binding.ARCH;
|
|
59
|
+
module.exports.MODE = binding.MODE;
|
|
60
|
+
module.exports.OPT = binding.OPT;
|
|
61
|
+
module.exports.OPT_VALUE = binding.OPT_VALUE;
|
|
62
|
+
module.exports.ERR = binding.ERR;
|
|
63
|
+
module.exports.version = binding.version;
|
|
64
|
+
module.exports.support = binding.support;
|
package/index.mjs
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HexCore Capstone - ESM Wrapper
|
|
3
|
+
* ECMAScript Module support for modern Node.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) HikariSystem. All rights reserved.
|
|
6
|
+
* Licensed under MIT License.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { createRequire } from 'module';
|
|
10
|
+
const require = createRequire(import.meta.url);
|
|
11
|
+
|
|
12
|
+
const capstone = require('./index.js');
|
|
13
|
+
|
|
14
|
+
export const {
|
|
15
|
+
Capstone,
|
|
16
|
+
ARCH,
|
|
17
|
+
MODE,
|
|
18
|
+
OPT,
|
|
19
|
+
OPT_VALUE,
|
|
20
|
+
ERR,
|
|
21
|
+
version,
|
|
22
|
+
support
|
|
23
|
+
} = capstone;
|
|
24
|
+
|
|
25
|
+
export default Capstone;
|
package/package.json
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "hexcore-capstone",
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"description": "Modern Node.js bindings for Capstone disassembler engine using N-API",
|
|
5
|
+
"main": "./index.js",
|
|
6
|
+
"module": "./index.mjs",
|
|
7
|
+
"types": "./index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./index.mjs",
|
|
11
|
+
"require": "./index.js",
|
|
12
|
+
"types": "./index.d.ts"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"install": "prebuild-install || node-gyp rebuild",
|
|
17
|
+
"build": "node-gyp rebuild",
|
|
18
|
+
"build:debug": "node-gyp rebuild --debug",
|
|
19
|
+
"prebuild": "prebuildify --napi --strip",
|
|
20
|
+
"prebuild:all": "prebuildify-cross -i centos7-devtoolset7 -i alpine -i linux-armv7 -i linux-arm64",
|
|
21
|
+
"test": "node test/test.js",
|
|
22
|
+
"clean": "node-gyp clean",
|
|
23
|
+
"prepare": "npm run build"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"capstone",
|
|
27
|
+
"disassembler",
|
|
28
|
+
"disassembly",
|
|
29
|
+
"reverse-engineering",
|
|
30
|
+
"binary-analysis",
|
|
31
|
+
"x86",
|
|
32
|
+
"x64",
|
|
33
|
+
"arm",
|
|
34
|
+
"arm64",
|
|
35
|
+
"mips",
|
|
36
|
+
"ppc",
|
|
37
|
+
"sparc",
|
|
38
|
+
"m68k",
|
|
39
|
+
"riscv",
|
|
40
|
+
"native",
|
|
41
|
+
"napi",
|
|
42
|
+
"async"
|
|
43
|
+
],
|
|
44
|
+
"author": "HikariSystem <hikarisystem@example.com>",
|
|
45
|
+
"license": "MIT",
|
|
46
|
+
"repository": {
|
|
47
|
+
"type": "git",
|
|
48
|
+
"url": "https://github.com/hikarisystem/hexcore-capstone.git"
|
|
49
|
+
},
|
|
50
|
+
"bugs": {
|
|
51
|
+
"url": "https://github.com/hikarisystem/hexcore-capstone/issues"
|
|
52
|
+
},
|
|
53
|
+
"homepage": "https://github.com/hikarisystem/hexcore-capstone#readme",
|
|
54
|
+
"engines": {
|
|
55
|
+
"node": ">=18.0.0"
|
|
56
|
+
},
|
|
57
|
+
"dependencies": {
|
|
58
|
+
"node-addon-api": "^7.0.0",
|
|
59
|
+
"prebuild-install": "^7.1.1"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"node-gyp": "^10.0.0",
|
|
63
|
+
"prebuildify": "^6.0.0"
|
|
64
|
+
},
|
|
65
|
+
"files": [
|
|
66
|
+
"src/",
|
|
67
|
+
"deps/capstone/*.c",
|
|
68
|
+
"deps/capstone/*.h",
|
|
69
|
+
"deps/capstone/include/",
|
|
70
|
+
"deps/capstone/arch/",
|
|
71
|
+
"prebuilds/",
|
|
72
|
+
"binding.gyp",
|
|
73
|
+
"index.js",
|
|
74
|
+
"index.mjs",
|
|
75
|
+
"index.d.ts"
|
|
76
|
+
],
|
|
77
|
+
"binary": {
|
|
78
|
+
"napi_versions": [
|
|
79
|
+
8
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
}
|
|
Binary file
|