Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about Excluding Functions from Obfuscation #143

Open
tonyy9981 opened this issue Sep 29, 2024 · 1 comment
Open

Question about Excluding Functions from Obfuscation #143

tonyy9981 opened this issue Sep 29, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@tonyy9981
Copy link

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 tonyy9981 added the enhancement New feature or request label Sep 29, 2024
@MichaelXF
Copy link
Owner

MichaelXF commented Sep 30, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants