A powerful tool for protecting JavaScript code in ASAR archives through advanced code obfuscation.
ASAR Package Obfuscator automatically extracts JavaScript files from ASAR archives, obfuscates them using JavaScript Obfuscator, and repackages them into a new, protected archive. Ideal for Electron applications where source code needs protection against reverse engineering.
- Node.js (version 12 or higher recommended)
- NPM Modules:
fs(built-in)path(built-in)recursive-readdirrimrafasarjavascript-obfuscatorolologyargs
git clone https://github.com/nils-kt/asar-package-obfuscator.git
cd asar-package-obfuscator
npm installnode index.js <input-asar-file> [output-asar-file]input-asar-file(required): Path to the ASAR file to be protectedoutput-asar-file(optional): Name of the protected output file- Default:
[originalname].new.asar
- Default:
# Simple usage with automatic output name
node index.js app.asar
# With custom output name
node index.js app.asar app-protected.asar- Extraction: The ASAR archive is unpacked into a temporary directory
- Obfuscation: All JavaScript files are protected using JavaScript Obfuscator
- Repackaging: The obfuscated files are packed into a new ASAR archive
- Cleanup: Temporary files are automatically deleted
- ✅ Automatic detection of all JavaScript files in the archive
- ✅ Recursive processing of subdirectories
- ✅ Output in the same directory as the input file
- ✅ Automatic cleanup of temporary files
- ✅ Detailed error output for troubleshooting
- ✅ Command-line interface with argument parsing
- Development Tool: This script is designed as a development tool
- Backup: Always create a backup of the original ASAR file
- Performance: Obfuscation can take some time for large projects
- Testing: Thoroughly test the protected application, as obfuscation can rarely lead to issues
All error messages are displayed in the console. Common issues:
- File not found: Check the path to the ASAR file
- Permission errors: Ensure the script has read and write permissions
- Missing modules: Run
npm installagain
Contributions are welcome! Please feel free to submit a Pull Request.
Nils Kleinert
This tool is intended for legitimate protection of your own applications. Always respect software licenses and intellectual property rights.