Powered by webcrack
- Get the repository & dependencies
git clone https://github.com/e9x/krunker-decompiler.git
cd krunker-decompiler
npm install
- Build the decompiler
npm run build
-
Get the game source
[user@linux krunker-decompiler]$ cat ../krunker.05.12.23.js (function(iÌïiîií,iÏïïîiî){var iIiííìi=a3iíiíîiî,iÎìîìíì=iÌïiîií();while(!![]){try{var iIiiîîí=-parseInt(iIiííìi(0xc99))/0x1*(-parseInt(iIiííìi(0x172c))/0x2)+parseInt(iIiííìi(0xc3e))/0x3*(parseInt(iIiííìi(0x1623))/0x4)+-parseInt(iIiííìi(0x40a))/0x5+parseInt(iIiííìi(0x19b1))/0x6+-parseInt(iIiííìi(0x4888))/0x7+-parseInt(iIiííìi(0x45f8))/0x8*(-parseInt(iIiííìi(0xc7d))/0x9)+-parseInt(iIiííìi(0x2d1a))/0xa*(parseInt(iIiííìi(0x2699))/0xb);if(iIiiîîí===iÏïïîiî)break;else iÎìîìíì['push'](iÎìîìíì['shift']());}catch(iÏiîiií){iÎìîìíì['push'](iÎìîìíì['shift']());}}}(a3iìiìïìi,0x7bbf4),function(iïíîïii){var iiïîììí=(function(){var iiíiìií=!![];return function(iîìiíiì,iîiìiìî){var iiïîiìí=iiíiìií?function(){if(iîiìiìî){var iíïîïïí=
Make sure your source:
- Is not wrapped in an anonymous function You can modify the source to remove the wrapper.
(function anonymous(b475796ed633d5fd0485 ) { (/* source goes here */) })
- Starts with a newline This is to match the real bundle. The bundle itself starts with a newline. However, this is optional.
-
Deobfuscate the source
This will deobfuscate the soruce and split each module into an individual file.
npm run deobfuscate ../krunker.js
-
Process the modules
This will undo all minifications to the source and rename the variables.
npm run process
You can find the result in the processed
directory.
- Go to Krunker
- Open devtools
- Refresh the tab
- Click on "Network"
- Find "seek-game?hostname=krunker.io..."
- Click on "Initiator"
- Click on the link to "VM XXX:X" A VM is a JavaScript virtual machine. It's assigned a number for debugging.
- Wait for the VM's source to load. This may take up to 5 minutes depending on your machine.
- Right click the tab in the source viewer. It should be named "VM XXX"
- Select "Save as..."
- Enter a name that ends with .js, like
krunker.js
- Close Devtools and Krunker
Because the source is wrapped in a way that the decompiler doesn't understand, you'll have to modify it.
-
Open the source in an editor capable of handling an 8 MB file Like VS Code.
-
Remove the first 2 lines:
(function anonymous(b475796ed633d5fd0485 ) {
-
Remove the last line:
})
-
Save
Entry point is named index.js
in the processed folder.
This tool can be used against other scripts that aren't bundled with Webpack. For example, you might want to use this to rename variables or deobfuscate code in a script.
-
Build the program (if you haven't already)
npm install npm run build
-
Run the processCode script
npm run processCode "function _0x1e3586(x,y){return x+y}exports.test = _0x1e3586;"
Ideally, the output should go to a file.
npm run processCode "..." output.js
See output.js in the folder.
For additional usage, run npm run processCode
without any parameters.