Skip to content

different identifier for constructor and class #3

Description

@GlenDC

With source being:

(function () {
  class _0xf79654 {
    constructor(_0x18ba7a) {
      this.target = _0x18ba7a;
    }
    greet() {
      console.log("Hello " + this.target);
    }
    setTarget(_0x121c44) {
      this.target = _0x121c44;
    }
  }
  const _0x431fd3 = new _0xf79654("world");
  _0x431fd3.greet(), _0x431fd3.setTarget("reader"), _0x431fd3.greet();
}());

(From your classic javascript deobfuscation streaming series, for which a lot of thanks!!! made it all clear)

the following code will make the code incorrect:

const $script = refactor(source, commonMethods);
$script.normalizeIdentifiers();
console.log($script.print());

as it will output the following:

(function () {
  class $$mellowMode {
    constructor($arg0_eatableSaving) {
      this.target = $arg0_eatableSaving;
    }
    greet() {
      console.log("Hello " + this.target);
    }
    setTarget($arg0_abashedHunger) {
      this.target = $arg0_abashedHunger;
    }
  }
  const $$farTeapot = new $$lackingDude("world");
  $$farTeapot.greet(), $$farTeapot.setTarget("reader"), $$farTeapot.greet();
}());

where as you can see the class is now $$mellowMode, but the constructor is $$lackingDude.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions