- Notifications
You must be signed in to change notification settings - Fork140
General purpose JavaScript deobfuscator
License
ben-sb/javascript-deobfuscator
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
A simple but powerful deobfuscator to remove common JavaScript obfuscation techniques.Open an issue if there is a feature you think should be implemented.
Online version atdeobfuscate.io
Install vianpm install js-deobfuscator
Looking for a deobfuscator specific to Obfuscator.io/javascript-obfuscator? Trythis repo
If you would like to discuss/learn about JavaScript obfuscation and deobfuscation you can join theDiscord server
- Unpacks arrays containing literals (strings, numbers etc) and replaces all references to them
- Removes simple proxy functions (calls to another function), array proxy functions and arithmetic proxy functions (binary expressions)
- Simplifies arithmetic expressions
- Simplifies string concatenation
- Renames unreadable hexadecimal identifiers (e.g. _0xca830a)
- Converts computed to static member expressions and beautifies the code
See bottom for more complicated example with features chained together.
Before
consta=['\x20','\x57\x6f\x72\x6c\x64','\x48\x65\x6c\x6c\x6f'];console.log(a[2]+a[0]+a[1]);
After
console.log('Hello'+' '+'World');
Before
functiona(b,c){returnsomeFunction(b,c);}constresult=a(5,6);
After
constresult=someFunction(5,6);
Before
functiona(b,c){returnc+2*b;}constresult=a(5,6);
After
constresult=6+2*5;
Before
functiona(b,c){returnc+2*b;}functionb(c,d){returna(c,d);}functionc(d,e){returnb(d,e);}constresult=c(5,6);
After
constresult=6+2*5;
Before
lettotal=0x2*0x109e+-0xc*-0x16a+-0x3234;for(leti=0x1196+0x97b*0x3+-0x2e07;i<-0x95*-0x38+-0x1a75+-0x619;i++){total+=i;}
After
lettotal=0;for(leti=0;i<10;i++){total+=i;}
Before
console.log('He'+'ll'+'o'+' Wo'+'r'+'ld');
After
console.log('Hello World');
All these features can be chained together to simplify code.
Before
constar=['\x48\x65\x6c\x6c\x6f',0x95,'\x20',0x1a75,'\x57\x6f\x72\x6c\x64',-0x53,'\x6c\x6f\x67'];consta=function(b,c){returnc+2*b;},b=function(c,d){returna(c,d);},c=function(d,e){returnb(d,e);};constmessage=ar[0]+ar[2]+ar[4];constresult=c(ar[1]*0x38+ar[3]+0x619,0x12*ar[5]+0x1a13+0x621);console[ar[6]](message+' '+result);
After
constmessage='Hello World';constresult=40106;console.log(message+' '+result);
interfaceConfig{verbose:boolean;isModule:boolean;arrays:{unpackArrays:boolean;removeArrays:boolean;};proxyFunctions:{replaceProxyFunctions:boolean;removeProxyFunctions:boolean;};expressions:{simplifyExpressions:boolean;removeDeadBranches:boolean;};miscellaneous:{beautify:boolean;simplifyProperties:boolean;renameHexIdentifiers:boolean;};}
Either install the module locally vianpm install js-deobfuscator and import as usual or install globallynpm install -g js-deobfuscator and use thejs-deobfuscator CLI:
> js-deobfuscator -hUsage: js-deobfuscator [options]Deobfuscate a javascript fileOptions: -i, --input [input_file] The input file to deobfuscate (default:"input/source.js") -o, --output [output_file] The deobfuscated output file (default:"output/output.js") -m, --module Parse an ESModule -h, --help displayhelpforcommand
Alternatively use the online version atdeobfuscate.io
About
General purpose JavaScript deobfuscator
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.