Deobfuscator für die Ausgabe von javascript-obfuscator 5.x (String-Arrays, Control-Flow-Flattening, Self-Defending, RC4/base64)
Deobfuscator für die Ausgabe von javascript-obfuscator 5.x. Füttere ihn mit obfuskiertem JS und erhalte lesbares JS zurück, das dasselbe ausführt.
Erfordert Node 18+.
git clone https://github.com/lolcaken/javascript-deobfuscator.git
cd javascript-deobfuscator
npm install
npm run build
Eine Datei deobfuskieren (schreibt <name>.deob.js neben die Eingabe, sofern nicht -o angegeben ist):
node dist/src/cli.js input.ob.js -o output.js --stats
Flags:
| Flag | Wirkung |
|---|---|
-o <file> | Ausgabepfad (Standard: <input>.deob.js) |
--no-rename | _0x…-Bezeichner beibehalten statt sie umzubenennen |
--stats | ausgeben, was jeder Durchlauf geändert hat |
-h | Verwendung |
Oder nach npm link überall:
deobfuscate input.ob.js -o output.js
Als Bibliothek verwenden:
import { deobfuscate } from 'javascript-deobfuscator';
const { code, stats } = deobfuscate(obfuscatedSource, { rename: true });
console.log(code);
Nach der Veröffentlichung von npm installieren:
npm install javascript-deobfuscator
Eingabe — test/fixtures/source.js obfuskiert mit javascript-obfuscator (String-Arrays + Rotation, geteilte Strings, Control-Flow-Flattening, Dead-Code-Injection, Objekt-Schlüssel-Transformationen, Zahlenausdrücke), 3690 Bytes davon:
function _0x54b6(_0xb7919b,_0x500140){_0xb7919b=_0xb7919b-(0x1f8d+-0x1*-0xb9d+0x2a06*-0x1);const _0x229d59=_0x1598();let _0x3ccc27=_0x229d59[_0xb7919b];return _0x3ccc27;}const _0x822f89=_0x54b6;function _0x1598(){const _0x23b861=['com/','http','ies','log','join','uiXo','alic','fqAn','oint','bob','2zqCUix','PJTj','3161739tTCvqO','?r=','5dPKAUt','727970ZDbPoX','ple.','caro','neg','s://',…];_0x1598=function(){return _0x23b861;};return _0x1598();}(function(_0x5e6e6e,_0x257dcb){const _0x5ed3d4=_0x54b6,_0x860095=_0x5e6e6e();while(!![]){try{const _0x44a344=-parseInt(_0x5ed3d4(0x138))/(0xb*-0x281+0x1c08+0x2*-0x3e)+…;if(_0x44a344===_0x257dcb)break;else _0x860095['push'](https://github.com/lolcaken/javascript-deobfuscator/blob/main/_0x860095%5B%27shift%27%5D%28));}catch(_0x1f2aee){_0x860095['push'](https://github.com/lolcaken/javascript-deobfuscator/blob/main/_0x860095%5B%27shift%27%5D%28));}}}(_0x1598,…));const greeting=_0x822f89(0x12e)+'o';function greet(_0x35652d){…}const users=[_0x822f89(0x12c)+'e',_0x822f89(0x12d),_0x822f89(0x138)+'l'];
(Die vollständig obfuskierte Datei befindet sich unter test/fixtures/demo.ob.js.)
Ausgabe — 2359 Bytes, läuft identisch:
const greeting = "Hello";
function greet(p) {
const q = f,
r = {};
r[q(0x12b) + 'i'] = function (u, v) {
return u + v;
}, r[q(0x140) + 'X'] = function (w, x) {
return w + x;
};
const s = r,
t = s[q(0x12b) + 'i'](https://github.com/lolcaken/javascript-deobfuscator/blob/main/s%5Bq%280x12b) + 'i'](s[q(0x140) + 'X'](https://github.com/lolcaken/javascript-deobfuscator/blob/main/greeting%2C ",\x20"), p), '!');
return t;
}
const users = ["alice", "bob", "carol"];
let total = 0;
for (let i = 0; i < users.length; i++) {
total += users[i].length, console.log(greet(users[i]));
}
(Vollständige Ausgabe: test/fixtures/demo.deob.js.)
Beide geben aus:
Hello, alice!
Hello, bob!
Hello, carol!
https://api.example.com/v1?r=3 13 zero|pos|pos
while(true){switch…}), Dead-Code-Injection_0x…npm test obfuskiert Beispielprogramme mit javascript-obfuscator 5.9.0 unter drei Presets (default, medium, heavy) und stellt sicher, dass der deobfuskierte Code identische Ausgaben erzeugt und sauber neu geparst wird. Derzeit 9/9.
ISC — siehe LICENSE.