js-confuser icon indicating copy to clipboard operation
js-confuser copied to clipboard

Question about Excluding Functions from Obfuscation

Open tonyy9981 opened this issue 1 year ago • 1 comments

Hi there,

I am using js-confuser for obfuscating my JavaScript code, and I have a question regarding excluding certain functions from the obfuscation process.

Is there an option or feature available that allows me to exclude specific functions (e.g., upload) from being obfuscated? If so, could you please provide guidance on how to implement this?

Thank you for your help!

tonyy9981 avatar Sep 29 '24 00:09 tonyy9981

You can use custom implementations to exclude the function transforms applying. This depends on what obfuscations you want for the upload function.

// Options.js
module.exports = {
  target: 'browser',

  // Versions 1.7.3 and below
  stack: (fnName) => fnName != 'upload',

  // Versions 2.0.0-alpha.2 and up ('stack' was renamed to 'variableMasking')
  variableMasking: (fnName) => fnName != 'upload', 
  
  // Other function transforms
  flatten: (fnName) => fnName != 'upload',
  dispatcher: (fnName) => fnName != 'upload',
  renameVariables: (fnName) => fnName != 'upload',
};

Nested functions within upload could be obfuscated and strings/variables inside the function could still be obfuscated.

Do you want the function to be completely unobfuscated? Because you could simply not run that through JS-Confuser and re-include that back in.

MichaelXF avatar Sep 30 '24 15:09 MichaelXF

Closing for now

MichaelXF avatar Nov 09 '24 04:11 MichaelXF