{"id":43736283,"url":"https://github.com/lxrdknowkill/hexcore-capstone","last_synced_at":"2026-02-05T11:01:23.728Z","repository":{"id":335543258,"uuid":"1145650974","full_name":"LXrdKnowkill/hexcore-capstone","owner":"LXrdKnowkill","description":null,"archived":false,"fork":false,"pushed_at":"2026-01-30T23:08:43.000Z","size":3077,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-31T12:06:06.332Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LXrdKnowkill.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-30T03:35:07.000Z","updated_at":"2026-01-30T23:08:46.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/LXrdKnowkill/hexcore-capstone","commit_stats":null,"previous_names":["lxrdknowkill/hexcore-capstone"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/LXrdKnowkill/hexcore-capstone","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LXrdKnowkill%2Fhexcore-capstone","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LXrdKnowkill%2Fhexcore-capstone/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LXrdKnowkill%2Fhexcore-capstone/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LXrdKnowkill%2Fhexcore-capstone/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LXrdKnowkill","download_url":"https://codeload.github.com/LXrdKnowkill/hexcore-capstone/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LXrdKnowkill%2Fhexcore-capstone/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29120481,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-05T10:47:47.471Z","status":"ssl_error","status_checked_at":"2026-02-05T10:45:08.119Z","response_time":65,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-02-05T11:01:03.413Z","updated_at":"2026-02-05T11:01:23.626Z","avatar_url":"https://github.com/LXrdKnowkill.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HexCore Capstone\n\nModern Node.js bindings for [Capstone](https://capstone-engine.org) disassembler engine using N-API.\n\n[![npm version](https://badge.fury.io/js/hexcore-capstone.svg)](https://www.npmjs.com/package/hexcore-capstone)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n## Features\n\n-  **Async API**: Non-blocking `disasmAsync()` for large binaries\n-  **Modern N-API**: Binary compatible across Node.js 18+\n-  **Zero Dependencies**: Capstone is bundled - just `npm install`\n-  **Full TypeScript**: Complete type definitions with JSDoc\n-  **Multi-Architecture**: x86, ARM, ARM64, MIPS, PPC, SPARC, M68K, and more\n-  **Detail Mode**: Access operands, registers, groups, and flags\n-  **ESM + CommonJS**: Works with `import` and `require`\n\n## Installation\n\n```bash\nnpm install hexcore-capstone\n```\n\nNo system dependencies required! Capstone is compiled from source automatically.\n\n## Quick Start\n\n### Basic Example\n\n```javascript\nconst { Capstone, ARCH, MODE } = require('hexcore-capstone');\n\n// Create a disassembler for x86-64\nconst cs = new Capstone(ARCH.X86, MODE.MODE_64);\n\n// Machine code to disassemble\nconst code = Buffer.from([\n    0x55,                         // push rbp\n    0x48, 0x89, 0xe5,             // mov rbp, rsp\n    0x48, 0x83, 0xec, 0x20,       // sub rsp, 0x20\n    0xc3                          // ret\n]);\n\n// Disassemble\nconst instructions = cs.disasm(code, 0x401000);\n\nfor (const insn of instructions) {\n    console.log(`0x${insn.address.toString(16)}: ${insn.mnemonic} ${insn.opStr}`);\n}\n\n// Output:\n// 0x401000: push rbp\n// 0x401001: mov rbp, rsp\n// 0x401004: sub rsp, 0x20\n// 0x401008: ret\n\ncs.close();\n```\n\n### Async Disassembly (Recommended for large files)\n\n```javascript\nconst { Capstone, ARCH, MODE } = require('hexcore-capstone');\nconst fs = require('fs');\n\nconst cs = new Capstone(ARCH.X86, MODE.MODE_64);\n\n// Load a large binary\nconst largeCode = fs.readFileSync('large_binary.bin');\n\n// Disassemble without blocking the event loop\nconst instructions = await cs.disasmAsync(largeCode, 0x401000);\n\nconsole.log(`Disassembled ${instructions.length} instructions`);\n\ncs.close();\n```\n\n### ESM Import\n\n```javascript\nimport { Capstone, ARCH, MODE, OPT, OPT_VALUE } from 'hexcore-capstone';\n\nconst cs = new Capstone(ARCH.ARM64, MODE.ARM);\n// ...\n```\n\n### Detail Mode\n\n```javascript\nconst { Capstone, ARCH, MODE, OPT, OPT_VALUE } = require('hexcore-capstone');\n\nconst cs = new Capstone(ARCH.X86, MODE.MODE_64);\n\n// Enable detail mode for operand info\ncs.setOption(OPT.DETAIL, OPT_VALUE.ON);\n\nconst code = Buffer.from([0x48, 0x89, 0xc3]); // mov rbx, rax\nconst insns = cs.disasm(code, 0x1000);\n\nfor (const insn of insns) {\n    console.log(`${insn.mnemonic} ${insn.opStr}`);\n\n    if (insn.detail) {\n        console.log('  Registers read:', insn.detail.regsRead.map(r =\u003e cs.regName(r)));\n        console.log('  Registers written:', insn.detail.regsWrite.map(r =\u003e cs.regName(r)));\n        console.log('  Groups:', insn.detail.groups.map(g =\u003e cs.groupName(g)));\n    }\n}\n\ncs.close();\n```\n\n## Supported Architectures\n\n| Architecture | Constant | Detail Mode |\n|--------------|----------|-------------|\n| x86/x64 | `ARCH.X86` | ✅ Full |\n| ARM | `ARCH.ARM` | ✅ Full |\n| ARM64 | `ARCH.ARM64` | ✅ Full |\n| MIPS | `ARCH.MIPS` | ✅ Full |\n| PowerPC | `ARCH.PPC` | ✅ Full |\n| SPARC | `ARCH.SPARC` | ✅ Full |\n| SystemZ | `ARCH.SYSZ` | ✅ Full |\n| XCore | `ARCH.XCORE` | ✅ Full |\n| M68K | `ARCH.M68K` | ✅ Full |\n\n## API Reference\n\n### Class: Capstone\n\n#### `new Capstone(arch, mode)`\nCreate a new disassembler instance.\n\n#### `cs.disasm(code, address, [count])`\nDisassemble code buffer synchronously. Returns `Instruction[]`.\n\n#### `cs.disasmAsync(code, address, [count])`\nDisassemble code buffer asynchronously. Returns `Promise\u003cInstruction[]\u003e`.\n\n\u003e ⚡ **Use `disasmAsync()` for buffers \u003e1MB** to avoid blocking the event loop.\n\n#### `cs.setOption(type, value)`\nSet a disassembler option (e.g., enable detail mode).\n\n#### `cs.close()`\nClose the handle and free resources.\n\n#### `cs.regName(regId)`, `cs.insnName(insnId)`, `cs.groupName(groupId)`\nGet human-readable names.\n\n### Helper Functions\n\n```javascript\nconst { version, support, ARCH } = require('hexcore-capstone');\n\nconsole.log(`Capstone version: ${version().string}`);  // \"5.0\"\nconsole.log(`ARM supported: ${support(ARCH.ARM)}`);    // true\n```\n\n## Building from Source\n\n```bash\ngit clone --recursive https://github.com/LXrdKnowkill/hexcore-capstone.git\ncd hexcore-capstone\nnpm install\nnpm run build\nnpm test\n```\n\n\u003e **Note:** Use `--recursive` to clone the vendored Capstone submodule.\n\n## Changelog\n\n### v1.1.0\n-  Add `disasmAsync()` for non-blocking disassembly\n-  Add ESM support via `index.mjs`\n-  Add detail mode for PPC, SPARC, SYSZ, XCORE, M68K\n-  Enhanced TypeScript definitions with JSDoc\n\n### v1.0.0\n-  Initial release with sync API\n\n## License\n\nMIT License - Copyright (c) HikariSystem\n\n## Acknowledgments\n\n- [Capstone Engine](https://capstone-engine.org) by Nguyen Anh Quynh\n- The Node.js N-API team\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flxrdknowkill%2Fhexcore-capstone","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flxrdknowkill%2Fhexcore-capstone","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flxrdknowkill%2Fhexcore-capstone/lists"}