
javascript-obfuscator 5.x 출력(문자열 배열, 제어 흐름 평탄화, 자기 방어, RC4/base64)을 위한 디오브푸스케이터
javascript-obfuscator 5.x 출력물을 위한 디오브푸스케이터입니다. 난독화된 JS를 넣으면 동일하게 동작하는 읽기 쉬운 JS를 돌려줍니다.
**Node 18+**가 필요합니다.
git clone https://github.com/lolcaken/javascript-deobfuscator.git
cd javascript-deobfuscator
npm install
npm run build
파일 디오브푸스케이트 (-o가 주어지지 않으면 입력 옆에 <name>.deob.js를 씁니다):
node dist/src/cli.js input.ob.js -o output.js --stats
플래그:
| 플래그 | 효과 |
|---|---|
-o <file> | 출력 경로 (기본값: <input>.deob.js) |
--no-rename | _0x… 식별자의 이름을 바꾸지 않고 유지 |
--stats | 각 패스가 무엇을 변경했는지 출력 |
-h | 사용법 |
또는 npm link 후 어디서나:
deobfuscate input.ob.js -o output.js
라이브러리로 사용:
import { deobfuscate } from 'javascript-deobfuscator';
const { code, stats } = deobfuscate(obfuscatedSource, { rename: true });
console.log(code);
게시 후 npm에서 설치:
npm install javascript-deobfuscator
입력 — javascript-obfuscator로 난독화된 test/fixtures/source.js (문자열 배열 + 회전, 분할 문자열, 제어 흐름 평탄화, 데드 코드 주입, 객체 키 변환, 숫자 표현식), 다음의 3690 바이트:
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'];
(전체 난독화 파일은 test/fixtures/demo.ob.js에 있습니다.)
출력 — 2359 바이트, 동일하게 실행됨:
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]));
}
(전체 출력: test/fixtures/demo.deob.js.)
둘 다 출력:
Hello, alice!
Hello, bob!
Hello, carol!
https://api.example.com/v1?r=3 13 zero|pos|pos
while(true){switch…}), 데드 코드 주입_0x… 이름 변경npm test는 javascript-obfuscator 5.9.0으로 샘플 프로그램을 세 가지 프리셋 (default, medium, heavy)으로 난독화하고, 디오브푸스케이트된 코드가 동일한 출력을 인쇄하고 깨끗하게 재파싱되는지 확인합니다. 현재 9/9.
ISC — LICENSE 참조.