{"id":21612083,"url":"https://github.com/lockblock-dev/pkg-unpacker","last_synced_at":"2025-04-07T15:06:30.784Z","repository":{"id":53206357,"uuid":"521312070","full_name":"LockBlock-dev/pkg-unpacker","owner":"LockBlock-dev","description":"Unpack any pkg application","archived":false,"fork":false,"pushed_at":"2025-03-08T21:26:36.000Z","size":33,"stargazers_count":78,"open_issues_count":0,"forks_count":21,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-31T14:11:17.731Z","etag":null,"topics":["bytecode","decompiler","javascript-app","pkg","reverse-engineering","unpacker"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LockBlock-dev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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},"funding":{"ko_fi":"lockblock"}},"created_at":"2022-08-04T15:07:02.000Z","updated_at":"2025-03-27T03:02:36.000Z","dependencies_parsed_at":"2025-03-31T14:11:18.977Z","dependency_job_id":"23ce5104-f260-44b5-86a1-b7ec75246dc2","html_url":"https://github.com/LockBlock-dev/pkg-unpacker","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LockBlock-dev%2Fpkg-unpacker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LockBlock-dev%2Fpkg-unpacker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LockBlock-dev%2Fpkg-unpacker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LockBlock-dev%2Fpkg-unpacker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LockBlock-dev","download_url":"https://codeload.github.com/LockBlock-dev/pkg-unpacker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247675597,"owners_count":20977376,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["bytecode","decompiler","javascript-app","pkg","reverse-engineering","unpacker"],"created_at":"2024-11-24T21:16:36.312Z","updated_at":"2025-04-07T15:06:30.767Z","avatar_url":"https://github.com/LockBlock-dev.png","language":"TypeScript","readme":"# pkg unpacker\n\nUnpack any **pkg** application.\n\nKeep in mind that **this tool doesn't give you the full source code if the application was compiled into V8 bytecode**. See [How it works](#how-it-works).\n\n## Table of Contents\n\n-   [Support](#support)\n-   [Installation](#installation)\n-   [Usage](#usage)\n    -   [As a command line interface](#as-a-command-line-interface)\n    -   [As a library](#as-a-library)\n-   [Features](#features)\n-   [How it works](#how-it-works)\n-   [Credits](#credits)\n-   [Copyright](#copyright)\n\n## Support\n\nAs of this writing, **pkg-unpacker** supports the following tools:\n\n| Tool                                            | Supported | Versions      | Comment                                                                                                            |\n| ----------------------------------------------- | --------- | ------------- | ------------------------------------------------------------------------------------------------------------------ |\n| [vercel/pkg](https://github.com/vercel/pkg)     | ✅        | 5.0.0 - 5.8.1 | N/A                                                                                                                |\n| [yao-pkg/pkg](https://github.com/yao-pkg/pkg)   | ✅        | 5.0.0 - 6.3.2 | Does not include experimental support for [Node SEA](https://nodejs.org/api/single-executable-applications.html) . |\n| [AngaBlue/exe](https://github.com/AngaBlue/exe) | ❌        | -             | N/A                                                                                                                |\n\n## Installation\n\n1. Install [Node.js](https://nodejs.org/).\n2. Download or clone the project.\n3. Navigate to the project directory.\n4. Install the dependencies:\n    ```sh\n    npm install\n    ```\n5. Build the project:\n    ```sh\n    npm run build\n    ```\n\n## Usage\n\n### As a command line interface\n\nTo start the application, run:\n\n```sh\nnpm start\n```\n\nHere’s an overview of the `help` command output:\n\n```console\nUsage: pkg-unpacker [options]\n\nOptions:\n  -i, --input \u003cfile\u003e     Specify the input binary file path\n  -o, --output \u003cfolder\u003e  Specify the output folder path (default: \".\")\n  --run                  Run the unpacked binary (default: false)\n  -h, --help             display help for command\n```\n\n#### Examples:\n\n-   Unpack a UNIX application:\n\n```console\n$ npm start -i ./pkg_app -o ./unpacked\n```\n\n-   Unpack a Windows application:\n\n```console\n$ npm start -i ./pkg_app.exe -o ./unpacked\n```\n\n-   Unpack a UNIX application and run it:\n\n```console\n$ npm start -i ./pkg_app -o ./unpacked --run\n```\n\n### As a library\n\nThe main logic of **pkg unpacker** lies in the [`Unpacker`](./src/unpacker.ts) class.\n\n#### Examples:\n\n-   Unpack a UNIX application:\n\n```ts\nimport Unpacker from \"./src/unpacker.ts\";\n\nconst main = async () =\u003e {\n    const unpacker = await Unpacker.create(\"./pkg_app\");\n    await unpacker.unpack(\"./unpacked\");\n};\n\nmain();\n```\n\n-   Unpack a Windows application and run it:\n\n```ts\nimport Unpacker from \"./src/unpacker.ts\";\n\nconst main = async () =\u003e {\n    const unpacker = await Unpacker.create(\"./pkg_app.exe\");\n    await unpacker.unpack(\"./unpacked\", true);\n};\n\nmain();\n```\n\n## Features\n\n-   Detects compression formats (Gzip, Brotli)\n-   Supports code evaluation\n-   Handles symlinks\n-   Extracts binaries from all operating systems\n\n## How it works\n\nThis application does not decompile code. By default, [pkg](https://github.com/vercel/pkg) compiles JavaScript into V8 bytecode. Extracted files will remain in this format, except for assets.\n\nCode evaluation works best with small applications as dependencies might be broken.\n\n[pkg](https://github.com/vercel/pkg) stores metadata about file names, paths, offsets, lengths, and compression at the end of each binary. This application analyzes those fields to extract and decompress (if necessary) all embedded files.\n\nExamples:\n\n```js\n// UNIX app\n\n{\"/snapshot/pkg/index.js\":{\"0\":[0,568],\"3\":[568,118]},\"/snapshot/pkg\":{\"2\":[686,12],\"3\":[698,117]},\"/snapshot\":{\"2\":[815,7],\"3\":[822,117]}} // virtual file system\n,\n\"/snapshot/pkg/index.js\" // entrypoint\n,\n{} // symlinks\n,\n{} // files dictionnary\n,\n0 // 0: no compression, 1: Gzip, 2: Brotli\n```\n\n```js\n// Windows app\n\n{\"C:\\\\snapshot\\\\pkg\\\\index.js\":{\"0\":[0,568],\"3\":[568,118]},\"C:\\\\snapshot\\\\pkg\":{\"2\":[686,12],\"3\":[698,117]},\"C:\\\\snapshot\":{\"2\":[815,7],\"3\":[822,117]}} // virtual file system\n,\n\"C:\\\\snapshot\\\\pkg\\\\index.js\" // entrypoint\n,\n{} // symlinks\n,\n{} // files dictionnary\n,\n0 // 0: no compression, 1: Gzip, 2: Brotli\n```\n\n## Credits\n\n[pkg](https://github.com/vercel/pkg)\n\n## Copyright\n\nSee the [license](/LICENSE).\n","funding_links":["https://ko-fi.com/lockblock"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flockblock-dev%2Fpkg-unpacker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flockblock-dev%2Fpkg-unpacker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flockblock-dev%2Fpkg-unpacker/lists"}