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

Template string obfuscation #117

Closed
Le0Developer opened this issue Nov 26, 2023 · 4 comments
Closed

Template string obfuscation #117

Le0Developer opened this issue Nov 26, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@Le0Developer
Copy link

Is your feature request related to a problem? Please describe.

Strings inside template literals are currently not obfuscated.

For example:

console.log(`Hello World`)

Will preserve the Hello world 1:1 into the generated code without obfuscation.

Describe the solution you'd like

Note

Codeblocks below are using ´ so they are displayed correctly.

Template strings should be obfuscated, there are multiple ways to achieve this:

  • replace with normal string concats (eg ´Hello ${name}´ gets turned into "Hello " + name – where "Hello " is processed like a normal string with string concealing etc)
  • replace with string literals (eg ´Hello world´ into ´${"Hello world"}´)

Tagged function calls can be turned into regular function calls instead:

test´hello ${world}´ -> test(["hello "], world)

@Le0Developer Le0Developer added the enhancement New feature or request label Nov 26, 2023
@MichaelXF
Copy link
Owner

This is good and needs to be fixed

@j4k0xb
Copy link

j4k0xb commented Dec 17, 2023

How about using babel or another tool directly instead of https://github.com/MichaelXF/js-confuser#es5
It already has all the plugins like https://babeljs.io/docs/babel-plugin-transform-template-literals so you wouldn't have to re-implement them

@MichaelXF
Copy link
Owner

How about using babel or another tool directly instead of https://github.com/MichaelXF/js-confuser#es5 It already has all the plugins like https://babeljs.io/docs/babel-plugin-transform-template-literals so you wouldn't have to re-implement them

Yes I plan to use Babel in the future, maybe for a 2.0 rewrite? I noticed Babel tools are very fast and has nice APIs that Webcrack and other projects use (ex: referenced identifiers)

@MichaelXF
Copy link
Owner

Solved in 2.0, moving issue to #149

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

3 participants