mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
Applying optimize-js for obfuscated code
This commit is contained in:
@@ -110,6 +110,7 @@ Following options available for the JS Obfuscator:
|
||||
debugProtectionInterval: false,
|
||||
disableConsoleOutput: true,
|
||||
encodeUnicodeLiterals: false,
|
||||
optimize: false,
|
||||
reservedNames: [],
|
||||
rotateUnicodeArray: true,
|
||||
selfDefending: true,
|
||||
@@ -135,6 +136,7 @@ Following options available for the JS Obfuscator:
|
||||
--debugProtectionInterval <boolean>
|
||||
--disableConsoleOutput <boolean>
|
||||
--encodeUnicodeLiterals <boolean>
|
||||
--optimize <boolean>
|
||||
--reservedNames <list> (comma separated)
|
||||
--rotateUnicodeArray <boolean>
|
||||
--selfDefending <boolean>
|
||||
@@ -186,6 +188,11 @@ This option can slightly slow down your code speed.
|
||||
All literals in Unicode array become encoded in Base64.
|
||||
To decode strings, a special function will be inserted on the page under `unicodeArray` node.
|
||||
|
||||
### `optimize`
|
||||
Type: `boolean` Default: `false`
|
||||
|
||||
Enables optimizations for obfuscated code with help of [optimize-js](https://github.com/nolanlawson/optimize-js)
|
||||
|
||||
### `reservedNames`
|
||||
Type: `string[]` Default: `[]`
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -1069,7 +1069,7 @@ exports.DEFAULT_PRESET = Object.freeze({
|
||||
disableConsoleOutput: true,
|
||||
domainLock: [],
|
||||
encodeUnicodeLiterals: false,
|
||||
optimize: true,
|
||||
optimize: false,
|
||||
reservedNames: [],
|
||||
rotateUnicodeArray: true,
|
||||
selfDefending: true,
|
||||
@@ -1544,7 +1544,7 @@ var JavaScriptObfuscatorCLI = function () {
|
||||
}, {
|
||||
key: 'configureCommands',
|
||||
value: function configureCommands() {
|
||||
this.commands = new commander.Command().version(JavaScriptObfuscatorCLI.getBuildVersion(), '-v, --version').usage('<inputPath> [options]').option('-o, --output <path>', 'Output path for obfuscated code').option('--compact <boolean>', 'Disable one line output code compacting', JavaScriptObfuscatorCLI.parseBoolean).option('--debugProtection <boolean>', 'Disable browser Debug panel (can cause DevTools enabled browser freeze)', JavaScriptObfuscatorCLI.parseBoolean).option('--debugProtectionInterval <boolean>', 'Disable browser Debug panel even after page was loaded (can cause DevTools enabled browser freeze)', JavaScriptObfuscatorCLI.parseBoolean).option('--disableConsoleOutput <boolean>', 'Allow console.log, console.info, console.error and console.warn messages output into browser console', JavaScriptObfuscatorCLI.parseBoolean).option('--encodeUnicodeLiterals <boolean>', 'All literals in Unicode array become encoded in Base64 (this option can slightly slow down your code speed)', JavaScriptObfuscatorCLI.parseBoolean).option('--reservedNames <list>', 'Disable obfuscation of variable names, function names and names of function parameters that match the passed RegExp patterns (comma separated)', function (val) {
|
||||
this.commands = new commander.Command().version(JavaScriptObfuscatorCLI.getBuildVersion(), '-v, --version').usage('<inputPath> [options]').option('-o, --output <path>', 'Output path for obfuscated code').option('--compact <boolean>', 'Disable one line output code compacting', JavaScriptObfuscatorCLI.parseBoolean).option('--debugProtection <boolean>', 'Disable browser Debug panel (can cause DevTools enabled browser freeze)', JavaScriptObfuscatorCLI.parseBoolean).option('--debugProtectionInterval <boolean>', 'Disable browser Debug panel even after page was loaded (can cause DevTools enabled browser freeze)', JavaScriptObfuscatorCLI.parseBoolean).option('--disableConsoleOutput <boolean>', 'Allow console.log, console.info, console.error and console.warn messages output into browser console', JavaScriptObfuscatorCLI.parseBoolean).option('--encodeUnicodeLiterals <boolean>', 'All literals in Unicode array become encoded in Base64 (this option can slightly slow down your code speed)', JavaScriptObfuscatorCLI.parseBoolean).option('--optimize <boolean>', 'Enables optimizations for obfuscated code with help of `optimize-js`', JavaScriptObfuscatorCLI.parseBoolean).option('--reservedNames <list>', 'Disable obfuscation of variable names, function names and names of function parameters that match the passed RegExp patterns (comma separated)', function (val) {
|
||||
return val.split(',');
|
||||
}).option('--rotateUnicodeArray <boolean>', 'Disable rotation of unicode array values during obfuscation', JavaScriptObfuscatorCLI.parseBoolean).option('--selfDefending <boolean>', 'Disables self-defending for obfuscated code', JavaScriptObfuscatorCLI.parseBoolean).option('--sourceMap <boolean>', 'Enables source map generation', JavaScriptObfuscatorCLI.parseBoolean).option('--sourceMapBaseUrl <string>', 'Sets base url to the source map import url when `--sourceMapMode=separate`').option('--sourceMapFileName <string>', 'Sets file name for output source map when `--sourceMapMode=separate`').option('--sourceMapMode <string> [inline, separate]', 'Specify source map output mode', JavaScriptObfuscatorCLI.parseSourceMapMode).option('--unicodeArray <boolean>', 'Disables gathering of all literal strings into an array and replacing every literal string with an array call', JavaScriptObfuscatorCLI.parseBoolean).option('--unicodeArrayThreshold <number>', 'The probability that the literal string will be inserted into unicodeArray (Default: 0.8, Min: 0, Max: 1)', parseFloat).option('--wrapUnicodeArrayCalls <boolean>', 'Disables usage of special access function instead of direct array call', JavaScriptObfuscatorCLI.parseBoolean).option('--domainLock <list>', 'Blocks the execution of the code in domains that do not match the passed RegExp patterns (comma separated)', function (val) {
|
||||
return val.split(',');
|
||||
|
||||
@@ -127,6 +127,7 @@ export class JavaScriptObfuscatorCLI {
|
||||
.option('--debugProtectionInterval <boolean>', 'Disable browser Debug panel even after page was loaded (can cause DevTools enabled browser freeze)', JavaScriptObfuscatorCLI.parseBoolean)
|
||||
.option('--disableConsoleOutput <boolean>', 'Allow console.log, console.info, console.error and console.warn messages output into browser console', JavaScriptObfuscatorCLI.parseBoolean)
|
||||
.option('--encodeUnicodeLiterals <boolean>', 'All literals in Unicode array become encoded in Base64 (this option can slightly slow down your code speed)', JavaScriptObfuscatorCLI.parseBoolean)
|
||||
.option('--optimize <boolean>', 'Enables optimizations for obfuscated code with help of `optimize-js`', JavaScriptObfuscatorCLI.parseBoolean)
|
||||
.option('--reservedNames <list>', 'Disable obfuscation of variable names, function names and names of function parameters that match the passed RegExp patterns (comma separated)', (val: string) => val.split(','))
|
||||
.option('--rotateUnicodeArray <boolean>', 'Disable rotation of unicode array values during obfuscation', JavaScriptObfuscatorCLI.parseBoolean)
|
||||
.option('--selfDefending <boolean>', 'Disables self-defending for obfuscated code', JavaScriptObfuscatorCLI.parseBoolean)
|
||||
|
||||
@@ -9,7 +9,7 @@ export const DEFAULT_PRESET: IObfuscatorOptions = Object.freeze({
|
||||
disableConsoleOutput: true,
|
||||
domainLock: [],
|
||||
encodeUnicodeLiterals: false,
|
||||
optimize: true,
|
||||
optimize: false,
|
||||
reservedNames: [],
|
||||
rotateUnicodeArray: true,
|
||||
selfDefending: true,
|
||||
|
||||
Reference in New Issue
Block a user