Skip to content

Instantly share code, notes, and snippets.

@frolleks
Last active April 20, 2024 03:22
Show Gist options
  • Star 23 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save frolleks/01b9555b678c7f5a6c31aba33c632606 to your computer and use it in GitHub Desktop.
Save frolleks/01b9555b678c7f5a6c31aba33c632606 to your computer and use it in GitHub Desktop.
How to decompile an Electron app

Let me tell you how easy it is to decompile an Electron app (that's closed source).

Prerequisites

Decompilation

First of all, you find the install path of your Electron app. If you found it, find the resources folder. If you found it, you'll have to install asar globally, by running:

npm install -g @electron/asar

Then, you can decompile the app by running:

asar extract app.asar app

It is recommended to copy the app.asar file to your user/home directory to not get tired of it having to ask you for permissions. (if it's stored in the root directory, this is for Linux users only.)

cd into the app source:

cd app

Electron isn't installed by default. You can install it by running:

npm install --save-dev electron

You may run the app in development mode by running:

npx electron .

Or, you may add a start script in the package.json file:

{
...
  "devDependencies": {
    "electron": "^22.0.0"
  },
  "scripts": {
    "start": "electron ."
  }
...
}

and run npm run start to run the app.

If you'd want to compile, you can install electron-builder:

npm install --save-dev electron-builder

Then, you can run:

npx electron-builder

This will compile for the current OS you're running. You can also specify the OS and architecture:

npx electron-builder --platform=darwin --arch=x64

like that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment