Open slush3 opened 2 weeks ago
I thought zero-length characters is enough. Also we can do this by adding "dict" option like in javascript-obfuscator, contain characters to craft variables with
You can write your own variable name generator by providing a function for identifierGenerator
:
const options = {
target: "node",
// Custom variable names
identifierGenerator: function () {
return "$" + Math.random().toString(36).substring(7);
},
renameVariables: true,
};
You can implement the function however you'd like, just make sure to return valid identifiers. More info on the 2.0 docs: https://new--confuser.netlify.app/docs/options/identifiergenerator#custom-implementation
Also willing to add a Chinese character mode (cause why not) if you have an implementation for it, just send it as a reply or create a PR.
I've this function laying around for generating chinese characters:
function generateChineseName(length: number) {
const names = [];
for (let i = 0; i < length; i++)
names.push(
String.fromCharCode(
Math.floor(Math.random() * (0x9fff - 0x4e00)) + 0x4e00,
),
);
return names.join("");
}
hf
You can write your own variable name generator by providing a function for
identifierGenerator
:const options = { target: "node", // Custom variable names identifierGenerator: function () { return "$" + Math.random().toString(36).substring(7); }, renameVariables: true, };
You can implement the function however you'd like, just make sure to return valid identifiers. More info on the 2.0 docs: https://new--confuser.netlify.app/docs/options/identifiergenerator#custom-implementation
Should custom generator return unique values?
You can write your own variable name generator by providing a function for
identifierGenerator
:const options = { target: "node", // Custom variable names identifierGenerator: function () { return "$" + Math.random().toString(36).substring(7); }, renameVariables: true, };
You can implement the function however you'd like, just make sure to return valid identifiers. More info on the 2.0 docs: https://new--confuser.netlify.app/docs/options/identifiergenerator#custom-implementation
Should custom generator return unique values?
Yes. The generator function will be called until a unique value is found.
https://github.com/MichaelXF/js-confuser/blob/new/src/utils/NameGen.ts#L78
Hi, we can make Function Names and, if necessary, Constants names even more unreadable by using Chinese characters. (This feature is not available in the current version.)
Note: I don't know if they told you about this feature, but I thought I would tell you.