{"id":39597664,"url":"https://github.com/zboralski/spidermonkey-dumper","last_synced_at":"2026-01-18T07:50:01.259Z","repository":{"id":310416539,"uuid":"1039755277","full_name":"zboralski/spidermonkey-dumper","owner":"zboralski","description":"SpiderMonkey bytecode disassembler for cleartext Cocos .jsc files. Extracts and disassembles JavaScript bytecode with optional LLM decompilation using local models.","archived":false,"fork":false,"pushed_at":"2025-12-11T15:37:25.000Z","size":106,"stargazers_count":16,"open_issues_count":3,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-12T19:49:04.534Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zboralski.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}},"created_at":"2025-08-17T23:12:24.000Z","updated_at":"2025-12-11T15:37:30.000Z","dependencies_parsed_at":"2025-08-21T16:04:19.549Z","dependency_job_id":null,"html_url":"https://github.com/zboralski/spidermonkey-dumper","commit_stats":null,"previous_names":["zboralski/spidermonkey-dumper"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zboralski/spidermonkey-dumper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zboralski%2Fspidermonkey-dumper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zboralski%2Fspidermonkey-dumper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zboralski%2Fspidermonkey-dumper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zboralski%2Fspidermonkey-dumper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zboralski","download_url":"https://codeload.github.com/zboralski/spidermonkey-dumper/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zboralski%2Fspidermonkey-dumper/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28533180,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T00:39:45.795Z","status":"online","status_checked_at":"2026-01-18T02:00:07.578Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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-01-18T07:50:00.687Z","updated_at":"2026-01-18T07:50:01.250Z","avatar_url":"https://github.com/zboralski.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SpiderMonkey Dumper\n\nA reverse engineering tool for analyzing JavaScript bytecode files (.jsc) compiled with SpiderMonkey engine. Provides clean disassembly output with optional LLM-powered decompilation.\n\nThis tool is most useful for working with unencrypted .jsc files. Ironically, these are often harder to reverse than the encrypted ones, because until now there has been no proper SpiderMonkey bytecode disassembler. Encrypted .jsc files in Cocos2d-x are usually more straightforward to deal with: the decryption key is embedded in the compiled Cocos2d-x library, and once decrypted the .jsc yields the original JavaScript source code directly.\n\n## Features\n\n- Bytecode disassembly for SpiderMonkey JSC files\n- Automatic lambda/property mapping\n- Optional JavaScript reconstruction via Ollama\n\n## Examples\n\n- **[constants.jsc](samples/testdata/constants.jsc)** - Basic conditional logic and object initialization ([disassembled](samples/testdata/constants.dis), [decompiled](samples/testdata/constants.js))\n- **[simple.jsc](samples/testdata/simple.jsc)** - Game scene management and asset loading ([disassembled](samples/testdata/simple.dis), [decompiled](samples/testdata/simple.js))\n- **[minimal.jsc](samples/testdata/minimal.jsc)** - Cocos Creator UI framework integration ([disassembled](samples/testdata/minimal.dis), [decompiled](samples/testdata/minimal.js))\n- **[nested.jsc](samples/testdata/nested.jsc)** - Class inheritance with event handling ([disassembled](samples/testdata/nested.dis), [decompiled](samples/testdata/nested.js))\n- **[functions.jsc](samples/testdata/functions.jsc)** - Function definitions and closures ([disassembled](samples/testdata/functions.dis), [decompiled](samples/testdata/functions.js))\n\n## Quick Start\n\n### 1. Install Dependencies\n\n```bash\n./install-deps.sh\n```\n\nThis installs:\n- `autoconf213` - For SpiderMonkey build\n- `mercurial` - Required for SpiderMonkey source checkout\n- `nspr` - Netscape Portable Runtime (required by SpiderMonkey)  \n- `curl` - HTTP client for LLM integration\n- `nlohmann-json` - JSON library for C++\n\n### 2. Build SpiderMonkey (First Time Only)\n\n```bash\n./buildSpiderMonkey.sh\n```\n\n### 3. Build the Dumper\n\n```bash\nmake\n```\n\n### 4. Analyze JSC Files\n\n```bash\n# Fast disassembly (default)\n./dumper file.jsc\n\n# With LLM decompilation (requires Ollama)\n./dumper --decompile file.jsc\n```\n\n## LLM Decompilation Setup\n\nFor decompilation features, install Ollama:\n\n```bash\nbrew install ollama\nollama pull gpt-oss:20b\n```\n\n\n## Usage Examples\n\n### Basic Analysis\n```bash\n./dumper samples/script.jsc\n```\nOutput:\n- Clean bytecode disassembly to console\n- `script.dis` file with plain disassembly\n\n### LLM Decompilation\n```bash\n./dumper --decompile samples/script.jsc\n```\nOutput:\n- `script.dis` - Clean disassembly\n- `script.js` - LLM-generated JavaScript code\n- Console output with both disassembly and decompilation\n\n### Advanced Options\n```bash\n# Debug mode with verbose output\n./dumper --debug --decompile script.jsc\n\n# Custom LLM model\n./dumper --decompile --ollama-model \"codellama\" script.jsc\n\n# Custom Ollama host\n./dumper --decompile --ollama-host \"http://localhost:11434\" script.jsc\n\n# Show line numbers and enable object analysis\n./dumper --lines --objects script.jsc\n```\n\n## Command Line Options\n\n| Flag | Description |\n|------|-------------|\n| `--decompile` | Enable LLM decompilation (requires Ollama) |\n| `--debug` | Enable verbose debug output |\n| `--inner` | Enable inner function detection |\n| `--resolve-inner` | Resolve inner function names to properties |\n| `--objects` | Show detailed object analysis |\n| `--lines` | Show JavaScript source line numbers |\n| `--color`/`--no-color` | Force enable/disable colored output |\n| `--ollama-host URL` | Custom Ollama server URL |\n| `--ollama-model NAME` | Custom LLM model (default: gpt-oss:20b) |\n\n## Output Files\n\nThe dumper generates multiple output files:\n\n- **`\u003cfilename\u003e.dis`** - Clean, plain-text disassembly suitable for further analysis\n- **`\u003cfilename\u003e.js`** - LLM-generated JavaScript code (when using `--decompile`)\n\n## Building from Source\n\n### Prerequisites\n- macOS with Xcode Command Line Tools\n- Homebrew package manager\n- Ollama (optional, for LLM features)\n\n### Build Process\n1. Install dependencies: `./install-deps.sh`\n2. Build SpiderMonkey: `./buildSpiderMonkeyArm64.sh`\n3. Build dumper: `make`\n\n### Troubleshooting\n\nIf the build fails to find libcurl:\n```bash\nCURL_PREFIX=\"$(brew --prefix curl)\"\nCXXFLAGS=\"-I$CURL_PREFIX/include\" LDFLAGS=\"-L$CURL_PREFIX/lib\" make\n```\n\nIf decompilation fails or hangs, check Ollama server logs:\n```bash\n# View recent Ollama server activity and errors\ncat ~/.ollama/logs/server.log | tail -50\n\n# Look for these common issues:\n# - \"truncating input prompt\" (disassembly too large)\n# - HTTP 500 errors (server overloaded)\n# - \"context canceled\" (client timeout working correctly)\n```\n\n## Roadmap \u0026 Version Support\n\nThe current release of **dumper** targets **SpiderMonkey 33.1.1** as used in\n**Cocos2d-JS / Cocos2d-x v3.17**. This lets you reverse unencrypted `.jsc`\nfiles from that runtime.\n\nOur roadmap is to extend support to additional SpiderMonkey builds used in\nother Cocos2d-x releases as we go.\n\n➡️ If you need a specific Cocos2d-x or SpiderMonkey version supported, please\nopen an **issue** in this repository with the version number and context. This\nwill help us prioritize and test against real-world use cases.\n\n## License\n\nThis project uses code from Mozilla's SpiderMonkey engine and is licensed under the Mozilla Public License 2.0. See `LICENSE` for details.\n\n## Contributing\n\n1. Follow existing code style and patterns\n2. Test with sample JSC files before submitting\n3. Update documentation for new features\n4. Ensure compatibility with SpiderMonkey 33.1.1","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzboralski%2Fspidermonkey-dumper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzboralski%2Fspidermonkey-dumper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzboralski%2Fspidermonkey-dumper/lists"}