Sfoglia il codice sorgente

Changed option name: `stringArrayIntermediateCalls` -> `stringArrayIntermediateVariablesCount`

sanex 4 anni fa
parent
commit
e80937d108

+ 1 - 1
CHANGELOG.md

@@ -2,7 +2,7 @@ Change Log
 
 
 v2.2.0
 v2.2.0
 ---
 ---
-* **New option:** `stringArrayIntermediateCalls` sets the passed amount of intermediate variables for the `string array`
+* **New option:** `stringArrayIntermediateVariablesCount` sets the passed amount of intermediate variables for the `string array`
 
 
 v2.1.0
 v2.1.0
 ---
 ---

+ 8 - 8
README.md

@@ -360,7 +360,7 @@ Following options are available for the JS Obfuscator:
     splitStringsChunkLength: 10,
     splitStringsChunkLength: 10,
     stringArray: true,
     stringArray: true,
     stringArrayEncoding: [],
     stringArrayEncoding: [],
-    stringArrayIntermediateCalls: true,
+    stringArrayIntermediateVariablesCount: true,
     stringArrayThreshold: 0.75,
     stringArrayThreshold: 0.75,
     target: 'browser',
     target: 'browser',
     transformObjectKeys: false,
     transformObjectKeys: false,
@@ -409,7 +409,7 @@ Following options are available for the JS Obfuscator:
     --split-strings-chunk-length <number>
     --split-strings-chunk-length <number>
     --string-array <boolean>
     --string-array <boolean>
     --string-array-encoding '<list>' (comma separated) [none, base64, rc4]
     --string-array-encoding '<list>' (comma separated) [none, base64, rc4]
-    --string-array-intermediate-calls <number>
+    --string-array-intermediate-variables-count <number>
     --string-array-threshold <number>
     --string-array-threshold <number>
     --target <string> [browser, browser-no-eval, node]
     --target <string> [browser, browser-no-eval, node]
     --transform-object-keys <boolean>
     --transform-object-keys <boolean>
@@ -950,7 +950,7 @@ stringArrayEncoding: [
 ]
 ]
 ```
 ```
 
 
-### `stringArrayIntermediateCalls`
+### `stringArrayIntermediateVariablesCount`
 Type: `number` Default: `0`
 Type: `number` Default: `0`
 
 
 ##### :warning: [`stringArray`](#stringarray) option must be enabled
 ##### :warning: [`stringArray`](#stringarray) option must be enabled
@@ -966,7 +966,7 @@ const baz = 'baz';
 
 
 console.log(foo, bar, baz);
 console.log(foo, bar, baz);
 
 
-// Output, stringArrayIntermediateCalls: 5
+// Output, stringArrayIntermediateVariablesCount: 5
 const _0x513c = [
 const _0x513c = [
     'foo',
     'foo',
     'bar',
     'bar',
@@ -1086,7 +1086,7 @@ Performance will 50-100% slower than without obfuscation
     splitStringsChunkLength: 5,
     splitStringsChunkLength: 5,
     stringArray: true,
     stringArray: true,
     stringArrayEncoding: ['rc4'],
     stringArrayEncoding: ['rc4'],
-    stringArrayIntermediateCalls: 10,
+    stringArrayIntermediateVariablesCount: 10,
     stringArrayThreshold: 1,
     stringArrayThreshold: 1,
     transformObjectKeys: true,
     transformObjectKeys: true,
     unicodeEscapeSequence: false
     unicodeEscapeSequence: false
@@ -1119,7 +1119,7 @@ Performance will 30-35% slower than without obfuscation
     splitStringsChunkLength: 10,
     splitStringsChunkLength: 10,
     stringArray: true,
     stringArray: true,
     stringArrayEncoding: ['base64'],
     stringArrayEncoding: ['base64'],
-    stringArrayIntermediateCalls: 5,
+    stringArrayIntermediateVariablesCount: 5,
     stringArrayThreshold: 0.75,
     stringArrayThreshold: 0.75,
     transformObjectKeys: true,
     transformObjectKeys: true,
     unicodeEscapeSequence: false
     unicodeEscapeSequence: false
@@ -1149,7 +1149,7 @@ Performance will slightly slower than without obfuscation
     splitStrings: false,
     splitStrings: false,
     stringArray: true,
     stringArray: true,
     stringArrayEncoding: [],
     stringArrayEncoding: [],
-    stringArrayIntermediateCalls: 0,
+    stringArrayIntermediateVariablesCount: 0,
     stringArrayThreshold: 0.75,
     stringArrayThreshold: 0.75,
     unicodeEscapeSequence: false
     unicodeEscapeSequence: false
 }
 }
@@ -1176,7 +1176,7 @@ Performance will slightly slower than without obfuscation
     splitStrings: false,
     splitStrings: false,
     stringArray: true,
     stringArray: true,
     stringArrayEncoding: [],
     stringArrayEncoding: [],
-    stringArrayIntermediateCalls: 0,
+    stringArrayIntermediateVariablesCount: 0,
     stringArrayThreshold: 0.75,
     stringArrayThreshold: 0.75,
     unicodeEscapeSequence: false
     unicodeEscapeSequence: false
 }
 }

File diff suppressed because it is too large
+ 0 - 0
dist/index.browser.js


File diff suppressed because it is too large
+ 0 - 0
dist/index.cli.js


File diff suppressed because it is too large
+ 0 - 0
dist/index.js


+ 1 - 1
src/cli/JavaScriptObfuscatorCLI.ts

@@ -340,7 +340,7 @@ export class JavaScriptObfuscatorCLI implements IInitializable {
                 ArraySanitizer
                 ArraySanitizer
             )
             )
             .option(
             .option(
-                '--string-array-intermediate-calls <number>',
+                '--string-array-intermediate-variables-count <number>',
                 'Sets the passed amount of intermediate variables for the string array.',
                 'Sets the passed amount of intermediate variables for the string array.',
                 parseInt
                 parseInt
             )
             )

+ 1 - 1
src/interfaces/options/IOptions.ts

@@ -41,7 +41,7 @@ export interface IOptions {
     readonly splitStringsChunkLength: number;
     readonly splitStringsChunkLength: number;
     readonly stringArray: boolean;
     readonly stringArray: boolean;
     readonly stringArrayEncoding: TStringArrayEncoding[];
     readonly stringArrayEncoding: TStringArrayEncoding[];
-    readonly stringArrayIntermediateCalls: number;
+    readonly stringArrayIntermediateVariablesCount: number;
     readonly stringArrayThreshold: number;
     readonly stringArrayThreshold: number;
     readonly target: TypeFromEnum<typeof ObfuscationTarget>;
     readonly target: TypeFromEnum<typeof ObfuscationTarget>;
     readonly transformObjectKeys: boolean;
     readonly transformObjectKeys: boolean;

+ 1 - 1
src/options/Options.ts

@@ -302,7 +302,7 @@ export class Options implements IOptions {
      */
      */
     @IsNumber()
     @IsNumber()
     @Min(0)
     @Min(0)
-    public readonly stringArrayIntermediateCalls!: number;
+    public readonly stringArrayIntermediateVariablesCount!: number;
 
 
     /**
     /**
      * @type {number}
      * @type {number}

+ 1 - 1
src/options/normalizer-rules/StringArrayRule.ts

@@ -18,7 +18,7 @@ export const StringArrayRule: TOptionsNormalizerRule = (options: IOptions): IOpt
             stringArrayEncoding: [
             stringArrayEncoding: [
                 StringArrayEncoding.None
                 StringArrayEncoding.None
             ],
             ],
-            stringArrayIntermediateCalls: 0,
+            stringArrayIntermediateVariablesCount: 0,
             stringArrayThreshold: 0
             stringArrayThreshold: 0
         };
         };
     }
     }

+ 1 - 1
src/options/normalizer-rules/StringArrayThresholdRule.ts

@@ -17,7 +17,7 @@ export const StringArrayThresholdRule: TOptionsNormalizerRule = (options: IOptio
             stringArrayEncoding: [
             stringArrayEncoding: [
                 StringArrayEncoding.None
                 StringArrayEncoding.None
             ],
             ],
-            stringArrayIntermediateCalls: 0,
+            stringArrayIntermediateVariablesCount: 0,
             stringArrayThreshold: 0
             stringArrayThreshold: 0
         };
         };
     }
     }

+ 1 - 1
src/options/presets/Default.ts

@@ -44,7 +44,7 @@ export const DEFAULT_PRESET: TInputOptions = Object.freeze({
     stringArrayEncoding: [
     stringArrayEncoding: [
         StringArrayEncoding.None
         StringArrayEncoding.None
     ],
     ],
-    stringArrayIntermediateCalls: 0,
+    stringArrayIntermediateVariablesCount: 0,
     stringArrayThreshold: 0.75,
     stringArrayThreshold: 0.75,
     target: ObfuscationTarget.Browser,
     target: ObfuscationTarget.Browser,
     transformObjectKeys: false,
     transformObjectKeys: false,

+ 1 - 1
src/options/presets/HighObfuscation.ts

@@ -16,6 +16,6 @@ export const HIGH_OBFUSCATION_PRESET: TInputOptions = Object.freeze({
     stringArrayEncoding: [
     stringArrayEncoding: [
         StringArrayEncoding.Rc4
         StringArrayEncoding.Rc4
     ],
     ],
-    stringArrayIntermediateCalls: 10,
+    stringArrayIntermediateVariablesCount: 10,
     stringArrayThreshold: 1
     stringArrayThreshold: 1
 });
 });

+ 1 - 1
src/options/presets/MediumObfuscation.ts

@@ -16,6 +16,6 @@ export const MEDIUM_OBFUSCATION_PRESET: TInputOptions = Object.freeze({
     stringArrayEncoding: [
     stringArrayEncoding: [
         StringArrayEncoding.Base64
         StringArrayEncoding.Base64
     ],
     ],
-    stringArrayIntermediateCalls: 5,
+    stringArrayIntermediateVariablesCount: 5,
     transformObjectKeys: true
     transformObjectKeys: true
 });
 });

+ 1 - 1
src/options/presets/NoCustomNodes.ts

@@ -41,7 +41,7 @@ export const NO_ADDITIONAL_NODES_PRESET: TInputOptions = Object.freeze({
     stringArrayEncoding: [
     stringArrayEncoding: [
         StringArrayEncoding.None
         StringArrayEncoding.None
     ],
     ],
-    stringArrayIntermediateCalls: 0,
+    stringArrayIntermediateVariablesCount: 0,
     stringArrayThreshold: 0,
     stringArrayThreshold: 0,
     target: ObfuscationTarget.Browser,
     target: ObfuscationTarget.Browser,
     transformObjectKeys: false,
     transformObjectKeys: false,

+ 1 - 1
src/storages/string-array/StringArrayStorage.ts

@@ -337,7 +337,7 @@ export class StringArrayStorage extends MapStorage <string, IStringArrayStorageI
         return {
         return {
             name: this.identifierNamesGenerator.generateForGlobalScope(StringArrayStorage.stringArrayNameLength),
             name: this.identifierNamesGenerator.generateForGlobalScope(StringArrayStorage.stringArrayNameLength),
             intermediateNames: Array.from(
             intermediateNames: Array.from(
-                {length: this.options.stringArrayIntermediateCalls},
+                {length: this.options.stringArrayIntermediateVariablesCount},
                 () => this.identifierNamesGenerator.generateForGlobalScope(StringArrayStorage.stringArrayNameLength)
                 () => this.identifierNamesGenerator.generateForGlobalScope(StringArrayStorage.stringArrayNameLength)
             )
             )
         };
         };

+ 1 - 1
test/dev/dev.ts

@@ -19,7 +19,7 @@ import { StringArrayEncoding } from '../../src/enums/StringArrayEncoding';
             compact: false,
             compact: false,
             stringArray: true,
             stringArray: true,
             stringArrayThreshold: 1,
             stringArrayThreshold: 1,
-            stringArrayIntermediateCalls: 2,
+            stringArrayIntermediateVariablesCount: 2,
             stringArrayEncoding: [
             stringArrayEncoding: [
                 StringArrayEncoding.Rc4
                 StringArrayEncoding.Rc4
             ]
             ]

+ 2 - 2
test/functional-tests/custom-code-helpers/string-array/StringArrayCallsWrapperCodeHelper.spec.ts

@@ -53,7 +53,7 @@ describe('StringArrayCallsWrapperCodeHelper', () => {
         });
         });
     });
     });
 
 
-    describe('`stringArrayIntermediateCalls` option is set', () => {
+    describe('`stringArrayIntermediateVariablesCount` option is set', () => {
         const stringArrayCallRegExp: RegExp = new RegExp(
         const stringArrayCallRegExp: RegExp = new RegExp(
                 'return _0x([a-f0-9]){4,6};' +
                 'return _0x([a-f0-9]){4,6};' +
             '};' +
             '};' +
@@ -74,7 +74,7 @@ describe('StringArrayCallsWrapperCodeHelper', () => {
                     ...NO_ADDITIONAL_NODES_PRESET,
                     ...NO_ADDITIONAL_NODES_PRESET,
                     stringArray: true,
                     stringArray: true,
                     stringArrayThreshold: 1,
                     stringArrayThreshold: 1,
-                    stringArrayIntermediateCalls: 3
+                    stringArrayIntermediateVariablesCount: 3
                 }
                 }
             ).getObfuscatedCode();
             ).getObfuscatedCode();
         });
         });

+ 1 - 1
test/functional-tests/javascript-obfuscator/JavaScriptObfuscator.spec.ts

@@ -848,7 +848,7 @@ describe('JavaScriptObfuscator', () => {
                             StringArrayEncoding.Base64,
                             StringArrayEncoding.Base64,
                             StringArrayEncoding.Rc4
                             StringArrayEncoding.Rc4
                         ],
                         ],
-                        stringArrayIntermediateCalls: 10,
+                        stringArrayIntermediateVariablesCount: 10,
                         stringArrayThreshold: 1,
                         stringArrayThreshold: 1,
                         transformObjectKeys: true,
                         transformObjectKeys: true,
                         unicodeEscapeSequence: false
                         unicodeEscapeSequence: false

+ 6 - 6
test/functional-tests/node-transformers/string-array-transformers/string-array-transformer/StringArrayTransformer.spec.ts

@@ -63,7 +63,7 @@ describe('StringArrayTransformer', function () {
         });
         });
     });
     });
 
 
-    describe('Variant #3: `stringArrayIntermediateCalls` option is enabled', () => {
+    describe('Variant #3: `stringArrayIntermediateVariablesCount` option is enabled', () => {
         describe('Variant #1: correct amount of intermediate calls', () => {
         describe('Variant #1: correct amount of intermediate calls', () => {
             const stringArrayCallRegExp: RegExp = new RegExp(
             const stringArrayCallRegExp: RegExp = new RegExp(
                     'return _0x([a-f0-9]){4,6};' +
                     'return _0x([a-f0-9]){4,6};' +
@@ -85,7 +85,7 @@ describe('StringArrayTransformer', function () {
                         ...NO_ADDITIONAL_NODES_PRESET,
                         ...NO_ADDITIONAL_NODES_PRESET,
                         stringArray: true,
                         stringArray: true,
                         stringArrayThreshold: 1,
                         stringArrayThreshold: 1,
-                        stringArrayIntermediateCalls: 3
+                        stringArrayIntermediateVariablesCount: 3
                     }
                     }
                 ).getObfuscatedCode();
                 ).getObfuscatedCode();
             });
             });
@@ -100,7 +100,7 @@ describe('StringArrayTransformer', function () {
             let evaluationResult: number;
             let evaluationResult: number;
 
 
             before(() => {
             before(() => {
-                const code: string = readFileAsString(__dirname + '/fixtures/intermediate-calls-eval.js');
+                const code: string = readFileAsString(__dirname + '/fixtures/intermediate-variables-count-eval.js');
 
 
                 const obfuscatedCode: string = JavaScriptObfuscator.obfuscate(
                 const obfuscatedCode: string = JavaScriptObfuscator.obfuscate(
                     code,
                     code,
@@ -108,7 +108,7 @@ describe('StringArrayTransformer', function () {
                         ...NO_ADDITIONAL_NODES_PRESET,
                         ...NO_ADDITIONAL_NODES_PRESET,
                         stringArray: true,
                         stringArray: true,
                         stringArrayThreshold: 1,
                         stringArrayThreshold: 1,
-                        stringArrayIntermediateCalls: 5
+                        stringArrayIntermediateVariablesCount: 5
                     }
                     }
                 ).getObfuscatedCode();
                 ).getObfuscatedCode();
 
 
@@ -395,7 +395,7 @@ describe('StringArrayTransformer', function () {
             });
             });
         });
         });
 
 
-        describe('Variant #2: `stringArrayIntermediateCalls` option is enabled', () => {
+        describe('Variant #2: `stringArrayIntermediateVariablesCount` option is enabled', () => {
             const stringArrayIntermediateCallRegExp: RegExp = new RegExp(
             const stringArrayIntermediateCallRegExp: RegExp = new RegExp(
                     'return _0x([a-f0-9]){4,6};' +
                     'return _0x([a-f0-9]){4,6};' +
                 '};' +
                 '};' +
@@ -422,7 +422,7 @@ describe('StringArrayTransformer', function () {
                             StringArrayEncoding.None,
                             StringArrayEncoding.None,
                             StringArrayEncoding.Base64
                             StringArrayEncoding.Base64
                         ],
                         ],
-                        stringArrayIntermediateCalls: 3,
+                        stringArrayIntermediateVariablesCount: 3,
                         stringArrayThreshold: 1
                         stringArrayThreshold: 1
                     }
                     }
                 ).getObfuscatedCode();
                 ).getObfuscatedCode();

+ 0 - 0
test/functional-tests/node-transformers/string-array-transformers/string-array-transformer/fixtures/intermediate-calls-eval.js → test/functional-tests/node-transformers/string-array-transformers/string-array-transformer/fixtures/intermediate-variables-count-eval.js


+ 4 - 4
test/functional-tests/options/OptionsNormalizer.spec.ts

@@ -544,7 +544,7 @@ describe('OptionsNormalizer', () => {
                     shuffleStringArray: true,
                     shuffleStringArray: true,
                     stringArray: false,
                     stringArray: false,
                     stringArrayEncoding: [StringArrayEncoding.Rc4],
                     stringArrayEncoding: [StringArrayEncoding.Rc4],
-                    stringArrayIntermediateCalls: 5,
+                    stringArrayIntermediateVariablesCount: 5,
                     stringArrayThreshold: 0.5,
                     stringArrayThreshold: 0.5,
                     rotateStringArray: true
                     rotateStringArray: true
                 });
                 });
@@ -554,7 +554,7 @@ describe('OptionsNormalizer', () => {
                     shuffleStringArray: false,
                     shuffleStringArray: false,
                     stringArray: false,
                     stringArray: false,
                     stringArrayEncoding: [StringArrayEncoding.None],
                     stringArrayEncoding: [StringArrayEncoding.None],
-                    stringArrayIntermediateCalls: 0,
+                    stringArrayIntermediateVariablesCount: 0,
                     stringArrayThreshold: 0,
                     stringArrayThreshold: 0,
                     rotateStringArray: false
                     rotateStringArray: false
                 };
                 };
@@ -592,7 +592,7 @@ describe('OptionsNormalizer', () => {
                     rotateStringArray: true,
                     rotateStringArray: true,
                     shuffleStringArray: true,
                     shuffleStringArray: true,
                     stringArray: true,
                     stringArray: true,
-                    stringArrayIntermediateCalls: 5,
+                    stringArrayIntermediateVariablesCount: 5,
                     stringArrayThreshold: 0
                     stringArrayThreshold: 0
                 });
                 });
 
 
@@ -601,7 +601,7 @@ describe('OptionsNormalizer', () => {
                     rotateStringArray: false,
                     rotateStringArray: false,
                     shuffleStringArray: false,
                     shuffleStringArray: false,
                     stringArray: false,
                     stringArray: false,
-                    stringArrayIntermediateCalls: 0,
+                    stringArrayIntermediateVariablesCount: 0,
                     stringArrayThreshold: 0
                     stringArrayThreshold: 0
                 };
                 };
             });
             });

+ 1 - 1
test/runtime-tests/JavaScriptObfuscatorRuntime.spec.ts

@@ -39,7 +39,7 @@ describe('JavaScriptObfuscator runtime eval', function () {
             StringArrayEncoding.Base64,
             StringArrayEncoding.Base64,
             StringArrayEncoding.Rc4
             StringArrayEncoding.Rc4
         ],
         ],
-        stringArrayIntermediateCalls: 20,
+        stringArrayIntermediateVariablesCount: 20,
         stringArrayThreshold: 1,
         stringArrayThreshold: 1,
         transformObjectKeys: true,
         transformObjectKeys: true,
         unicodeEscapeSequence: true
         unicodeEscapeSequence: true

Some files were not shown because too many files changed in this diff