lelinhtinh / de4js

JavaScript Deobfuscator and Unpacker
https://lelinhtinh.github.io/de4js/
MIT License
1.29k stars 325 forks source link

Method after closing curly brace #54

Closed karaby closed 3 years ago

karaby commented 3 years ago

Bug: No dot is placed in front of the method if there is a closing curly brace before it. Sample source: for(var aD in aA)I['d'](aC,aD,function(aE){return aA[aE];}['bind'](null,aD)); result:

for (var aD in aA) I.d(aC, aD, function (aE) {
        return aA[aE];
    }
    bind(null, aD));

Used master branch, commit 7b4655657fc98608748aedff194005774f49768b

lelinhtinh commented 3 years ago

But, how to distinguish it with the class structure? :facepalm:

class Test {
  ["ahihi"]() {
    return function () {
      return 1;
    };
  }
  ["bind"]() {
    return 2;
  }
}
karaby commented 3 years ago

And in this case ("Of inherits", "Of transformTo")? before:

                Ob['magic'] = String['fromCharCo' + 'de'](0x8, 0x0),
                Of['inherits'](Oi, Og),
                Oi['prototype']['processChu' + 'nk'] = function(On) {
                    this['meta'] = On['meta'],
                    null === this['_pako'] && this['_createPak' + 'o'](),
                    this['_pako']['push'](Of['transformT' + 'o'](Oh, On['data']), !0x1);
                }

after:

                    Ob.magic = String.fromCharCode(8, 0), Of inherits(Oi, Og), Oi.prototype.processChunk = function (On) {
                        this.meta = On.meta, null === this._pako && this._createPako(), this._pako.push(Of transformTo(Oh, On.data), false);
lelinhtinh commented 3 years ago

https://github.com/lelinhtinh/de4js/blob/395d2e93c0f86a2d41309f99800846f3802619bc/lib/utils.js#L23

Just remove the i flag