Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

General purpose JavaScript deobfuscator

License

NotificationsYou must be signed in to change notification settings

ben-sb/javascript-deobfuscator

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

Features

  • 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

Examples

See bottom for more complicated example with features chained together.

Array Unpacking

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');

Proxy Functions

An example with simple proxy functions for other functions

Before

functiona(b,c){returnsomeFunction(b,c);}constresult=a(5,6);

After

constresult=someFunction(5,6);

An example with proxy functions for arithmetic

Before

functiona(b,c){returnc+2*b;}constresult=a(5,6);

After

constresult=6+2*5;

An example with chained proxy functions

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;

Expression Simplification

An example with numbers

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;}

An example with strings.

Before

console.log('He'+'ll'+'o'+' Wo'+'r'+'ld');

After

console.log('Hello World');

Overall Example

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);

Config

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;};}

To Run

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

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp