Skip to content

fateyan/pkg-unpacker-eol

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pkg unpacker

Unpack any pkg application.

Keep in mind that this doesn't give you the full source code if the application was compiled into V8 bytecode. See How it works.

This should work with any pkg application, but errors may occur.

This app may broke at any pkg major update.

Installation

  • Install NodeJS.
  • Download or clone the project.
  • Go to the pkg-unpacker folder and run npm install.

Usage

node unpack.js [options]

  Options:

    -i        input file name / path to the input file
    -o        output file name / path to the output file
    --run     try to run the entrypoint of the app

  Examples:

  – Unpack an UNIX app
    $ node unpack.js -i ./pkg_app -o ./unpacked
  – Unpack a Windows app
    $ node unpack.js -i ./pkg_app.exe -o ./unpacked
  – Unpack an UNIX app and run it
    $ node unpack.js -i ./pkg_app -o ./unpacked --run

Features

  • Compression detection (Gzip, Brotli)
  • Code evaluation
  • Symlink handling
  • Unpack binaries of all operating systems

How it works

This application DOES NOT decompile any code. By default pkg compiles code to V8 bytecode. Extracted files will remain in this format except for assets.

Code evaluation works best with small applications. Requirements can be broken.

pkg writes the file name, path, offset, length and compression at the bottom of each binary. This application analyzes these fields, then extracts and decompresses (if compressed) all the files of the binary.

Examples:

//UNIX app

{"/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
,
"/snapshot/pkg/index.js" //entrypoint
,
{} //symlinks
,
{} //files dictionnary
,
0 //0: no compression, 1: Gzip, 2: Brotli
//Windows app

{"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
,
"C:\\snapshot\\pkg\\index.js" //entrypoint
,
{} //symlinks
,
{} //files dictionnary
,
0 //0: no compression, 1: Gzip, 2: Brotli

Credits

pkg

Copyright

See the license.

About

Unpack any pkg application

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%