{"_id":"@alexaltea/unicorn-js","_rev":"2-bdf417734846b082c7a385f653e9e829","name":"@alexaltea/unicorn-js","dist-tags":{"latest":"2.1.4"},"versions":{"1.0.3":{"name":"@alexaltea/unicorn-js","version":"1.0.3","keywords":["unicorn","emulator","emulation","cpu","wasm","webassembly","reverse-engineering"],"author":{"name":"Alexandro Sanchez Bach","email":"alexaltea123@gmail.com"},"license":"GPL-2.0","_id":"@alexaltea/unicorn-js@1.0.3","maintainers":[{"name":"alexaltea","email":"alexandro@phi.nz"}],"homepage":"https://alexaltea.github.io/unicorn.js/","bugs":{"url":"https://github.com/AlexAltea/unicorn.js/issues"},"dist":{"shasum":"7f26c85d8c2d6bff17fc0ff5517c4d0e5a8cca02","tarball":"https://registry.npmjs.org/@alexaltea/unicorn-js/-/unicorn-js-1.0.3.tgz","fileCount":5,"integrity":"sha512-TOA0bqHe+4hxa9owbG0pt1BeUM2dFbQeJPQNKhAzQqM6S/oW67fpfRJRnQOEv3vM8pAUZT51OuxuGOxjz7braw==","signatures":[{"sig":"MEYCIQC/7kiSN3UGPJl97NOjGNaDFzJoCmqn8aPjmwgT0g2irwIhAN/ChPET73h/AZwwN4CRQoJHFZf1iU0ff7CpTBc4J0Xb","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":9260078},"main":"./dist/unicorn.js","gitHead":"3a2eb47a0238c0149c5c3e067774c9350b75e5bf","scripts":{"test":"node tests/main.js","build":"python3 build.py","serve":"python3 -m http.server"},"_npmUser":{"name":"alexaltea","email":"alexandro@phi.nz"},"repository":{"url":"git+https://github.com/AlexAltea/unicorn.js.git","type":"git"},"_npmVersion":"10.3.0","description":"Unicorn CPU emulator framework port for JavaScript","directories":{},"_nodeVersion":"20.5.1","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/unicorn-js_1.0.3_1781700841027_0.0759856348886856","host":"s3://npm-registry-packages-npm-production"}},"2.1.4":{"name":"@alexaltea/unicorn-js","version":"2.1.4","description":"Unicorn CPU emulator framework port for JavaScript","author":{"name":"Alexandro Sanchez Bach","email":"alexaltea123@gmail.com"},"license":"GPL-2.0","homepage":"https://alexaltea.github.io/unicorn.js/","keywords":["unicorn","emulator","emulation","cpu","wasm","webassembly","reverse-engineering"],"repository":{"type":"git","url":"git+https://github.com/AlexAltea/unicorn.js.git"},"main":"./dist/unicorn.js","exports":{".":"./dist/unicorn.js","./arm":"./dist/unicorn_arm.js","./aarch64":"./dist/unicorn_aarch64.js","./arm64":"./dist/unicorn_aarch64.js","./m68k":"./dist/unicorn_m68k.js","./mips":"./dist/unicorn_mips.js","./ppc":"./dist/unicorn_ppc.js","./riscv":"./dist/unicorn_riscv.js","./s390x":"./dist/unicorn_s390x.js","./sparc":"./dist/unicorn_sparc.js","./tricore":"./dist/unicorn_tricore.js","./x86":"./dist/unicorn_x86.js","./package.json":"./package.json"},"scripts":{"build":"python3 build.py","build:release":"python3 build.py --release","prepack":"npm run build:release","serve":"python3 -m http.server","test":"node tests/main.js"},"bugs":{"url":"https://github.com/AlexAltea/unicorn.js/issues"},"_id":"@alexaltea/unicorn-js@2.1.4","gitHead":"560284c59c11c8d6c94d537f4354339f069ddcdf","_nodeVersion":"20.5.1","_npmVersion":"10.3.0","dist":{"integrity":"sha512-UAml23tgHyXEuP2A7Y50qDCNYMIRHJobsjlhetPRrtH+PXg0+BNAyvPQEKoCd+VHAF1nDfPHE4yJCqSLVtOrXA==","shasum":"2c7e486443acfc9ecd286d5d30d01197b1609fa9","tarball":"https://registry.npmjs.org/@alexaltea/unicorn-js/-/unicorn-js-2.1.4.tgz","fileCount":14,"unpackedSize":20161150,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQD4NkwM+7rKiwTj5U0SyvtFkgmmlSEsceVl2hY7jQVC1gIhAJD1B39VjUbVrFhzZyjyWnwpCKvXXiCJIyl3w0uNfUgs"}]},"_npmUser":{"name":"alexaltea","email":"alexandro@phi.nz"},"directories":{},"maintainers":[{"name":"alexaltea","email":"alexandro@phi.nz"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/unicorn-js_2.1.4_1781864118015_0.5046768472683605"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-17T12:54:00.888Z","modified":"2026-06-19T10:15:18.386Z","1.0.3":"2026-06-17T12:54:01.208Z","2.1.4":"2026-06-19T10:15:18.271Z"},"bugs":{"url":"https://github.com/AlexAltea/unicorn.js/issues"},"author":{"name":"Alexandro Sanchez Bach","email":"alexaltea123@gmail.com"},"license":"GPL-2.0","homepage":"https://alexaltea.github.io/unicorn.js/","keywords":["unicorn","emulator","emulation","cpu","wasm","webassembly","reverse-engineering"],"repository":{"type":"git","url":"git+https://github.com/AlexAltea/unicorn.js.git"},"description":"Unicorn CPU emulator framework port for JavaScript","maintainers":[{"name":"alexaltea","email":"alexandro@phi.nz"}],"readme":"Unicorn.js\n==========\n\nPort of the [Unicorn](https://github.com/unicorn-engine/unicorn) CPU emulator framework for JavaScript/WASM. Powered by [Emscripten](https://github.com/emscripten-core/emscripten).\n\n**Requirements:** JavaScript environment with [WebAssembly](https://developer.mozilla.org/en-US/docs/WebAssembly) and [BigInt](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) support.\n\n**Notes:** _Unicorn_ is a lightweight multi-architecture CPU emulator framework originally developed by Nguyen Anh Quynh, Dang Hoang Vu et al. and released under GPLv2 license. More information about contributors and license terms can be found in the files `AUTHORS.TXT`, `CREDITS.TXT` and `COPYING` inside the *unicorn* submodule of this repository.\n\n## Installation\n\nTo use Unicorn.js in your web application, download and include it with:\n\n```html\n<script src=\"unicorn.js\"></script>\n```\n\nor install it with the NPM command:\n\n```bash\nnpm install @alexaltea/unicorn-js\n```\n\n### Lightweight single-architecture variants\n\nThe default build supports all architectures. If you only need one, smaller per-architecture variants are published alongside it and can be selected via the `require` or `import` subpath:\n\n```javascript\nconst MUnicorn = require('@alexaltea/unicorn-js');       // all architectures\nconst MUnicorn = require('@alexaltea/unicorn-js/x86');   // x86 only\n```\n\nAvailable variants: `arm`, `aarch64` (`arm64`), `m68k`, `mips`, `ppc`, `riscv`, `s390x`, `sparc`, `tricore`, `x86`.\n\nEach exposes the same _MUnicorn_ factory and API. Bundlers resolve the subpath to a single file, so only the variant you select is bundled; over a CDN, reference the file directly, e.g. `https://cdn.jsdelivr.net/npm/@alexaltea/unicorn-js/dist/unicorn_arm.js`.\n\n## Usage\n\n```javascript\nvar addr = 0x10000;\nvar code = [\n  0x37, 0x00, 0xA0, 0xE3,  // mov r0, #0x37\n  0x03, 0x10, 0x42, 0xE0,  // sub r1, r2, r3\n];\n\nMUnicorn().then((uc) => {\n    // Initialize engine\n    var e = new uc.Unicorn(uc.ARCH_ARM, uc.MODE_ARM);\n\n    // Write registers and memory\n    e.reg_write_i32(uc.ARM_REG_R2, 0x456);\n    e.reg_write_i32(uc.ARM_REG_R3, 0x123);\n    e.mem_map(addr, 4*1024, uc.PROT_ALL);\n    e.mem_write(addr, code);\n\n    // Start emulator\n    var begin = addr;\n    var until = addr + code.length;\n    e.emu_start(begin, until, 0, 0);\n\n    // Read registers\n    var r0 = e.reg_read_i32(uc.ARM_REG_R0);  // 0x37\n    var r1 = e.reg_read_i32(uc.ARM_REG_R1);  // 0x333\n\n    e.close();\n});\n```\n\n## Building\n\nTo build the Unicorn.js library:\n\n1. Clone this repository including its submodules:\n    ```bash\n    git clone --recursive https://github.com/AlexAltea/unicorn.js\n    ```\n\n2. Install the latest [Python 3.x](https://www.python.org/downloads/), [CMake](http://www.cmake.org/download/) and the [Emscripten SDK](https://emscripten.org/docs/getting_started/downloads.html). Follow the corresponding instructions and make sure all environment variables are configured correctly.\n\n3. Run the build script:\n    ```bash\n    python3 build.py\n    ```\n\nBuild artifacts will be saved to [`dist`](./dist/).\n\n> [!TIP]\n> Pass architecture names to produce a smaller, single-architecture bundle (e.g. `python3 build.py x86`), or `python3 build.py --release` to build every variant.\n","readmeFilename":"README.md"}