{"id":18654886,"url":"https://github.com/jorianwoltjer/deobfuscate-preemptive","last_synced_at":"2025-07-11T08:05:41.274Z","repository":{"id":253223406,"uuid":"842683255","full_name":"JorianWoltjer/deobfuscate-preemptive","owner":"JorianWoltjer","description":"Automatically deobfuscate JavaScript code 'Protected' with PreEmptive's JSDefender Demo","archived":false,"fork":false,"pushed_at":"2025-01-01T09:52:06.000Z","size":67,"stargazers_count":5,"open_issues_count":4,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-12T13:15:09.097Z","etag":null,"topics":["deobfuscator","javascript"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JorianWoltjer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2024-08-14T21:12:13.000Z","updated_at":"2025-03-18T05:33:26.000Z","dependencies_parsed_at":"2025-05-12T13:15:11.176Z","dependency_job_id":"ebbda9d4-c4c6-4e50-874b-e47cead1da0f","html_url":"https://github.com/JorianWoltjer/deobfuscate-preemptive","commit_stats":null,"previous_names":["jorianwoltjer/deobfuscate-preemptive"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/JorianWoltjer/deobfuscate-preemptive","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JorianWoltjer%2Fdeobfuscate-preemptive","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JorianWoltjer%2Fdeobfuscate-preemptive/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JorianWoltjer%2Fdeobfuscate-preemptive/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JorianWoltjer%2Fdeobfuscate-preemptive/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JorianWoltjer","download_url":"https://codeload.github.com/JorianWoltjer/deobfuscate-preemptive/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JorianWoltjer%2Fdeobfuscate-preemptive/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264763133,"owners_count":23660303,"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":["deobfuscator","javascript"],"created_at":"2024-11-07T07:16:56.947Z","updated_at":"2025-07-11T08:05:41.242Z","avatar_url":"https://github.com/JorianWoltjer.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Deobfuscate PreEmptive's JSDefender Demo\n\nThis tool automatically deobfuscates JavaScript code 'Protected' with [PreEmptive's JSDefender Demo](https://www.preemptive.com/online-javascript-obfuscator/). Besides variable names and comments which are not recoverable, the resulting code should be a perfect replica of the original code. This makes it easy to analyze the code futher.\n\n\u003e [!WARNING]  \n\u003e Only deobfuscate scripts that you trust, as `eval()` is used in many places! Consider using the docker container to sandbox it.\n\nThis script heavily uses [`shift-refactor`](https://github.com/jsoverson/shift-refactor) to parse and rewrite the JavaScript code into something more readable. Some operations that are performed:\n\n* Evaluate decoder functions (eg. `MrWM.E9DK(0) -\u003e \"log\"`)\n* Simplify literal numeric expressions (eg. `15658734^0O73567354 -\u003e 2`)\n* Extract `if()`, `for()` and `do while()` statements from obfuscated control flow\n* Simplify template strings (eg. `` `${\"a\"}${\"b\"}` -\u003e \"ab\" ``)\n* Simplify booleans (eg. `!![] -\u003e true`)\n\n## Installation\n\n```sh\ngit clone https://github.com/JorianWoltjer/deobfuscate-preemptive.git \u0026\u0026 cd deobfuscate-preemptive\nnpm i\n./deobfuscate.js --help\n```\n\nWhen deobfuscating untrusted scripts, you should sandbox this tool. A [Dockerfile](Dockerfile) was made to run it in an isolated environment from the host using [Docker](https://www.docker.com/). With the following command, it can be built:\n\n```sh\ndocker build -t deobfuscate-preemptive .\n```\n\nThen, you can run it from anywhere by mounting the current working directory into it and working with those files, for example:\n\n```sh\nalias deobfuscate-preemptive='docker run -v $(pwd):/pwd -w /pwd --rm deobfuscate-preemptive'\ndeobfuscate-preemptive obfuscated.js \u003e deobfuscated.js\n```\n\n## Usage\n\n```\nusage: deobfuscate.js [-h] file\n\nDeobfuscate PreEmptive's JSDefender Demo\n\npositional arguments:\n  file        Obfuscated JavaScript file to deobfuscate\n\noptional arguments:\n  -h, --help  show this help message and exit\n```\n\n###### Example\n\nTake the following source code as an example:\n\n```js\nconsole.log('Hello, world!');\n```\n\nPutting it through [the obfuscator](https://www.preemptive.com/online-javascript-obfuscator/) as a developer would, the result is something like this:\n\n```js\nlet MrWM;!function(){const QaXH=Array.prototype.slice.\ncall(arguments);return eval(\"(function QWHn(zcPf){const bKRf=jWyg(zcPf,\nzemg(QWHn.toString()));try{let v7Jf=eval(bKRf);\n...\nX%07%1D%1D%13%1F%1C%08%0BIA%08%02%0E%01%12%17%0FHA@%16N*%176%25%5D=3?\n!X%07%1D%1D%13%1F%1C%08%0BIA%08%02%0E%01%12%17%0FHAA%16%08N\\\")\")}();\nconsole[MrWM.E9DK(0)](MrWM.AWqI(1));\n```\n\nSave the above file to `obfuscated.js`, then use the following command to deobfuscate it:\n\n```shell\n$ ./deobfuscate.js obfuscated.js \u003e deobfuscated.js\n\nDecoders name: LQlS\nSetup args name: QaXH\nFound 43 decoders\n=== Done deobfuscating, writing result! ===\n```\n\nNow, see `deobfuscated.js` for what should be a close replica of the original source code:\n\n```js\nconsole.log(\"Hello, world!\");\n```\n\n\u003e [!NOTE]  \n\u003e Some advanced JavaScript features such as optional chaining (`?.`) and nullish coalescing (`??`) are not supported by the version of Shift. When receiving errors about these pieces of syntax, consider patching them to something else temporarely.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjorianwoltjer%2Fdeobfuscate-preemptive","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjorianwoltjer%2Fdeobfuscate-preemptive","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjorianwoltjer%2Fdeobfuscate-preemptive/lists"}