浏览代码

Refactoring of custom nodes: split on custom nodes and custom code helpers

sanex3339 5 年之前
父节点
当前提交
51523c0d5c
共有 100 个文件被更改,包括 1134 次插入1073 次删除
  1. 0 0
      dist/index.browser.js
  2. 0 0
      dist/index.cli.js
  3. 0 0
      dist/index.js
  4. 1 1
      src/JavaScriptObfuscator.ts
  5. 2 0
      src/container/InversifyContainerFacade.ts
  6. 6 6
      src/container/ServiceIdentifiers.ts
  7. 114 0
      src/container/modules/custom-code-helpers/CustomCodeHelpersModule.ts
  8. 3 111
      src/container/modules/custom-nodes/CustomNodesModule.ts
  9. 3 3
      src/container/modules/node-transformers/PreparingTransformersModule.ts
  10. 5 5
      src/container/modules/storages/StoragesModule.ts
  11. 121 0
      src/custom-code-helpers/AbstractCustomCodeHelper.ts
  12. 16 15
      src/custom-code-helpers/AbstractCustomCodeHelperGroup.ts
  13. 2 2
      src/custom-code-helpers/CustomCodeHelperFormatter.ts
  14. 2 2
      src/custom-code-helpers/CustomCodeHelperObfuscator.ts
  15. 17 17
      src/custom-code-helpers/calls-controller/CallsControllerFunctionCodeHelper.ts
  16. 0 0
      src/custom-code-helpers/common/templates/GlobalVariableNoEvalTemplate.ts
  17. 0 0
      src/custom-code-helpers/common/templates/GlobalVariableTemplate1.ts
  18. 0 0
      src/custom-code-helpers/common/templates/GlobalVariableTemplate2.ts
  19. 0 0
      src/custom-code-helpers/common/templates/SingleNodeCallControllerTemplate.ts
  20. 15 15
      src/custom-code-helpers/console-output/ConsoleOutputDisableExpressionCodeHelper.ts
  21. 107 0
      src/custom-code-helpers/console-output/group/ConsoleOutputCodeHelperGroup.ts
  22. 0 0
      src/custom-code-helpers/console-output/templates/ConsoleOutputDisableExpressionTemplate.ts
  23. 16 16
      src/custom-code-helpers/debug-protection/DebugProtectionFunctionCallCodeHelper.ts
  24. 18 18
      src/custom-code-helpers/debug-protection/DebugProtectionFunctionCodeHelper.ts
  25. 16 16
      src/custom-code-helpers/debug-protection/DebugProtectionFunctionIntervalCodeHelper.ts
  26. 138 0
      src/custom-code-helpers/debug-protection/group/DebugProtectionCodeHelperGroup.ts
  27. 0 0
      src/custom-code-helpers/debug-protection/templates/debug-protection-function-call/DebugProtectionFunctionCallTemplate.ts
  28. 0 0
      src/custom-code-helpers/debug-protection/templates/debug-protection-function-interval/DebugProtectionFunctionIntervalTemplate.ts
  29. 0 0
      src/custom-code-helpers/debug-protection/templates/debug-protection-function/DebugProtectionFunctionTemplate.ts
  30. 0 0
      src/custom-code-helpers/debug-protection/templates/debug-protection-function/DebuggerTemplate.ts
  31. 0 0
      src/custom-code-helpers/debug-protection/templates/debug-protection-function/DebuggerTemplateNoEval.ts
  32. 16 16
      src/custom-code-helpers/domain-lock/DomainLockCodeHelper.ts
  33. 30 30
      src/custom-code-helpers/domain-lock/group/DomainLockCustomCodeHelperGroup.ts
  34. 1 1
      src/custom-code-helpers/domain-lock/templates/DomainLockTemplate.ts
  35. 16 16
      src/custom-code-helpers/self-defending/SelfDefendingUnicodeCodeHelper.ts
  36. 30 30
      src/custom-code-helpers/self-defending/group/SelfDefendingCodeHelperGroup.ts
  37. 0 0
      src/custom-code-helpers/self-defending/templates/SelfDefendingTemplate.ts
  38. 26 26
      src/custom-code-helpers/string-array/StringArrayCallsWrapperCodeHelper.ts
  39. 16 16
      src/custom-code-helpers/string-array/StringArrayCodeHelper.ts
  40. 19 19
      src/custom-code-helpers/string-array/StringArrayRotateFunctionCodeHelper.ts
  41. 124 0
      src/custom-code-helpers/string-array/group/StringArrayCodeHelperGroup.ts
  42. 0 0
      src/custom-code-helpers/string-array/templates/string-array-calls-wrapper/AtobTemplate.ts
  43. 0 0
      src/custom-code-helpers/string-array/templates/string-array-calls-wrapper/Rc4Template.ts
  44. 0 0
      src/custom-code-helpers/string-array/templates/string-array-calls-wrapper/SelfDefendingTemplate.ts
  45. 1 1
      src/custom-code-helpers/string-array/templates/string-array-calls-wrapper/StringArrayBase64DecodeTemplate.ts
  46. 1 1
      src/custom-code-helpers/string-array/templates/string-array-calls-wrapper/StringArrayCallsWrapperTemplate.ts
  47. 1 1
      src/custom-code-helpers/string-array/templates/string-array-calls-wrapper/StringArrayRC4DecodeTemplate.ts
  48. 0 0
      src/custom-code-helpers/string-array/templates/string-array-rotate-function/SelfDefendingTemplate.ts
  49. 0 0
      src/custom-code-helpers/string-array/templates/string-array-rotate-function/StringArrayRotateFunctionTemplate.ts
  50. 0 0
      src/custom-code-helpers/string-array/templates/string-array/StringArrayTemplate.ts
  51. 9 47
      src/custom-nodes/AbstractCustomNode.ts
  52. 0 107
      src/custom-nodes/console-output-nodes/group/ConsoleOutputCustomNodeGroup.ts
  53. 5 10
      src/custom-nodes/control-flow-flattening-nodes/BinaryExpressionFunctionNode.ts
  54. 5 10
      src/custom-nodes/control-flow-flattening-nodes/BlockStatementControlFlowFlatteningNode.ts
  55. 5 10
      src/custom-nodes/control-flow-flattening-nodes/CallExpressionFunctionNode.ts
  56. 5 10
      src/custom-nodes/control-flow-flattening-nodes/LogicalExpressionFunctionNode.ts
  57. 5 10
      src/custom-nodes/control-flow-flattening-nodes/StringLiteralNode.ts
  58. 7 8
      src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/CallExpressionControlFlowStorageCallNode.ts
  59. 5 10
      src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ControlFlowStorageNode.ts
  60. 7 8
      src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ExpressionWithOperatorControlFlowStorageCallNode.ts
  61. 7 8
      src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/StringLiteralControlFlowStorageCallNode.ts
  62. 5 10
      src/custom-nodes/dead-code-injection-nodes/BlockStatementDeadCodeInjectionNode.ts
  63. 0 138
      src/custom-nodes/debug-protection-nodes/group/DebugProtectionCustomNodeGroup.ts
  64. 5 10
      src/custom-nodes/object-expression-keys-transformer-nodes/ObjectExpressionVariableDeclarationHostNode.ts
  65. 0 124
      src/custom-nodes/string-array-nodes/group/StringArrayCustomNodeGroup.ts
  66. 12 0
      src/enums/custom-code-helpers/CustomCodeHelper.ts
  67. 7 0
      src/enums/custom-code-helpers/CustomCodeHelperGroup.ts
  68. 0 12
      src/enums/custom-nodes/CustomNode.ts
  69. 0 7
      src/enums/custom-nodes/CustomNodeGroup.ts
  70. 1 1
      src/enums/node-transformers/NodeTransformer.ts
  71. 12 0
      src/interfaces/custom-code-helpers/ICustomCodeHelper.ts
  72. 1 1
      src/interfaces/custom-code-helpers/ICustomCodeHelperFormatter.ts
  73. 6 6
      src/interfaces/custom-code-helpers/ICustomCodeHelperGroup.ts
  74. 1 1
      src/interfaces/custom-code-helpers/ICustomCodeHelperObfuscator.ts
  75. 14 14
      src/node-transformers/preparing-transformers/CustomCodeHelpersTransformer.ts
  76. 57 0
      src/storages/custom-code-helpers/CustomCodeHelperGroupStorage.ts
  77. 0 57
      src/storages/custom-node-group/CustomNodeGroupStorage.ts
  78. 0 0
      src/storages/custom-nodes/ControlFlowStorage.ts
  79. 7 0
      src/types/container/custom-code-helpers/TCustomCodeHelperFactory.ts
  80. 5 0
      src/types/container/custom-code-helpers/TCustomCodeHelperGroupFactory.ts
  81. 0 7
      src/types/container/custom-nodes/TCustomNodeFactory.ts
  82. 0 5
      src/types/container/custom-nodes/TCustomNodeGroupFactory.ts
  83. 4 0
      src/types/storages/TCustomCodeHelperGroupStorage.ts
  84. 0 4
      src/types/storages/TCustomNodeGroupStorage.ts
  85. 1 1
      test/functional-tests/custom-code-helpers/common/templates/GlobalVariableNoEvalTemplate.spec.ts
  86. 8 8
      test/functional-tests/custom-code-helpers/console-output/ConsoleOutputDisableExpressionCodeHelper.spec.ts
  87. 0 0
      test/functional-tests/custom-code-helpers/console-output/fixtures/simple-input.js
  88. 0 0
      test/functional-tests/custom-code-helpers/debug-protection/templates/DebugProtectionFunctionCallTemplate.spec.ts
  89. 0 0
      test/functional-tests/custom-code-helpers/debug-protection/templates/fixtures/input.js
  90. 0 0
      test/functional-tests/custom-code-helpers/debug-protection/templates/fixtures/single-call.js
  91. 0 0
      test/functional-tests/custom-code-helpers/debug-protection/templates/workers/evaluation-worker.js
  92. 3 3
      test/functional-tests/custom-code-helpers/domain-lock/DomainLockCodeHelper.spec.ts
  93. 0 0
      test/functional-tests/custom-code-helpers/domain-lock/fixtures/simple-input.js
  94. 33 33
      test/functional-tests/custom-code-helpers/domain-lock/templates/DomainLockNodeTemplate.spec.ts
  95. 0 0
      test/functional-tests/custom-code-helpers/domain-lock/templates/fixtures/prevailing-kind-of-variables-const.js
  96. 0 0
      test/functional-tests/custom-code-helpers/domain-lock/templates/fixtures/prevailing-kind-of-variables-let.js
  97. 0 0
      test/functional-tests/custom-code-helpers/domain-lock/templates/fixtures/prevailing-kind-of-variables-var.js
  98. 3 3
      test/functional-tests/custom-code-helpers/string-array/StringArrayCallsWrapperCodeHelper.spec.ts
  99. 3 3
      test/functional-tests/custom-code-helpers/string-array/StringArrayCodeHelper.spec.ts
  100. 3 3
      test/functional-tests/custom-code-helpers/string-array/StringArrayRotateFunctionCodeHelper.spec.ts

文件差异内容过多而无法显示
+ 0 - 0
dist/index.browser.js


文件差异内容过多而无法显示
+ 0 - 0
dist/index.cli.js


文件差异内容过多而无法显示
+ 0 - 0
dist/index.js


+ 1 - 1
src/JavaScriptObfuscator.ts

@@ -54,7 +54,7 @@ export class JavaScriptObfuscator implements IJavaScriptObfuscator {
     private static readonly transformersList: NodeTransformer[] = [
     private static readonly transformersList: NodeTransformer[] = [
         NodeTransformer.BlockStatementControlFlowTransformer,
         NodeTransformer.BlockStatementControlFlowTransformer,
         NodeTransformer.CommentsTransformer,
         NodeTransformer.CommentsTransformer,
-        NodeTransformer.CustomNodesTransformer,
+        NodeTransformer.CustomCodeHelpersTransformer,
         NodeTransformer.DeadCodeInjectionTransformer,
         NodeTransformer.DeadCodeInjectionTransformer,
         NodeTransformer.EvalCallExpressionTransformer,
         NodeTransformer.EvalCallExpressionTransformer,
         NodeTransformer.FunctionControlFlowTransformer,
         NodeTransformer.FunctionControlFlowTransformer,

+ 2 - 0
src/container/InversifyContainerFacade.ts

@@ -4,6 +4,7 @@ import { ServiceIdentifiers } from './ServiceIdentifiers';
 import { analyzersModule } from './modules/analyzers/AnalyzersModule';
 import { analyzersModule } from './modules/analyzers/AnalyzersModule';
 import { controlFlowTransformersModule } from './modules/node-transformers/ControlFlowTransformersModule';
 import { controlFlowTransformersModule } from './modules/node-transformers/ControlFlowTransformersModule';
 import { convertingTransformersModule } from './modules/node-transformers/ConvertingTransformersModule';
 import { convertingTransformersModule } from './modules/node-transformers/ConvertingTransformersModule';
+import { customCodeHelpersModule } from './modules/custom-code-helpers/CustomCodeHelpersModule';
 import { customNodesModule } from './modules/custom-nodes/CustomNodesModule';
 import { customNodesModule } from './modules/custom-nodes/CustomNodesModule';
 import { finalizingTransformersModule } from './modules/node-transformers/FinalizingTransformersModule';
 import { finalizingTransformersModule } from './modules/node-transformers/FinalizingTransformersModule';
 import { generatorsModule } from './modules/generators/GeneratorsModule';
 import { generatorsModule } from './modules/generators/GeneratorsModule';
@@ -194,6 +195,7 @@ export class InversifyContainerFacade implements IInversifyContainerFacade {
         this.container.load(analyzersModule);
         this.container.load(analyzersModule);
         this.container.load(controlFlowTransformersModule);
         this.container.load(controlFlowTransformersModule);
         this.container.load(convertingTransformersModule);
         this.container.load(convertingTransformersModule);
+        this.container.load(customCodeHelpersModule);
         this.container.load(customNodesModule);
         this.container.load(customNodesModule);
         this.container.load(finalizingTransformersModule);
         this.container.load(finalizingTransformersModule);
         this.container.load(generatorsModule);
         this.container.load(generatorsModule);

+ 6 - 6
src/container/ServiceIdentifiers.ts

@@ -2,8 +2,8 @@ export enum ServiceIdentifiers {
     Factory__ICalleeDataExtractor = 'Factory<ICalleeDataExtractor>',
     Factory__ICalleeDataExtractor = 'Factory<ICalleeDataExtractor>',
     Factory__IControlFlowCustomNode = 'Factory<IControlFlowCustomNode>',
     Factory__IControlFlowCustomNode = 'Factory<IControlFlowCustomNode>',
     Factory__IControlFlowReplacer = 'Factory<IControlFlowReplacer>',
     Factory__IControlFlowReplacer = 'Factory<IControlFlowReplacer>',
-    Factory__ICustomNode = 'Factory<ICustomNode>',
-    Factory__ICustomNodeGroup = 'Factory<ICustomNodeGroup>',
+    Factory__ICustomCodeHelper = 'Factory<ICustomCodeHelper>',
+    Factory__ICustomCodeHelperGroup = 'Factory<ICustomCodeHelperGroup>',
     Factory__IDeadCodeInjectionCustomNode = 'Factory<IDeadCodeInjectionCustomNode>',
     Factory__IDeadCodeInjectionCustomNode = 'Factory<IDeadCodeInjectionCustomNode>',
     Factory__IIdentifierNamesGenerator = 'Factory<IIdentifierNamesGenerator>',
     Factory__IIdentifierNamesGenerator = 'Factory<IIdentifierNamesGenerator>',
     Factory__IIdentifierObfuscatingReplacer = 'Factory<IIdentifierObfuscatingReplacer>',
     Factory__IIdentifierObfuscatingReplacer = 'Factory<IIdentifierObfuscatingReplacer>',
@@ -18,11 +18,11 @@ export enum ServiceIdentifiers {
     ICalleeDataExtractor = 'ICalleeDataExtractor',
     ICalleeDataExtractor = 'ICalleeDataExtractor',
     ICallsGraphAnalyzer = 'ICallsGraphAnalyzer',
     ICallsGraphAnalyzer = 'ICallsGraphAnalyzer',
     ICryptUtils = 'ICryptUtils',
     ICryptUtils = 'ICryptUtils',
-    ICustomNode = 'ICustomNode',
-    ICustomNodeGroup = 'ICustomNodeGroup',
+    ICustomCodeHelper = 'ICustomCodeHelper',
+    ICustomCodeHelperGroup = 'ICustomCodeHelperGroup',
     IControlFlowReplacer = 'IControlFlowReplacer',
     IControlFlowReplacer = 'IControlFlowReplacer',
-    ICustomNodeFormatter = 'ICustomNodeFormatter',
-    ICustomNodeObfuscator = 'ICustomNodeObfuscator',
+    ICustomCodeHelperFormatter = 'ICustomCodeHelperFormatter',
+    ICustomCodeHelperObfuscator = 'ICustomCodeHelperObfuscator',
     IEscapeSequenceEncoder = 'IEscapeSequenceEncoder',
     IEscapeSequenceEncoder = 'IEscapeSequenceEncoder',
     IIdentifierNamesGenerator = 'IIdentifierNamesGenerator',
     IIdentifierNamesGenerator = 'IIdentifierNamesGenerator',
     IIdentifierObfuscatingReplacer = 'IIdentifierObfuscatingReplacer',
     IIdentifierObfuscatingReplacer = 'IIdentifierObfuscatingReplacer',

+ 114 - 0
src/container/modules/custom-code-helpers/CustomCodeHelpersModule.ts

@@ -0,0 +1,114 @@
+import { InversifyContainerFacade } from '../../InversifyContainerFacade';
+import { ContainerModule, interfaces } from 'inversify';
+import { ServiceIdentifiers } from '../../ServiceIdentifiers';
+
+import { ICustomCodeHelper } from '../../../interfaces/custom-code-helpers/ICustomCodeHelper';
+import { ICustomCodeHelperFormatter } from '../../../interfaces/custom-code-helpers/ICustomCodeHelperFormatter';
+import { ICustomCodeHelperGroup } from '../../../interfaces/custom-code-helpers/ICustomCodeHelperGroup';
+import { ICustomCodeHelperObfuscator } from '../../../interfaces/custom-code-helpers/ICustomCodeHelperObfuscator';
+
+import { CustomCodeHelper } from '../../../enums/custom-code-helpers/CustomCodeHelper';
+import { CustomCodeHelperGroup } from '../../../enums/custom-code-helpers/CustomCodeHelperGroup';
+
+import { ConsoleOutputCodeHelperGroup } from '../../../custom-code-helpers/console-output/group/ConsoleOutputCodeHelperGroup';
+import { DebugProtectionCodeHelperGroup } from '../../../custom-code-helpers/debug-protection/group/DebugProtectionCodeHelperGroup';
+import { DomainLockCustomCodeHelperGroup } from '../../../custom-code-helpers/domain-lock/group/DomainLockCustomCodeHelperGroup';
+import { SelfDefendingCodeHelperGroup } from '../../../custom-code-helpers/self-defending/group/SelfDefendingCodeHelperGroup';
+import { StringArrayCodeHelperGroup } from '../../../custom-code-helpers/string-array/group/StringArrayCodeHelperGroup';
+
+import { ConsoleOutputDisableExpressionCodeHelper } from '../../../custom-code-helpers/console-output/ConsoleOutputDisableExpressionCodeHelper';
+import { CustomCodeHelperFormatter } from '../../../custom-code-helpers/CustomCodeHelperFormatter';
+import { CustomCodeHelperObfuscator } from '../../../custom-code-helpers/CustomCodeHelperObfuscator';
+import { DebugProtectionFunctionCallCodeHelper } from '../../../custom-code-helpers/debug-protection/DebugProtectionFunctionCallCodeHelper';
+import { DebugProtectionFunctionIntervalCodeHelper } from '../../../custom-code-helpers/debug-protection/DebugProtectionFunctionIntervalCodeHelper';
+import { DebugProtectionFunctionCodeHelper } from '../../../custom-code-helpers/debug-protection/DebugProtectionFunctionCodeHelper';
+import { DomainLockCodeHelper } from '../../../custom-code-helpers/domain-lock/DomainLockCodeHelper';
+import { CallsControllerFunctionCodeHelper } from '../../../custom-code-helpers/calls-controller/CallsControllerFunctionCodeHelper';
+import { SelfDefendingUnicodeCodeHelper } from '../../../custom-code-helpers/self-defending/SelfDefendingUnicodeCodeHelper';
+import { StringArrayCallsWrapperCodeHelper } from '../../../custom-code-helpers/string-array/StringArrayCallsWrapperCodeHelper';
+import { StringArrayCodeHelper } from '../../../custom-code-helpers/string-array/StringArrayCodeHelper';
+import { StringArrayRotateFunctionCodeHelper } from '../../../custom-code-helpers/string-array/StringArrayRotateFunctionCodeHelper';
+
+export const customCodeHelpersModule: interfaces.ContainerModule = new ContainerModule((bind: interfaces.Bind) => {
+    // custom code helpers
+    bind<ICustomCodeHelper>(ServiceIdentifiers.ICustomCodeHelper)
+        .to(ConsoleOutputDisableExpressionCodeHelper)
+        .whenTargetNamed(CustomCodeHelper.ConsoleOutputDisableExpression);
+
+    bind<ICustomCodeHelper>(ServiceIdentifiers.ICustomCodeHelper)
+        .to(DebugProtectionFunctionCallCodeHelper)
+        .whenTargetNamed(CustomCodeHelper.DebugProtectionFunctionCall);
+
+    bind<ICustomCodeHelper>(ServiceIdentifiers.ICustomCodeHelper)
+        .to(DebugProtectionFunctionIntervalCodeHelper)
+        .whenTargetNamed(CustomCodeHelper.DebugProtectionFunctionInterval);
+
+    bind<ICustomCodeHelper>(ServiceIdentifiers.ICustomCodeHelper)
+        .to(DebugProtectionFunctionCodeHelper)
+        .whenTargetNamed(CustomCodeHelper.DebugProtectionFunction);
+
+    bind<ICustomCodeHelper>(ServiceIdentifiers.ICustomCodeHelper)
+        .to(DomainLockCodeHelper)
+        .whenTargetNamed(CustomCodeHelper.DomainLock);
+
+    bind<ICustomCodeHelper>(ServiceIdentifiers.ICustomCodeHelper)
+        .to(CallsControllerFunctionCodeHelper)
+        .whenTargetNamed(CustomCodeHelper.CallsControllerFunction);
+
+    bind<ICustomCodeHelper>(ServiceIdentifiers.ICustomCodeHelper)
+        .to(SelfDefendingUnicodeCodeHelper)
+        .whenTargetNamed(CustomCodeHelper.SelfDefendingUnicode);
+
+    bind<ICustomCodeHelper>(ServiceIdentifiers.ICustomCodeHelper)
+        .to(StringArrayCallsWrapperCodeHelper)
+        .whenTargetNamed(CustomCodeHelper.StringArrayCallsWrapper);
+
+    bind<ICustomCodeHelper>(ServiceIdentifiers.ICustomCodeHelper)
+        .to(StringArrayCodeHelper)
+        .whenTargetNamed(CustomCodeHelper.StringArray);
+
+    bind<ICustomCodeHelper>(ServiceIdentifiers.ICustomCodeHelper)
+        .to(StringArrayRotateFunctionCodeHelper)
+        .whenTargetNamed(CustomCodeHelper.StringArrayRotateFunction);
+
+    // code helper groups
+    bind<ICustomCodeHelperGroup>(ServiceIdentifiers.ICustomCodeHelperGroup)
+        .to(ConsoleOutputCodeHelperGroup)
+        .whenTargetNamed(CustomCodeHelperGroup.ConsoleOutput);
+
+    bind<ICustomCodeHelperGroup>(ServiceIdentifiers.ICustomCodeHelperGroup)
+        .to(DebugProtectionCodeHelperGroup)
+        .whenTargetNamed(CustomCodeHelperGroup.DebugProtection);
+
+    bind<ICustomCodeHelperGroup>(ServiceIdentifiers.ICustomCodeHelperGroup)
+        .to(DomainLockCustomCodeHelperGroup)
+        .whenTargetNamed(CustomCodeHelperGroup.DomainLock);
+
+    bind<ICustomCodeHelperGroup>(ServiceIdentifiers.ICustomCodeHelperGroup)
+        .to(SelfDefendingCodeHelperGroup)
+        .whenTargetNamed(CustomCodeHelperGroup.SelfDefending);
+
+    bind<ICustomCodeHelperGroup>(ServiceIdentifiers.ICustomCodeHelperGroup)
+        .to(StringArrayCodeHelperGroup)
+        .whenTargetNamed(CustomCodeHelperGroup.StringArray);
+
+    // customCodeHelper factory
+    bind<ICustomCodeHelper>(ServiceIdentifiers.Factory__ICustomCodeHelper)
+        .toFactory<ICustomCodeHelper>(InversifyContainerFacade
+            .getFactory<CustomCodeHelper, ICustomCodeHelper>(ServiceIdentifiers.ICustomCodeHelper));
+
+    // customCodeHelperGroup factory
+    bind<ICustomCodeHelperGroup>(ServiceIdentifiers.Factory__ICustomCodeHelperGroup)
+        .toFactory<ICustomCodeHelperGroup>(InversifyContainerFacade
+            .getFactory<CustomCodeHelperGroup, ICustomCodeHelperGroup>(ServiceIdentifiers.ICustomCodeHelperGroup));
+
+    // custom code helper formatter
+    bind<ICustomCodeHelperFormatter>(ServiceIdentifiers.ICustomCodeHelperFormatter)
+        .to(CustomCodeHelperFormatter)
+        .inSingletonScope();
+
+    // custom code helper obfuscator
+    bind<ICustomCodeHelperObfuscator>(ServiceIdentifiers.ICustomCodeHelperObfuscator)
+        .to(CustomCodeHelperObfuscator)
+        .inSingletonScope();
+});

+ 3 - 111
src/container/modules/custom-nodes/CustomNodesModule.ts

@@ -3,21 +3,11 @@ import { ContainerModule, interfaces } from 'inversify';
 import { ServiceIdentifiers } from '../../ServiceIdentifiers';
 import { ServiceIdentifiers } from '../../ServiceIdentifiers';
 
 
 import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
 import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
-import { ICustomNodeFormatter } from '../../../interfaces/custom-nodes/ICustomNodeFormatter';
-import { ICustomNodeGroup } from '../../../interfaces/custom-nodes/ICustomNodeGroup';
 
 
 import { ControlFlowCustomNode } from '../../../enums/custom-nodes/ControlFlowCustomNode';
 import { ControlFlowCustomNode } from '../../../enums/custom-nodes/ControlFlowCustomNode';
-import { CustomNode } from '../../../enums/custom-nodes/CustomNode';
-import { CustomNodeGroup } from '../../../enums/custom-nodes/CustomNodeGroup';
 import { DeadCodeInjectionCustomNode } from '../../../enums/custom-nodes/DeadCodeInjectionCustomNode';
 import { DeadCodeInjectionCustomNode } from '../../../enums/custom-nodes/DeadCodeInjectionCustomNode';
 import { ObjectExpressionKeysTransformerCustomNode } from '../../../enums/custom-nodes/ObjectExpressionKeysTransformerCustomNode';
 import { ObjectExpressionKeysTransformerCustomNode } from '../../../enums/custom-nodes/ObjectExpressionKeysTransformerCustomNode';
 
 
-import { ConsoleOutputCustomNodeGroup } from '../../../custom-nodes/console-output-nodes/group/ConsoleOutputCustomNodeGroup';
-import { DebugProtectionCustomNodeGroup } from '../../../custom-nodes/debug-protection-nodes/group/DebugProtectionCustomNodeGroup';
-import { DomainLockCustomNodeGroup } from '../../../custom-nodes/domain-lock-nodes/group/DomainLockCustomNodeGroup';
-import { SelfDefendingCustomNodeGroup } from '../../../custom-nodes/self-defending-nodes/group/SelfDefendingCustomNodeGroup';
-import { StringArrayCustomNodeGroup } from '../../../custom-nodes/string-array-nodes/group/StringArrayCustomNodeGroup';
-
 import { ObjectExpressionVariableDeclarationHostNode } from '../../../custom-nodes/object-expression-keys-transformer-nodes/ObjectExpressionVariableDeclarationHostNode';
 import { ObjectExpressionVariableDeclarationHostNode } from '../../../custom-nodes/object-expression-keys-transformer-nodes/ObjectExpressionVariableDeclarationHostNode';
 import { BinaryExpressionFunctionNode } from '../../../custom-nodes/control-flow-flattening-nodes/BinaryExpressionFunctionNode';
 import { BinaryExpressionFunctionNode } from '../../../custom-nodes/control-flow-flattening-nodes/BinaryExpressionFunctionNode';
 import { BlockStatementControlFlowFlatteningNode } from '../../../custom-nodes/control-flow-flattening-nodes/BlockStatementControlFlowFlatteningNode';
 import { BlockStatementControlFlowFlatteningNode } from '../../../custom-nodes/control-flow-flattening-nodes/BlockStatementControlFlowFlatteningNode';
@@ -25,66 +15,12 @@ import { BlockStatementDeadCodeInjectionNode } from '../../../custom-nodes/dead-
 import { CallExpressionControlFlowStorageCallNode } from '../../../custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/CallExpressionControlFlowStorageCallNode';
 import { CallExpressionControlFlowStorageCallNode } from '../../../custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/CallExpressionControlFlowStorageCallNode';
 import { CallExpressionFunctionNode } from '../../../custom-nodes/control-flow-flattening-nodes/CallExpressionFunctionNode';
 import { CallExpressionFunctionNode } from '../../../custom-nodes/control-flow-flattening-nodes/CallExpressionFunctionNode';
 import { ControlFlowStorageNode } from '../../../custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ControlFlowStorageNode';
 import { ControlFlowStorageNode } from '../../../custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ControlFlowStorageNode';
-import { ConsoleOutputDisableExpressionNode } from '../../../custom-nodes/console-output-nodes/ConsoleOutputDisableExpressionNode';
-import { CustomNodeFormatter } from '../../../custom-nodes/CustomNodeFormatter';
-import { DebugProtectionFunctionCallNode } from '../../../custom-nodes/debug-protection-nodes/DebugProtectionFunctionCallNode';
-import { DebugProtectionFunctionIntervalNode } from '../../../custom-nodes/debug-protection-nodes/DebugProtectionFunctionIntervalNode';
-import { DebugProtectionFunctionNode } from '../../../custom-nodes/debug-protection-nodes/DebugProtectionFunctionNode';
-import { DomainLockNode } from '../../../custom-nodes/domain-lock-nodes/DomainLockNode';
 import { ExpressionWithOperatorControlFlowStorageCallNode } from '../../../custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ExpressionWithOperatorControlFlowStorageCallNode';
 import { ExpressionWithOperatorControlFlowStorageCallNode } from '../../../custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ExpressionWithOperatorControlFlowStorageCallNode';
 import { LogicalExpressionFunctionNode } from '../../../custom-nodes/control-flow-flattening-nodes/LogicalExpressionFunctionNode';
 import { LogicalExpressionFunctionNode } from '../../../custom-nodes/control-flow-flattening-nodes/LogicalExpressionFunctionNode';
-import { NodeCallsControllerFunctionNode } from '../../../custom-nodes/node-calls-controller-nodes/NodeCallsControllerFunctionNode';
-import { SelfDefendingUnicodeNode } from '../../../custom-nodes/self-defending-nodes/SelfDefendingUnicodeNode';
-import { StringArrayCallsWrapper } from '../../../custom-nodes/string-array-nodes/StringArrayCallsWrapper';
-import { StringArrayNode } from '../../../custom-nodes/string-array-nodes/StringArrayNode';
-import { StringArrayRotateFunctionNode } from '../../../custom-nodes/string-array-nodes/StringArrayRotateFunctionNode';
 import { StringLiteralControlFlowStorageCallNode } from '../../../custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/StringLiteralControlFlowStorageCallNode';
 import { StringLiteralControlFlowStorageCallNode } from '../../../custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/StringLiteralControlFlowStorageCallNode';
 import { StringLiteralNode } from '../../../custom-nodes/control-flow-flattening-nodes/StringLiteralNode';
 import { StringLiteralNode } from '../../../custom-nodes/control-flow-flattening-nodes/StringLiteralNode';
-import { ICustomNodeObfuscator } from '../../../interfaces/custom-nodes/ICustomNodeObfuscator';
-import { CustomNodeObfuscator } from '../../../custom-nodes/CustomNodeObfuscator';
 
 
 export const customNodesModule: interfaces.ContainerModule = new ContainerModule((bind: interfaces.Bind) => {
 export const customNodesModule: interfaces.ContainerModule = new ContainerModule((bind: interfaces.Bind) => {
-    // custom nodes
-    bind<ICustomNode>(ServiceIdentifiers.ICustomNode)
-        .to(ConsoleOutputDisableExpressionNode)
-        .whenTargetNamed(CustomNode.ConsoleOutputDisableExpressionNode);
-
-    bind<ICustomNode>(ServiceIdentifiers.ICustomNode)
-        .to(DebugProtectionFunctionCallNode)
-        .whenTargetNamed(CustomNode.DebugProtectionFunctionCallNode);
-
-    bind<ICustomNode>(ServiceIdentifiers.ICustomNode)
-        .to(DebugProtectionFunctionIntervalNode)
-        .whenTargetNamed(CustomNode.DebugProtectionFunctionIntervalNode);
-
-    bind<ICustomNode>(ServiceIdentifiers.ICustomNode)
-        .to(DebugProtectionFunctionNode)
-        .whenTargetNamed(CustomNode.DebugProtectionFunctionNode);
-
-    bind<ICustomNode>(ServiceIdentifiers.ICustomNode)
-        .to(DomainLockNode)
-        .whenTargetNamed(CustomNode.DomainLockNode);
-
-    bind<ICustomNode>(ServiceIdentifiers.ICustomNode)
-        .to(NodeCallsControllerFunctionNode)
-        .whenTargetNamed(CustomNode.NodeCallsControllerFunctionNode);
-
-    bind<ICustomNode>(ServiceIdentifiers.ICustomNode)
-        .to(SelfDefendingUnicodeNode)
-        .whenTargetNamed(CustomNode.SelfDefendingUnicodeNode);
-
-    bind<ICustomNode>(ServiceIdentifiers.ICustomNode)
-        .to(StringArrayCallsWrapper)
-        .whenTargetNamed(CustomNode.StringArrayCallsWrapper);
-
-    bind<ICustomNode>(ServiceIdentifiers.ICustomNode)
-        .to(StringArrayNode)
-        .whenTargetNamed(CustomNode.StringArrayNode);
-
-    bind<ICustomNode>(ServiceIdentifiers.ICustomNode)
-        .to(StringArrayRotateFunctionNode)
-        .whenTargetNamed(CustomNode.StringArrayRotateFunctionNode);
-
     // control flow custom nodes
     // control flow custom nodes
     bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.Newable__ICustomNode)
     bind<interfaces.Newable<ICustomNode>>(ServiceIdentifiers.Newable__ICustomNode)
         .toConstructor(BinaryExpressionFunctionNode)
         .toConstructor(BinaryExpressionFunctionNode)
@@ -132,40 +68,13 @@ export const customNodesModule: interfaces.ContainerModule = new ContainerModule
         .toConstructor(ObjectExpressionVariableDeclarationHostNode)
         .toConstructor(ObjectExpressionVariableDeclarationHostNode)
         .whenTargetNamed(ObjectExpressionKeysTransformerCustomNode.ObjectExpressionVariableDeclarationHostNode);
         .whenTargetNamed(ObjectExpressionKeysTransformerCustomNode.ObjectExpressionVariableDeclarationHostNode);
 
 
-    // node groups
-    bind<ICustomNodeGroup>(ServiceIdentifiers.ICustomNodeGroup)
-        .to(ConsoleOutputCustomNodeGroup)
-        .whenTargetNamed(CustomNodeGroup.ConsoleOutputCustomNodeGroup);
-
-    bind<ICustomNodeGroup>(ServiceIdentifiers.ICustomNodeGroup)
-        .to(DebugProtectionCustomNodeGroup)
-        .whenTargetNamed(CustomNodeGroup.DebugProtectionCustomNodeGroup);
-
-    bind<ICustomNodeGroup>(ServiceIdentifiers.ICustomNodeGroup)
-        .to(DomainLockCustomNodeGroup)
-        .whenTargetNamed(CustomNodeGroup.DomainLockCustomNodeGroup);
-
-    bind<ICustomNodeGroup>(ServiceIdentifiers.ICustomNodeGroup)
-        .to(SelfDefendingCustomNodeGroup)
-        .whenTargetNamed(CustomNodeGroup.SelfDefendingCustomNodeGroup);
-
-    bind<ICustomNodeGroup>(ServiceIdentifiers.ICustomNodeGroup)
-        .to(StringArrayCustomNodeGroup)
-        .whenTargetNamed(CustomNodeGroup.StringArrayCustomNodeGroup);
-
-    // customNode factory
-    bind<ICustomNode>(ServiceIdentifiers.Factory__ICustomNode)
-        .toFactory<ICustomNode>(InversifyContainerFacade
-            .getFactory<CustomNode, ICustomNode>(ServiceIdentifiers.ICustomNode));
-
     // control flow customNode constructor factory
     // control flow customNode constructor factory
     bind<ICustomNode>(ServiceIdentifiers.Factory__IControlFlowCustomNode)
     bind<ICustomNode>(ServiceIdentifiers.Factory__IControlFlowCustomNode)
         .toFactory<ICustomNode>(InversifyContainerFacade
         .toFactory<ICustomNode>(InversifyContainerFacade
             .getConstructorFactory<ControlFlowCustomNode, ICustomNode>(
             .getConstructorFactory<ControlFlowCustomNode, ICustomNode>(
                 ServiceIdentifiers.Newable__ICustomNode,
                 ServiceIdentifiers.Newable__ICustomNode,
                 ServiceIdentifiers.Factory__IIdentifierNamesGenerator,
                 ServiceIdentifiers.Factory__IIdentifierNamesGenerator,
-                ServiceIdentifiers.ICustomNodeFormatter,
-                ServiceIdentifiers.ICustomNodeObfuscator,
+                ServiceIdentifiers.ICustomCodeHelperFormatter,
                 ServiceIdentifiers.IRandomGenerator,
                 ServiceIdentifiers.IRandomGenerator,
                 ServiceIdentifiers.IOptions,
                 ServiceIdentifiers.IOptions,
                 ServiceIdentifiers.IPrevailingKindOfVariablesAnalyzer
                 ServiceIdentifiers.IPrevailingKindOfVariablesAnalyzer
@@ -177,8 +86,7 @@ export const customNodesModule: interfaces.ContainerModule = new ContainerModule
             .getConstructorFactory<DeadCodeInjectionCustomNode, ICustomNode>(
             .getConstructorFactory<DeadCodeInjectionCustomNode, ICustomNode>(
                 ServiceIdentifiers.Newable__ICustomNode,
                 ServiceIdentifiers.Newable__ICustomNode,
                 ServiceIdentifiers.Factory__IIdentifierNamesGenerator,
                 ServiceIdentifiers.Factory__IIdentifierNamesGenerator,
-                ServiceIdentifiers.ICustomNodeFormatter,
-                ServiceIdentifiers.ICustomNodeObfuscator,
+                ServiceIdentifiers.ICustomCodeHelperFormatter,
                 ServiceIdentifiers.IRandomGenerator,
                 ServiceIdentifiers.IRandomGenerator,
                 ServiceIdentifiers.IOptions
                 ServiceIdentifiers.IOptions
             ));
             ));
@@ -189,25 +97,9 @@ export const customNodesModule: interfaces.ContainerModule = new ContainerModule
             .getConstructorFactory<ObjectExpressionKeysTransformerCustomNode, ICustomNode>(
             .getConstructorFactory<ObjectExpressionKeysTransformerCustomNode, ICustomNode>(
                 ServiceIdentifiers.Newable__ICustomNode,
                 ServiceIdentifiers.Newable__ICustomNode,
                 ServiceIdentifiers.Factory__IIdentifierNamesGenerator,
                 ServiceIdentifiers.Factory__IIdentifierNamesGenerator,
-                ServiceIdentifiers.ICustomNodeFormatter,
-                ServiceIdentifiers.ICustomNodeObfuscator,
+                ServiceIdentifiers.ICustomCodeHelperFormatter,
                 ServiceIdentifiers.IRandomGenerator,
                 ServiceIdentifiers.IRandomGenerator,
                 ServiceIdentifiers.IOptions,
                 ServiceIdentifiers.IOptions,
                 ServiceIdentifiers.IPrevailingKindOfVariablesAnalyzer
                 ServiceIdentifiers.IPrevailingKindOfVariablesAnalyzer
             ));
             ));
-
-    // customNodeGroup factory
-    bind<ICustomNodeGroup>(ServiceIdentifiers.Factory__ICustomNodeGroup)
-        .toFactory<ICustomNodeGroup>(InversifyContainerFacade
-            .getFactory<CustomNodeGroup, ICustomNodeGroup>(ServiceIdentifiers.ICustomNodeGroup));
-
-    // custom node formatter
-    bind<ICustomNodeFormatter>(ServiceIdentifiers.ICustomNodeFormatter)
-        .to(CustomNodeFormatter)
-        .inSingletonScope();
-
-    // custom node obfuscator
-    bind<ICustomNodeObfuscator>(ServiceIdentifiers.ICustomNodeObfuscator)
-        .to(CustomNodeObfuscator)
-        .inSingletonScope();
 });
 });

+ 3 - 3
src/container/modules/node-transformers/PreparingTransformersModule.ts

@@ -11,7 +11,7 @@ import { ObfuscatingGuard } from '../../../enums/node-transformers/preparing-tra
 import { BlackListObfuscatingGuard } from '../../../node-transformers/preparing-transformers/obfuscating-guards/BlackListObfuscatingGuard';
 import { BlackListObfuscatingGuard } from '../../../node-transformers/preparing-transformers/obfuscating-guards/BlackListObfuscatingGuard';
 import { CommentsTransformer } from '../../../node-transformers/preparing-transformers/CommentsTransformer';
 import { CommentsTransformer } from '../../../node-transformers/preparing-transformers/CommentsTransformer';
 import { ConditionalCommentObfuscatingGuard } from '../../../node-transformers/preparing-transformers/obfuscating-guards/ConditionalCommentObfuscatingGuard';
 import { ConditionalCommentObfuscatingGuard } from '../../../node-transformers/preparing-transformers/obfuscating-guards/ConditionalCommentObfuscatingGuard';
-import { CustomNodesTransformer } from '../../../node-transformers/preparing-transformers/CustomNodesTransformer';
+import { CustomCodeHelpersTransformer } from '../../../node-transformers/preparing-transformers/CustomCodeHelpersTransformer';
 import { EvalCallExpressionTransformer } from '../../../node-transformers/preparing-transformers/EvalCallExpressionTransformer';
 import { EvalCallExpressionTransformer } from '../../../node-transformers/preparing-transformers/EvalCallExpressionTransformer';
 import { MetadataTransformer } from '../../../node-transformers/preparing-transformers/MetadataTransformer';
 import { MetadataTransformer } from '../../../node-transformers/preparing-transformers/MetadataTransformer';
 import { ObfuscatingGuardsTransformer } from '../../../node-transformers/preparing-transformers/ObfuscatingGuardsTransformer';
 import { ObfuscatingGuardsTransformer } from '../../../node-transformers/preparing-transformers/ObfuscatingGuardsTransformer';
@@ -26,8 +26,8 @@ export const preparingTransformersModule: interfaces.ContainerModule = new Conta
         .whenTargetNamed(NodeTransformer.CommentsTransformer);
         .whenTargetNamed(NodeTransformer.CommentsTransformer);
 
 
     bind<INodeTransformer>(ServiceIdentifiers.INodeTransformer)
     bind<INodeTransformer>(ServiceIdentifiers.INodeTransformer)
-        .to(CustomNodesTransformer)
-        .whenTargetNamed(NodeTransformer.CustomNodesTransformer);
+        .to(CustomCodeHelpersTransformer)
+        .whenTargetNamed(NodeTransformer.CustomCodeHelpersTransformer);
 
 
     bind<INodeTransformer>(ServiceIdentifiers.INodeTransformer)
     bind<INodeTransformer>(ServiceIdentifiers.INodeTransformer)
         .to(EvalCallExpressionTransformer)
         .to(EvalCallExpressionTransformer)

+ 5 - 5
src/container/modules/storages/StoragesModule.ts

@@ -2,20 +2,20 @@ import { ContainerModule, interfaces } from 'inversify';
 import { ServiceIdentifiers } from '../../ServiceIdentifiers';
 import { ServiceIdentifiers } from '../../ServiceIdentifiers';
 
 
 import { TControlFlowStorage } from '../../../types/storages/TControlFlowStorage';
 import { TControlFlowStorage } from '../../../types/storages/TControlFlowStorage';
-import { TCustomNodeGroupStorage } from '../../../types/storages/TCustomNodeGroupStorage';
+import { TCustomCodeHelperGroupStorage } from '../../../types/storages/TCustomCodeHelperGroupStorage';
 
 
 import { IOptions } from '../../../interfaces/options/IOptions';
 import { IOptions } from '../../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../../interfaces/utils/IRandomGenerator';
 import { IRandomGenerator } from '../../../interfaces/utils/IRandomGenerator';
 import { IStringArrayStorage } from '../../../interfaces/storages/string-array-storage/IStringArrayStorage';
 import { IStringArrayStorage } from '../../../interfaces/storages/string-array-storage/IStringArrayStorage';
 
 
-import { ControlFlowStorage } from '../../../storages/control-flow/ControlFlowStorage';
-import { CustomNodeGroupStorage } from '../../../storages/custom-node-group/CustomNodeGroupStorage';
+import { ControlFlowStorage } from '../../../storages/custom-nodes/ControlFlowStorage';
+import { CustomCodeHelperGroupStorage } from '../../../storages/custom-code-helpers/CustomCodeHelperGroupStorage';
 import { StringArrayStorage } from '../../../storages/string-array/StringArrayStorage';
 import { StringArrayStorage } from '../../../storages/string-array/StringArrayStorage';
 
 
 export const storagesModule: interfaces.ContainerModule = new ContainerModule((bind: interfaces.Bind) => {
 export const storagesModule: interfaces.ContainerModule = new ContainerModule((bind: interfaces.Bind) => {
     // storages
     // storages
-    bind<TCustomNodeGroupStorage>(ServiceIdentifiers.TCustomNodeGroupStorage)
-        .to(CustomNodeGroupStorage)
+    bind<TCustomCodeHelperGroupStorage>(ServiceIdentifiers.TCustomNodeGroupStorage)
+        .to(CustomCodeHelperGroupStorage)
         .inSingletonScope();
         .inSingletonScope();
 
 
     bind<IStringArrayStorage>(ServiceIdentifiers.IStringArrayStorage)
     bind<IStringArrayStorage>(ServiceIdentifiers.IStringArrayStorage)

+ 121 - 0
src/custom-code-helpers/AbstractCustomCodeHelper.ts

@@ -0,0 +1,121 @@
+import { inject, injectable } from 'inversify';
+import { ServiceIdentifiers } from '../container/ServiceIdentifiers';
+
+import { TIdentifierNamesGeneratorFactory } from '../types/container/generators/TIdentifierNamesGeneratorFactory';
+import { TStatement } from '../types/node/TStatement';
+
+import { ICustomCodeHelper } from '../interfaces/custom-code-helpers/ICustomCodeHelper';
+import { ICustomCodeHelperFormatter } from '../interfaces/custom-code-helpers/ICustomCodeHelperFormatter';
+import { ICustomCodeHelperObfuscator } from '../interfaces/custom-code-helpers/ICustomCodeHelperObfuscator';
+import { IIdentifierNamesGenerator } from '../interfaces/generators/identifier-names-generators/IIdentifierNamesGenerator';
+import { IOptions } from '../interfaces/options/IOptions';
+import { IRandomGenerator } from '../interfaces/utils/IRandomGenerator';
+
+import { GlobalVariableTemplate1 } from './common/templates/GlobalVariableTemplate1';
+import { GlobalVariableTemplate2 } from './common/templates/GlobalVariableTemplate2';
+
+@injectable()
+export abstract class AbstractCustomCodeHelper <
+    TInitialData extends any[] = any[]
+> implements ICustomCodeHelper <TInitialData> {
+    /**
+     * @type {string[]}
+     */
+    private static readonly globalVariableTemplateFunctions: string[] = [
+        GlobalVariableTemplate1(),
+        GlobalVariableTemplate2()
+    ];
+
+    /**
+     * @type {TStatement[] | null}
+     */
+    protected cachedNode: TStatement[] | null = null;
+
+    /**
+     * @type {ICustomCodeHelperFormatter}
+     */
+    protected readonly customCodeHelperFormatter: ICustomCodeHelperFormatter;
+
+    /**
+     * @type {ICustomCodeHelperObfuscator}
+     */
+    protected readonly customCodeHelperObfuscator: ICustomCodeHelperObfuscator;
+
+    /**
+     * @type {IIdentifierNamesGenerator}
+     */
+    protected readonly identifierNamesGenerator: IIdentifierNamesGenerator;
+
+    /**
+     * @type {IOptions}
+     */
+    protected readonly options: IOptions;
+
+    /**
+     * @type {IRandomGenerator}
+     */
+    protected readonly randomGenerator: IRandomGenerator;
+
+    /**
+     * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
+     * @param {ICustomCodeHelperFormatter} customCodeHelperFormatter
+     * @param {ICustomCodeHelperObfuscator} customCodeHelperObfuscator
+     * @param {IRandomGenerator} randomGenerator
+     * @param {IOptions} options
+     */
+    protected constructor (
+        @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
+            identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
+        @inject(ServiceIdentifiers.ICustomCodeHelperFormatter) customCodeHelperFormatter: ICustomCodeHelperFormatter,
+        @inject(ServiceIdentifiers.ICustomCodeHelperObfuscator) customCodeHelperObfuscator: ICustomCodeHelperObfuscator,
+        @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
+        @inject(ServiceIdentifiers.IOptions) options: IOptions
+    ) {
+        this.identifierNamesGenerator = identifierNamesGeneratorFactory(options);
+        this.customCodeHelperFormatter = customCodeHelperFormatter;
+        this.customCodeHelperObfuscator = customCodeHelperObfuscator;
+        this.randomGenerator = randomGenerator;
+        this.options = options;
+    }
+
+    /**
+     * @returns {TStatement[]}
+     */
+    public getNode (): TStatement[] {
+        if (!this.cachedNode) {
+            const codeHelperTemplate: string = this.getCodeHelperTemplate();
+
+            this.cachedNode = this.customCodeHelperFormatter.formatStructure(
+                this.getNodeStructure(codeHelperTemplate)
+            );
+        }
+
+        return this.cachedNode;
+    }
+
+    /**
+     * @returns {string}
+     */
+    protected getGlobalVariableTemplate (): string {
+        return this.randomGenerator
+            .getRandomGenerator()
+            .pickone(AbstractCustomCodeHelper.globalVariableTemplateFunctions);
+    }
+
+    /**
+     * @returns {string}
+     */
+    protected getCodeHelperTemplate (): string {
+        return '';
+    }
+
+    /**
+     * @param {TInitialData} args
+     */
+    public abstract initialize (...args: TInitialData): void;
+
+    /**
+     * @returns {TStatement[]}
+     */
+    protected abstract getNodeStructure (codeHelperTemplate: string): TStatement[];
+}

+ 16 - 15
src/custom-nodes/AbstractCustomNodeGroup.ts → src/custom-code-helpers/AbstractCustomCodeHelperGroup.ts

@@ -5,17 +5,17 @@ import { TIdentifierNamesGeneratorFactory } from '../types/container/generators/
 import { TNodeWithStatements } from '../types/node/TNodeWithStatements';
 import { TNodeWithStatements } from '../types/node/TNodeWithStatements';
 
 
 import { ICallsGraphData } from '../interfaces/analyzers/calls-graph-analyzer/ICallsGraphData';
 import { ICallsGraphData } from '../interfaces/analyzers/calls-graph-analyzer/ICallsGraphData';
-import { ICustomNode } from '../interfaces/custom-nodes/ICustomNode';
-import { ICustomNodeGroup } from '../interfaces/custom-nodes/ICustomNodeGroup';
+import { ICustomCodeHelper } from '../interfaces/custom-code-helpers/ICustomCodeHelper';
+import { ICustomCodeHelperGroup } from '../interfaces/custom-code-helpers/ICustomCodeHelperGroup';
 import { IIdentifierNamesGenerator } from '../interfaces/generators/identifier-names-generators/IIdentifierNamesGenerator';
 import { IIdentifierNamesGenerator } from '../interfaces/generators/identifier-names-generators/IIdentifierNamesGenerator';
 import { IOptions } from '../interfaces/options/IOptions';
 import { IOptions } from '../interfaces/options/IOptions';
 import { IRandomGenerator } from '../interfaces/utils/IRandomGenerator';
 import { IRandomGenerator } from '../interfaces/utils/IRandomGenerator';
 
 
-import { CustomNode } from '../enums/custom-nodes/CustomNode';
+import { CustomCodeHelper } from '../enums/custom-code-helpers/CustomCodeHelper';
 import { ObfuscationEvent } from '../enums/event-emitters/ObfuscationEvent';
 import { ObfuscationEvent } from '../enums/event-emitters/ObfuscationEvent';
 
 
 @injectable()
 @injectable()
-export abstract class AbstractCustomNodeGroup implements ICustomNodeGroup {
+export abstract class AbstractCustomCodeHelperGroup implements ICustomCodeHelperGroup {
     /**
     /**
      * @type {IIdentifierNamesGenerator}
      * @type {IIdentifierNamesGenerator}
      */
      */
@@ -37,9 +37,9 @@ export abstract class AbstractCustomNodeGroup implements ICustomNodeGroup {
     protected abstract readonly appendEvent: ObfuscationEvent;
     protected abstract readonly appendEvent: ObfuscationEvent;
 
 
     /**
     /**
-     * @type {Map<CustomNode, ICustomNode>}
+     * @type {Map<CustomCodeHelper, ICustomCodeHelper>}
      */
      */
-    protected abstract customNodes: Map <CustomNode, ICustomNode>;
+    protected abstract customCodeHelpers: Map <CustomCodeHelper, ICustomCodeHelper>;
 
 
     /**
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
@@ -65,30 +65,31 @@ export abstract class AbstractCustomNodeGroup implements ICustomNodeGroup {
     }
     }
 
 
     /**
     /**
-     * @returns {Map<CustomNode, ICustomNode>}
+     * @returns {Map<CustomCodeHelper, ICustomCodeHelper>}
      */
      */
-    public getCustomNodes (): Map <CustomNode, ICustomNode> {
-        return this.customNodes;
+    public getCustomCodeHelpers (): Map <CustomCodeHelper, ICustomCodeHelper> {
+        return this.customCodeHelpers;
     }
     }
 
 
     /**
     /**
-     * @param {CustomNode} customNodeName
+     * @param {CustomCodeHelper} customCodeHelperName
      * @param {callback} callback
      * @param {callback} callback
      */
      */
-    protected appendCustomNodeIfExist (customNodeName: CustomNode, callback: (customNode: ICustomNode) => void): void {
-        const customNode: ICustomNode | undefined = this.customNodes.get(customNodeName);
+    protected appendCustomNodeIfExist (customCodeHelperName: CustomCodeHelper, callback: (customCodeHelper: ICustomCodeHelper) => void): void {
+        const customCodeHelper: ICustomCodeHelper | undefined = this.customCodeHelpers.get(customCodeHelperName);
 
 
-        if (!customNode) {
+        if (!customCodeHelper) {
             return;
             return;
         }
         }
 
 
-        callback(customNode);
+        callback(customCodeHelper);
     }
     }
 
 
     /**
     /**
      * @param {number} callsGraphLength
      * @param {number} callsGraphLength
      * @returns {number}
      * @returns {number}
      */
      */
+
     protected getRandomCallsGraphIndex (callsGraphLength: number): number {
     protected getRandomCallsGraphIndex (callsGraphLength: number): number {
         return this.randomGenerator.getRandomInteger(0, Math.max(0, Math.round(callsGraphLength - 1)));
         return this.randomGenerator.getRandomInteger(0, Math.max(0, Math.round(callsGraphLength - 1)));
     }
     }
@@ -97,7 +98,7 @@ export abstract class AbstractCustomNodeGroup implements ICustomNodeGroup {
      * @param {TNodeWithStatements} nodeWithStatements
      * @param {TNodeWithStatements} nodeWithStatements
      * @param {ICallsGraphData[]} callsGraphData
      * @param {ICallsGraphData[]} callsGraphData
      */
      */
-    public abstract appendCustomNodes (nodeWithStatements: TNodeWithStatements, callsGraphData: ICallsGraphData[]): void;
+    public abstract appendNodes (nodeWithStatements: TNodeWithStatements, callsGraphData: ICallsGraphData[]): void;
 
 
     public abstract initialize (): void;
     public abstract initialize (): void;
 }
 }

+ 2 - 2
src/custom-nodes/CustomNodeFormatter.ts → src/custom-code-helpers/CustomCodeHelperFormatter.ts

@@ -8,13 +8,13 @@ import format from 'string-template';
 import { TObject } from '../types/TObject';
 import { TObject } from '../types/TObject';
 import { TStatement } from '../types/node/TStatement';
 import { TStatement } from '../types/node/TStatement';
 
 
-import { ICustomNodeFormatter } from '../interfaces/custom-nodes/ICustomNodeFormatter';
+import { ICustomCodeHelperFormatter } from '../interfaces/custom-code-helpers/ICustomCodeHelperFormatter';
 import { IPrevailingKindOfVariablesAnalyzer } from '../interfaces/analyzers/calls-graph-analyzer/IPrevailingKindOfVariablesAnalyzer';
 import { IPrevailingKindOfVariablesAnalyzer } from '../interfaces/analyzers/calls-graph-analyzer/IPrevailingKindOfVariablesAnalyzer';
 
 
 import { NodeGuards } from '../node/NodeGuards';
 import { NodeGuards } from '../node/NodeGuards';
 
 
 @injectable()
 @injectable()
-export class CustomNodeFormatter implements ICustomNodeFormatter {
+export class CustomCodeHelperFormatter implements ICustomCodeHelperFormatter {
     /**
     /**
      * @type {ESTree.VariableDeclaration['kind']}
      * @type {ESTree.VariableDeclaration['kind']}
      */
      */

+ 2 - 2
src/custom-nodes/CustomNodeObfuscator.ts → src/custom-code-helpers/CustomCodeHelperObfuscator.ts

@@ -3,7 +3,7 @@ import { ServiceIdentifiers } from '../container/ServiceIdentifiers';
 
 
 import { TInputOptions } from '../types/options/TInputOptions';
 import { TInputOptions } from '../types/options/TInputOptions';
 
 
-import { ICustomNodeObfuscator } from '../interfaces/custom-nodes/ICustomNodeObfuscator';
+import { ICustomCodeHelperObfuscator } from '../interfaces/custom-code-helpers/ICustomCodeHelperObfuscator';
 import { IOptions } from '../interfaces/options/IOptions';
 import { IOptions } from '../interfaces/options/IOptions';
 import { IRandomGenerator } from '../interfaces/utils/IRandomGenerator';
 import { IRandomGenerator } from '../interfaces/utils/IRandomGenerator';
 
 
@@ -12,7 +12,7 @@ import { NO_ADDITIONAL_NODES_PRESET } from '../options/presets/NoCustomNodes';
 import { JavaScriptObfuscator } from '../JavaScriptObfuscatorFacade';
 import { JavaScriptObfuscator } from '../JavaScriptObfuscatorFacade';
 
 
 @injectable()
 @injectable()
-export class CustomNodeObfuscator implements ICustomNodeObfuscator {
+export class CustomCodeHelperObfuscator implements ICustomCodeHelperObfuscator {
     /**
     /**
      * @type {IOptions}
      * @type {IOptions}
      */
      */

+ 17 - 17
src/custom-nodes/node-calls-controller-nodes/NodeCallsControllerFunctionNode.ts → src/custom-code-helpers/calls-controller/CallsControllerFunctionCodeHelper.ts

@@ -4,8 +4,8 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TStatement } from '../../types/node/TStatement';
 import { TStatement } from '../../types/node/TStatement';
 
 
-import { ICustomNodeObfuscator } from '../../interfaces/custom-nodes/ICustomNodeObfuscator';
-import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
+import { ICustomCodeHelperObfuscator } from '../../interfaces/custom-code-helpers/ICustomCodeHelperObfuscator';
+import { ICustomCodeHelperFormatter } from '../../interfaces/custom-code-helpers/ICustomCodeHelperFormatter';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
 
 
@@ -15,11 +15,11 @@ import { initializable } from '../../decorators/Initializable';
 
 
 import { SingleNodeCallControllerTemplate } from '../common/templates/SingleNodeCallControllerTemplate';
 import { SingleNodeCallControllerTemplate } from '../common/templates/SingleNodeCallControllerTemplate';
 
 
-import { AbstractCustomNode } from '../AbstractCustomNode';
+import { AbstractCustomCodeHelper } from '../AbstractCustomCodeHelper';
 import { NodeUtils } from '../../node/NodeUtils';
 import { NodeUtils } from '../../node/NodeUtils';
 
 
 @injectable()
 @injectable()
-export class NodeCallsControllerFunctionNode extends AbstractCustomNode {
+export class CallsControllerFunctionCodeHelper extends AbstractCustomCodeHelper {
     /**
     /**
      * @type {string}
      * @type {string}
      */
      */
@@ -34,23 +34,23 @@ export class NodeCallsControllerFunctionNode extends AbstractCustomNode {
 
 
     /**
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
-     * @param {ICustomNodeFormatter} customNodeFormatter
-     * @param {ICustomNodeObfuscator} customNodeObfuscator
+     * @param {ICustomCodeHelperFormatter} customCodeHelperFormatter
+     * @param {ICustomCodeHelperObfuscator} customCodeHelperObfuscator
      * @param {IRandomGenerator} randomGenerator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      * @param {IOptions} options
      */
      */
     public constructor (
     public constructor (
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
-        @inject(ServiceIdentifiers.ICustomNodeFormatter) customNodeFormatter: ICustomNodeFormatter,
-        @inject(ServiceIdentifiers.ICustomNodeObfuscator) customNodeObfuscator: ICustomNodeObfuscator,
+        @inject(ServiceIdentifiers.ICustomCodeHelperFormatter) customCodeHelperFormatter: ICustomCodeHelperFormatter,
+        @inject(ServiceIdentifiers.ICustomCodeHelperObfuscator) customCodeHelperObfuscator: ICustomCodeHelperObfuscator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
     ) {
         super(
         super(
             identifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory,
-            customNodeFormatter,
-            customNodeObfuscator,
+            customCodeHelperFormatter,
+            customCodeHelperObfuscator,
             randomGenerator,
             randomGenerator,
             options
             options
         );
         );
@@ -66,26 +66,26 @@ export class NodeCallsControllerFunctionNode extends AbstractCustomNode {
     }
     }
 
 
     /**
     /**
-     * @param {string} nodeTemplate
+     * @param {string} codeHelperTemplate
      * @returns {TStatement[]}
      * @returns {TStatement[]}
      */
      */
-    protected getNodeStructure (nodeTemplate: string): TStatement[] {
-        return NodeUtils.convertCodeToStructure(nodeTemplate);
+    protected getNodeStructure (codeHelperTemplate: string): TStatement[] {
+        return NodeUtils.convertCodeToStructure(codeHelperTemplate);
     }
     }
 
 
     /**
     /**
      * @returns {string}
      * @returns {string}
      */
      */
-    protected getNodeTemplate (): string {
+    protected getCodeHelperTemplate (): string {
         if (this.appendEvent === ObfuscationEvent.AfterObfuscation) {
         if (this.appendEvent === ObfuscationEvent.AfterObfuscation) {
-            return this.customNodeObfuscator.obfuscateTemplate(
-                this.customNodeFormatter.formatTemplate(SingleNodeCallControllerTemplate(), {
+            return this.customCodeHelperObfuscator.obfuscateTemplate(
+                this.customCodeHelperFormatter.formatTemplate(SingleNodeCallControllerTemplate(), {
                     singleNodeCallControllerFunctionName: this.callsControllerFunctionName
                     singleNodeCallControllerFunctionName: this.callsControllerFunctionName
                 })
                 })
             );
             );
         }
         }
 
 
-        return this.customNodeFormatter.formatTemplate(SingleNodeCallControllerTemplate(), {
+        return this.customCodeHelperFormatter.formatTemplate(SingleNodeCallControllerTemplate(), {
             singleNodeCallControllerFunctionName: this.callsControllerFunctionName
             singleNodeCallControllerFunctionName: this.callsControllerFunctionName
         });
         });
     }
     }

+ 0 - 0
src/custom-nodes/common/templates/GlobalVariableNoEvalTemplate.ts → src/custom-code-helpers/common/templates/GlobalVariableNoEvalTemplate.ts


+ 0 - 0
src/custom-nodes/common/templates/GlobalVariableTemplate1.ts → src/custom-code-helpers/common/templates/GlobalVariableTemplate1.ts


+ 0 - 0
src/custom-nodes/common/templates/GlobalVariableTemplate2.ts → src/custom-code-helpers/common/templates/GlobalVariableTemplate2.ts


+ 0 - 0
src/custom-nodes/common/templates/SingleNodeCallControllerTemplate.ts → src/custom-code-helpers/common/templates/SingleNodeCallControllerTemplate.ts


+ 15 - 15
src/custom-nodes/console-output-nodes/ConsoleOutputDisableExpressionNode.ts → src/custom-code-helpers/console-output/ConsoleOutputDisableExpressionCodeHelper.ts

@@ -4,8 +4,8 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TStatement } from '../../types/node/TStatement';
 import { TStatement } from '../../types/node/TStatement';
 
 
-import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
-import { ICustomNodeObfuscator } from '../../interfaces/custom-nodes/ICustomNodeObfuscator';
+import { ICustomCodeHelperFormatter } from '../../interfaces/custom-code-helpers/ICustomCodeHelperFormatter';
+import { ICustomCodeHelperObfuscator } from '../../interfaces/custom-code-helpers/ICustomCodeHelperObfuscator';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
 
 
@@ -16,11 +16,11 @@ import { GlobalVariableNoEvalTemplate } from '../common/templates/GlobalVariable
 
 
 import { initializable } from '../../decorators/Initializable';
 import { initializable } from '../../decorators/Initializable';
 
 
-import { AbstractCustomNode } from '../AbstractCustomNode';
+import { AbstractCustomCodeHelper } from '../AbstractCustomCodeHelper';
 import { NodeUtils } from '../../node/NodeUtils';
 import { NodeUtils } from '../../node/NodeUtils';
 
 
 @injectable()
 @injectable()
-export class ConsoleOutputDisableExpressionNode extends AbstractCustomNode {
+export class ConsoleOutputDisableExpressionCodeHelper extends AbstractCustomCodeHelper {
     /**
     /**
      * @type {string}
      * @type {string}
      */
      */
@@ -29,23 +29,23 @@ export class ConsoleOutputDisableExpressionNode extends AbstractCustomNode {
 
 
     /**
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
-     * @param {ICustomNodeFormatter} customNodeFormatter
-     * @param {ICustomNodeObfuscator} customNodeObfuscator
+     * @param {ICustomCodeHelperFormatter} customCodeHelperFormatter
+     * @param {ICustomCodeHelperObfuscator} customCodeHelperObfuscator
      * @param {IRandomGenerator} randomGenerator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      * @param {IOptions} options
      */
      */
     public constructor (
     public constructor (
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
-        @inject(ServiceIdentifiers.ICustomNodeFormatter) customNodeFormatter: ICustomNodeFormatter,
-        @inject(ServiceIdentifiers.ICustomNodeObfuscator) customNodeObfuscator: ICustomNodeObfuscator,
+        @inject(ServiceIdentifiers.ICustomCodeHelperFormatter) customCodeHelperFormatter: ICustomCodeHelperFormatter,
+        @inject(ServiceIdentifiers.ICustomCodeHelperObfuscator) customCodeHelperObfuscator: ICustomCodeHelperObfuscator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
     ) {
         super(
         super(
             identifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory,
-            customNodeFormatter,
-            customNodeObfuscator,
+            customCodeHelperFormatter,
+            customCodeHelperObfuscator,
             randomGenerator,
             randomGenerator,
             options
             options
         );
         );
@@ -59,22 +59,22 @@ export class ConsoleOutputDisableExpressionNode extends AbstractCustomNode {
     }
     }
 
 
     /**
     /**
-     * @param {string} nodeTemplate
+     * @param {string} codeHelperTemplate
      * @returns {TStatement[]}
      * @returns {TStatement[]}
      */
      */
-    protected getNodeStructure (nodeTemplate: string): TStatement[] {
-        return NodeUtils.convertCodeToStructure(nodeTemplate);
+    protected getNodeStructure (codeHelperTemplate: string): TStatement[] {
+        return NodeUtils.convertCodeToStructure(codeHelperTemplate);
     }
     }
 
 
     /**
     /**
      * @returns {string}
      * @returns {string}
      */
      */
-    protected getNodeTemplate (): string {
+    protected getCodeHelperTemplate (): string {
         const globalVariableTemplate: string = this.options.target !== ObfuscationTarget.BrowserNoEval
         const globalVariableTemplate: string = this.options.target !== ObfuscationTarget.BrowserNoEval
             ? this.getGlobalVariableTemplate()
             ? this.getGlobalVariableTemplate()
             : GlobalVariableNoEvalTemplate();
             : GlobalVariableNoEvalTemplate();
 
 
-        return this.customNodeFormatter.formatTemplate(ConsoleOutputDisableExpressionTemplate(), {
+        return this.customCodeHelperFormatter.formatTemplate(ConsoleOutputDisableExpressionTemplate(), {
             consoleLogDisableFunctionName: this.identifierNamesGenerator.generate(),
             consoleLogDisableFunctionName: this.identifierNamesGenerator.generate(),
             globalVariableTemplate,
             globalVariableTemplate,
             singleNodeCallControllerFunctionName: this.callsControllerFunctionName
             singleNodeCallControllerFunctionName: this.callsControllerFunctionName

+ 107 - 0
src/custom-code-helpers/console-output/group/ConsoleOutputCodeHelperGroup.ts

@@ -0,0 +1,107 @@
+import { inject, injectable, } from 'inversify';
+import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
+
+import { TCustomCodeHelperFactory } from '../../../types/container/custom-code-helpers/TCustomCodeHelperFactory';
+import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory';
+import { TInitialData } from '../../../types/TInitialData';
+import { TNodeWithStatements } from '../../../types/node/TNodeWithStatements';
+
+import { ICustomCodeHelper } from '../../../interfaces/custom-code-helpers/ICustomCodeHelper';
+import { IOptions } from '../../../interfaces/options/IOptions';
+import { IRandomGenerator } from '../../../interfaces/utils/IRandomGenerator';
+import { ICallsGraphData } from '../../../interfaces/analyzers/calls-graph-analyzer/ICallsGraphData';
+
+import { initializable } from '../../../decorators/Initializable';
+
+import { CustomCodeHelper } from '../../../enums/custom-code-helpers/CustomCodeHelper';
+import { ObfuscationEvent } from '../../../enums/event-emitters/ObfuscationEvent';
+
+import { AbstractCustomCodeHelperGroup } from '../../AbstractCustomCodeHelperGroup';
+import { ConsoleOutputDisableExpressionCodeHelper } from '../ConsoleOutputDisableExpressionCodeHelper';
+import { NodeAppender } from '../../../node/NodeAppender';
+import { CallsControllerFunctionCodeHelper } from '../../calls-controller/CallsControllerFunctionCodeHelper';
+
+@injectable()
+export class ConsoleOutputCodeHelperGroup extends AbstractCustomCodeHelperGroup {
+    /**
+     * @type {ObfuscationEvent}
+     */
+    protected readonly appendEvent: ObfuscationEvent = ObfuscationEvent.BeforeObfuscation;
+
+    /**
+     * @type {Map<CustomCodeHelper, ICustomCodeHelper>}
+     */
+    @initializable()
+    protected customCodeHelpers!: Map <CustomCodeHelper, ICustomCodeHelper>;
+
+    /**
+     * @type {TCustomCodeHelperFactory}
+     */
+    private readonly customCodeHelperFactory: TCustomCodeHelperFactory;
+
+    /**
+     * @param {TCustomCodeHelperFactory} customCodeHelperFactory
+     * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
+     * @param {IRandomGenerator} randomGenerator
+     * @param {IOptions} options
+     */
+    public constructor (
+        @inject(ServiceIdentifiers.Factory__ICustomCodeHelper) customCodeHelperFactory: TCustomCodeHelperFactory,
+        @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
+            identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
+        @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
+        @inject(ServiceIdentifiers.IOptions) options: IOptions
+    ) {
+        super(identifierNamesGeneratorFactory, randomGenerator, options);
+
+        this.customCodeHelperFactory = customCodeHelperFactory;
+    }
+
+    /**
+     * @param {TNodeWithStatements} nodeWithStatements
+     * @param {ICallsGraphData[]} callsGraphData
+     */
+    public appendNodes (nodeWithStatements: TNodeWithStatements, callsGraphData: ICallsGraphData[]): void {
+        const randomCallsGraphIndex: number = this.getRandomCallsGraphIndex(callsGraphData.length);
+
+        // consoleOutputDisableExpression helper nodes append
+        this.appendCustomNodeIfExist(CustomCodeHelper.ConsoleOutputDisableExpression, (customCodeHelper: ICustomCodeHelper) => {
+            NodeAppender.appendToOptimalBlockScope(
+                callsGraphData,
+                nodeWithStatements,
+                customCodeHelper.getNode(),
+                randomCallsGraphIndex
+            );
+        });
+
+        // nodeCallsControllerFunction helper nodes append
+        this.appendCustomNodeIfExist(CustomCodeHelper.CallsControllerFunction, (customCodeHelper: ICustomCodeHelper) => {
+            const targetNodeWithStatements: TNodeWithStatements = callsGraphData.length
+                ? NodeAppender.getOptimalBlockScope(callsGraphData, randomCallsGraphIndex, 1)
+                : nodeWithStatements;
+
+            NodeAppender.prepend(targetNodeWithStatements, customCodeHelper.getNode());
+        });
+    }
+
+    public initialize (): void {
+        this.customCodeHelpers = new Map <CustomCodeHelper, ICustomCodeHelper>();
+
+        if (!this.options.disableConsoleOutput) {
+            return;
+        }
+
+        const callsControllerFunctionName: string = this.identifierNamesGenerator.generate();
+
+        const consoleOutputDisableExpressionCodeHelper: ICustomCodeHelper<TInitialData<ConsoleOutputDisableExpressionCodeHelper>> =
+            this.customCodeHelperFactory(CustomCodeHelper.ConsoleOutputDisableExpression);
+        const nodeCallsControllerFunctionCodeHelper: ICustomCodeHelper<TInitialData<CallsControllerFunctionCodeHelper>> =
+            this.customCodeHelperFactory(CustomCodeHelper.CallsControllerFunction);
+
+        consoleOutputDisableExpressionCodeHelper.initialize(callsControllerFunctionName);
+        nodeCallsControllerFunctionCodeHelper.initialize(this.appendEvent, callsControllerFunctionName);
+
+        this.customCodeHelpers.set(CustomCodeHelper.ConsoleOutputDisableExpression, consoleOutputDisableExpressionCodeHelper);
+        this.customCodeHelpers.set(CustomCodeHelper.CallsControllerFunction, nodeCallsControllerFunctionCodeHelper);
+    }
+}

+ 0 - 0
src/custom-nodes/console-output-nodes/templates/ConsoleOutputDisableExpressionTemplate.ts → src/custom-code-helpers/console-output/templates/ConsoleOutputDisableExpressionTemplate.ts


+ 16 - 16
src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionCallNode.ts → src/custom-code-helpers/debug-protection/DebugProtectionFunctionCallCodeHelper.ts

@@ -4,20 +4,20 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TStatement } from '../../types/node/TStatement';
 import { TStatement } from '../../types/node/TStatement';
 
 
-import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
-import { ICustomNodeObfuscator } from '../../interfaces/custom-nodes/ICustomNodeObfuscator';
+import { ICustomCodeHelperFormatter } from '../../interfaces/custom-code-helpers/ICustomCodeHelperFormatter';
+import { ICustomCodeHelperObfuscator } from '../../interfaces/custom-code-helpers/ICustomCodeHelperObfuscator';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
 
 
 import { initializable } from '../../decorators/Initializable';
 import { initializable } from '../../decorators/Initializable';
 
 
-import { DebugProtectionFunctionCallTemplate } from './templates/debug-protection-function-call-node/DebugProtectionFunctionCallTemplate';
+import { DebugProtectionFunctionCallTemplate } from './templates/debug-protection-function-call/DebugProtectionFunctionCallTemplate';
 
 
-import { AbstractCustomNode } from '../AbstractCustomNode';
+import { AbstractCustomCodeHelper } from '../AbstractCustomCodeHelper';
 import { NodeUtils } from '../../node/NodeUtils';
 import { NodeUtils } from '../../node/NodeUtils';
 
 
 @injectable()
 @injectable()
-export class DebugProtectionFunctionCallNode extends AbstractCustomNode {
+export class DebugProtectionFunctionCallCodeHelper extends AbstractCustomCodeHelper {
     /**
     /**
      * @type {string}
      * @type {string}
      */
      */
@@ -32,23 +32,23 @@ export class DebugProtectionFunctionCallNode extends AbstractCustomNode {
 
 
     /**
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
-     * @param {ICustomNodeFormatter} customNodeFormatter
-     * @param {ICustomNodeObfuscator} customNodeObfuscator
+     * @param {ICustomCodeHelperFormatter} customCodeHelperFormatter
+     * @param {ICustomCodeHelperObfuscator} customCodeHelperObfuscator
      * @param {IRandomGenerator} randomGenerator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      * @param {IOptions} options
      */
      */
     public constructor (
     public constructor (
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
-        @inject(ServiceIdentifiers.ICustomNodeFormatter) customNodeFormatter: ICustomNodeFormatter,
-        @inject(ServiceIdentifiers.ICustomNodeObfuscator) customNodeObfuscator: ICustomNodeObfuscator,
+        @inject(ServiceIdentifiers.ICustomCodeHelperFormatter) customCodeHelperFormatter: ICustomCodeHelperFormatter,
+        @inject(ServiceIdentifiers.ICustomCodeHelperObfuscator) customCodeHelperObfuscator: ICustomCodeHelperObfuscator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
     ) {
         super(
         super(
             identifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory,
-            customNodeFormatter,
-            customNodeObfuscator,
+            customCodeHelperFormatter,
+            customCodeHelperObfuscator,
             randomGenerator,
             randomGenerator,
             options
             options
         );
         );
@@ -64,18 +64,18 @@ export class DebugProtectionFunctionCallNode extends AbstractCustomNode {
     }
     }
 
 
     /**
     /**
-     * @param {string} nodeTemplate
+     * @param {string} codeHelperTemplate
      * @returns {TStatement[]}
      * @returns {TStatement[]}
      */
      */
-    protected getNodeStructure (nodeTemplate: string): TStatement[] {
-        return NodeUtils.convertCodeToStructure(nodeTemplate);
+    protected getNodeStructure (codeHelperTemplate: string): TStatement[] {
+        return NodeUtils.convertCodeToStructure(codeHelperTemplate);
     }
     }
 
 
     /**
     /**
      * @returns {string}
      * @returns {string}
      */
      */
-    protected getNodeTemplate (): string {
-        return this.customNodeFormatter.formatTemplate(DebugProtectionFunctionCallTemplate(), {
+    protected getCodeHelperTemplate (): string {
+        return this.customCodeHelperFormatter.formatTemplate(DebugProtectionFunctionCallTemplate(), {
             debugProtectionFunctionName: this.debugProtectionFunctionName,
             debugProtectionFunctionName: this.debugProtectionFunctionName,
             singleNodeCallControllerFunctionName: this.callsControllerFunctionName
             singleNodeCallControllerFunctionName: this.callsControllerFunctionName
         });
         });

+ 18 - 18
src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionNode.ts → src/custom-code-helpers/debug-protection/DebugProtectionFunctionCodeHelper.ts

@@ -4,8 +4,8 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TStatement } from '../../types/node/TStatement';
 import { TStatement } from '../../types/node/TStatement';
 
 
-import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
-import { ICustomNodeObfuscator } from '../../interfaces/custom-nodes/ICustomNodeObfuscator';
+import { ICustomCodeHelperFormatter } from '../../interfaces/custom-code-helpers/ICustomCodeHelperFormatter';
+import { ICustomCodeHelperObfuscator } from '../../interfaces/custom-code-helpers/ICustomCodeHelperObfuscator';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
 
 
@@ -13,15 +13,15 @@ import { ObfuscationTarget } from '../../enums/ObfuscationTarget';
 
 
 import { initializable } from '../../decorators/Initializable';
 import { initializable } from '../../decorators/Initializable';
 
 
-import { DebuggerTemplate } from './templates/debug-protection-function-node/DebuggerTemplate';
-import { DebuggerTemplateNoEval } from './templates/debug-protection-function-node/DebuggerTemplateNoEval';
-import { DebugProtectionFunctionTemplate } from './templates/debug-protection-function-node/DebugProtectionFunctionTemplate';
+import { DebuggerTemplate } from './templates/debug-protection-function/DebuggerTemplate';
+import { DebuggerTemplateNoEval } from './templates/debug-protection-function/DebuggerTemplateNoEval';
+import { DebugProtectionFunctionTemplate } from './templates/debug-protection-function/DebugProtectionFunctionTemplate';
 
 
-import { AbstractCustomNode } from '../AbstractCustomNode';
+import { AbstractCustomCodeHelper } from '../AbstractCustomCodeHelper';
 import { NodeUtils } from '../../node/NodeUtils';
 import { NodeUtils } from '../../node/NodeUtils';
 
 
 @injectable()
 @injectable()
-export class DebugProtectionFunctionNode extends AbstractCustomNode {
+export class DebugProtectionFunctionCodeHelper extends AbstractCustomCodeHelper {
     /**
     /**
      * @type {string}
      * @type {string}
      */
      */
@@ -30,23 +30,23 @@ export class DebugProtectionFunctionNode extends AbstractCustomNode {
 
 
     /**
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
-     * @param {ICustomNodeFormatter} customNodeFormatter
-     * @param {ICustomNodeObfuscator} customNodeObfuscator
+     * @param {ICustomCodeHelperFormatter} customCodeHelperFormatter
+     * @param {ICustomCodeHelperObfuscator} customCodeHelperObfuscator
      * @param {IRandomGenerator} randomGenerator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      * @param {IOptions} options
      */
      */
     public constructor (
     public constructor (
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
-        @inject(ServiceIdentifiers.ICustomNodeFormatter) customNodeFormatter: ICustomNodeFormatter,
-        @inject(ServiceIdentifiers.ICustomNodeObfuscator) customNodeObfuscator: ICustomNodeObfuscator,
+        @inject(ServiceIdentifiers.ICustomCodeHelperFormatter) customCodeHelperFormatter: ICustomCodeHelperFormatter,
+        @inject(ServiceIdentifiers.ICustomCodeHelperObfuscator) customCodeHelperObfuscator: ICustomCodeHelperObfuscator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
     ) {
         super(
         super(
             identifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory,
-            customNodeFormatter,
-            customNodeObfuscator,
+            customCodeHelperFormatter,
+            customCodeHelperObfuscator,
             randomGenerator,
             randomGenerator,
             options
             options
         );
         );
@@ -60,22 +60,22 @@ export class DebugProtectionFunctionNode extends AbstractCustomNode {
     }
     }
 
 
     /**
     /**
-     * @param {string} nodeTemplate
+     * @param {string} codeHelperTemplate
      * @returns {TStatement[]}
      * @returns {TStatement[]}
      */
      */
-    protected getNodeStructure (nodeTemplate: string): TStatement[] {
-        return NodeUtils.convertCodeToStructure(nodeTemplate);
+    protected getNodeStructure (codeHelperTemplate: string): TStatement[] {
+        return NodeUtils.convertCodeToStructure(codeHelperTemplate);
     }
     }
 
 
     /**
     /**
      * @returns {string}
      * @returns {string}
      */
      */
-    protected getNodeTemplate (): string {
+    protected getCodeHelperTemplate (): string {
         const debuggerTemplate: string = this.options.target !== ObfuscationTarget.BrowserNoEval
         const debuggerTemplate: string = this.options.target !== ObfuscationTarget.BrowserNoEval
             ? DebuggerTemplate()
             ? DebuggerTemplate()
             : DebuggerTemplateNoEval();
             : DebuggerTemplateNoEval();
 
 
-        return this.customNodeFormatter.formatTemplate(DebugProtectionFunctionTemplate(), {
+        return this.customCodeHelperFormatter.formatTemplate(DebugProtectionFunctionTemplate(), {
             debuggerTemplate,
             debuggerTemplate,
             debugProtectionFunctionName: this.debugProtectionFunctionName
             debugProtectionFunctionName: this.debugProtectionFunctionName
         });
         });

+ 16 - 16
src/custom-nodes/debug-protection-nodes/DebugProtectionFunctionIntervalNode.ts → src/custom-code-helpers/debug-protection/DebugProtectionFunctionIntervalCodeHelper.ts

@@ -4,20 +4,20 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TStatement } from '../../types/node/TStatement';
 import { TStatement } from '../../types/node/TStatement';
 
 
-import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
-import { ICustomNodeObfuscator } from '../../interfaces/custom-nodes/ICustomNodeObfuscator';
+import { ICustomCodeHelperFormatter } from '../../interfaces/custom-code-helpers/ICustomCodeHelperFormatter';
+import { ICustomCodeHelperObfuscator } from '../../interfaces/custom-code-helpers/ICustomCodeHelperObfuscator';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
 
 
 import { initializable } from '../../decorators/Initializable';
 import { initializable } from '../../decorators/Initializable';
 
 
-import { DebugProtectionFunctionIntervalTemplate } from './templates/debug-protection-function-interval-node/DebugProtectionFunctionIntervalTemplate';
+import { DebugProtectionFunctionIntervalTemplate } from './templates/debug-protection-function-interval/DebugProtectionFunctionIntervalTemplate';
 
 
-import { AbstractCustomNode } from '../AbstractCustomNode';
+import { AbstractCustomCodeHelper } from '../AbstractCustomCodeHelper';
 import { NodeUtils } from '../../node/NodeUtils';
 import { NodeUtils } from '../../node/NodeUtils';
 
 
 @injectable()
 @injectable()
-export class DebugProtectionFunctionIntervalNode extends AbstractCustomNode {
+export class DebugProtectionFunctionIntervalCodeHelper extends AbstractCustomCodeHelper {
     /**
     /**
      * @type {string}
      * @type {string}
      */
      */
@@ -26,23 +26,23 @@ export class DebugProtectionFunctionIntervalNode extends AbstractCustomNode {
 
 
     /**
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
-     * @param {ICustomNodeFormatter} customNodeFormatter
-     * @param {ICustomNodeObfuscator} customNodeObfuscator
+     * @param {ICustomCodeHelperFormatter} customCodeHelperFormatter
+     * @param {ICustomCodeHelperObfuscator} customCodeHelperObfuscator
      * @param {IRandomGenerator} randomGenerator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      * @param {IOptions} options
      */
      */
     public constructor (
     public constructor (
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
-        @inject(ServiceIdentifiers.ICustomNodeFormatter) customNodeFormatter: ICustomNodeFormatter,
-        @inject(ServiceIdentifiers.ICustomNodeObfuscator) customNodeObfuscator: ICustomNodeObfuscator,
+        @inject(ServiceIdentifiers.ICustomCodeHelperFormatter) customCodeHelperFormatter: ICustomCodeHelperFormatter,
+        @inject(ServiceIdentifiers.ICustomCodeHelperObfuscator) customCodeHelperObfuscator: ICustomCodeHelperObfuscator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
     ) {
         super(
         super(
             identifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory,
-            customNodeFormatter,
-            customNodeObfuscator,
+            customCodeHelperFormatter,
+            customCodeHelperObfuscator,
             randomGenerator,
             randomGenerator,
             options
             options
         );
         );
@@ -56,18 +56,18 @@ export class DebugProtectionFunctionIntervalNode extends AbstractCustomNode {
     }
     }
 
 
     /**
     /**
-     * @param {string} nodeTemplate
+     * @param {string} codeHelperTemplate
      * @returns {TStatement[]}
      * @returns {TStatement[]}
      */
      */
-    protected getNodeStructure (nodeTemplate: string): TStatement[] {
-        return NodeUtils.convertCodeToStructure(nodeTemplate);
+    protected getNodeStructure (codeHelperTemplate: string): TStatement[] {
+        return NodeUtils.convertCodeToStructure(codeHelperTemplate);
     }
     }
 
 
     /**
     /**
      * @returns {string}
      * @returns {string}
      */
      */
-    protected getNodeTemplate (): string {
-        return this.customNodeFormatter.formatTemplate(DebugProtectionFunctionIntervalTemplate(), {
+    protected getCodeHelperTemplate (): string {
+        return this.customCodeHelperFormatter.formatTemplate(DebugProtectionFunctionIntervalTemplate(), {
             debugProtectionFunctionName: this.debugProtectionFunctionName
             debugProtectionFunctionName: this.debugProtectionFunctionName
         });
         });
     }
     }

+ 138 - 0
src/custom-code-helpers/debug-protection/group/DebugProtectionCodeHelperGroup.ts

@@ -0,0 +1,138 @@
+import { inject, injectable, } from 'inversify';
+import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
+
+import { TCustomCodeHelperFactory } from '../../../types/container/custom-code-helpers/TCustomCodeHelperFactory';
+import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory';
+import { TInitialData } from '../../../types/TInitialData';
+import { TNodeWithStatements } from '../../../types/node/TNodeWithStatements';
+
+import { ICustomCodeHelper } from '../../../interfaces/custom-code-helpers/ICustomCodeHelper';
+import { IOptions } from '../../../interfaces/options/IOptions';
+import { IRandomGenerator } from '../../../interfaces/utils/IRandomGenerator';
+import { ICallsGraphData } from '../../../interfaces/analyzers/calls-graph-analyzer/ICallsGraphData';
+
+import { initializable } from '../../../decorators/Initializable';
+
+import { CustomCodeHelper } from '../../../enums/custom-code-helpers/CustomCodeHelper';
+import { ObfuscationEvent } from '../../../enums/event-emitters/ObfuscationEvent';
+
+import { AbstractCustomCodeHelperGroup } from '../../AbstractCustomCodeHelperGroup';
+import { DebugProtectionFunctionCodeHelper } from '../DebugProtectionFunctionCodeHelper';
+import { DebugProtectionFunctionCallCodeHelper } from '../DebugProtectionFunctionCallCodeHelper';
+import { DebugProtectionFunctionIntervalCodeHelper } from '../DebugProtectionFunctionIntervalCodeHelper';
+import { NodeAppender } from '../../../node/NodeAppender';
+import { CallsControllerFunctionCodeHelper } from '../../calls-controller/CallsControllerFunctionCodeHelper';
+import { NodeGuards } from '../../../node/NodeGuards';
+
+@injectable()
+export class DebugProtectionCodeHelperGroup extends AbstractCustomCodeHelperGroup {
+    /**
+     * @type {ObfuscationEvent}
+     */
+    protected readonly appendEvent: ObfuscationEvent = ObfuscationEvent.BeforeObfuscation;
+
+    /**
+     * @type {Map<CustomCodeHelper, ICustomCodeHelper>}
+     */
+    @initializable()
+    protected customCodeHelpers!: Map <CustomCodeHelper, ICustomCodeHelper>;
+
+    /**
+     * @type {TCustomCodeHelperFactory}
+     */
+    private readonly customCodeHelperFactory: TCustomCodeHelperFactory;
+
+    /**
+     * @param {TCustomCodeHelperFactory} customCodeHelperFactory
+     * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
+     * @param {IRandomGenerator} randomGenerator
+     * @param {IOptions} options
+     */
+    public constructor (
+        @inject(ServiceIdentifiers.Factory__ICustomCodeHelper) customCodeHelperFactory: TCustomCodeHelperFactory,
+        @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
+            identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
+        @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
+        @inject(ServiceIdentifiers.IOptions) options: IOptions
+    ) {
+        super(identifierNamesGeneratorFactory, randomGenerator, options);
+
+        this.customCodeHelperFactory = customCodeHelperFactory;
+    }
+
+    /**
+     * @param {TNodeWithStatements} nodeWithStatements
+     * @param {ICallsGraphData[]} callsGraphData
+     */
+    public appendNodes (nodeWithStatements: TNodeWithStatements, callsGraphData: ICallsGraphData[]): void {
+        const randomCallsGraphIndex: number = this.getRandomCallsGraphIndex(callsGraphData.length);
+
+        // debugProtectionFunctionCall helper nodes append
+        this.appendCustomNodeIfExist(CustomCodeHelper.DebugProtectionFunctionCall, (customCodeHelper: ICustomCodeHelper) => {
+            NodeAppender.appendToOptimalBlockScope(
+                callsGraphData,
+                nodeWithStatements,
+                customCodeHelper.getNode(),
+                randomCallsGraphIndex
+            );
+        });
+
+        // debugProtectionFunction helper nodes append
+        this.appendCustomNodeIfExist(CustomCodeHelper.DebugProtectionFunction, (customCodeHelper: ICustomCodeHelper) => {
+            NodeAppender.append(nodeWithStatements, customCodeHelper.getNode());
+        });
+
+        // debugProtectionFunctionInterval helper nodes append
+        this.appendCustomNodeIfExist(CustomCodeHelper.DebugProtectionFunctionInterval, (customCodeHelper: ICustomCodeHelper) => {
+            const programBodyLength: number = NodeGuards.isSwitchCaseNode(nodeWithStatements)
+                ? nodeWithStatements.consequent.length
+                : nodeWithStatements.body.length;
+            const randomIndex: number = this.randomGenerator.getRandomInteger(0, programBodyLength);
+
+            NodeAppender.insertAtIndex(nodeWithStatements, customCodeHelper.getNode(), randomIndex);
+        });
+
+        // nodeCallsControllerFunctionNode append
+        this.appendCustomNodeIfExist(CustomCodeHelper.CallsControllerFunction, (customCodeHelper: ICustomCodeHelper) => {
+            const targetNodeWithStatements: TNodeWithStatements = callsGraphData.length
+                ? NodeAppender.getOptimalBlockScope(callsGraphData, randomCallsGraphIndex, 1)
+                : nodeWithStatements;
+
+            NodeAppender.prepend(targetNodeWithStatements, customCodeHelper.getNode());
+        });
+    }
+
+    public initialize (): void {
+        this.customCodeHelpers = new Map <CustomCodeHelper, ICustomCodeHelper>();
+
+        if (!this.options.debugProtection) {
+            return;
+        }
+
+        const debugProtectionFunctionName: string = this.identifierNamesGenerator.generate();
+        const callsControllerFunctionName: string = this.identifierNamesGenerator.generate();
+
+        const debugProtectionFunctionCodeHelper: ICustomCodeHelper<TInitialData<DebugProtectionFunctionCodeHelper>> =
+            this.customCodeHelperFactory(CustomCodeHelper.DebugProtectionFunction);
+        const debugProtectionFunctionCallCodeHelper: ICustomCodeHelper<TInitialData<DebugProtectionFunctionCallCodeHelper>> =
+            this.customCodeHelperFactory(CustomCodeHelper.DebugProtectionFunctionCall);
+        const debugProtectionFunctionIntervalCodeHelper: ICustomCodeHelper<TInitialData<DebugProtectionFunctionIntervalCodeHelper>> =
+            this.customCodeHelperFactory(CustomCodeHelper.DebugProtectionFunctionInterval);
+        const nodeCallsControllerFunctionCodeHelper: ICustomCodeHelper<TInitialData<CallsControllerFunctionCodeHelper>> =
+            this.customCodeHelperFactory(CustomCodeHelper.CallsControllerFunction);
+
+        debugProtectionFunctionCodeHelper.initialize(debugProtectionFunctionName);
+        debugProtectionFunctionCallCodeHelper.initialize(debugProtectionFunctionName, callsControllerFunctionName);
+        debugProtectionFunctionIntervalCodeHelper.initialize(debugProtectionFunctionName);
+        nodeCallsControllerFunctionCodeHelper.initialize(this.appendEvent, callsControllerFunctionName);
+
+        this.customCodeHelpers.set(CustomCodeHelper.DebugProtectionFunction, debugProtectionFunctionCodeHelper);
+        this.customCodeHelpers.set(CustomCodeHelper.DebugProtectionFunctionCall, debugProtectionFunctionCallCodeHelper);
+
+        if (this.options.debugProtectionInterval) {
+            this.customCodeHelpers.set(CustomCodeHelper.DebugProtectionFunctionInterval, debugProtectionFunctionIntervalCodeHelper);
+        }
+
+        this.customCodeHelpers.set(CustomCodeHelper.CallsControllerFunction, nodeCallsControllerFunctionCodeHelper);
+    }
+}

+ 0 - 0
src/custom-nodes/debug-protection-nodes/templates/debug-protection-function-call-node/DebugProtectionFunctionCallTemplate.ts → src/custom-code-helpers/debug-protection/templates/debug-protection-function-call/DebugProtectionFunctionCallTemplate.ts


+ 0 - 0
src/custom-nodes/debug-protection-nodes/templates/debug-protection-function-interval-node/DebugProtectionFunctionIntervalTemplate.ts → src/custom-code-helpers/debug-protection/templates/debug-protection-function-interval/DebugProtectionFunctionIntervalTemplate.ts


+ 0 - 0
src/custom-nodes/debug-protection-nodes/templates/debug-protection-function-node/DebugProtectionFunctionTemplate.ts → src/custom-code-helpers/debug-protection/templates/debug-protection-function/DebugProtectionFunctionTemplate.ts


+ 0 - 0
src/custom-nodes/debug-protection-nodes/templates/debug-protection-function-node/DebuggerTemplate.ts → src/custom-code-helpers/debug-protection/templates/debug-protection-function/DebuggerTemplate.ts


+ 0 - 0
src/custom-nodes/debug-protection-nodes/templates/debug-protection-function-node/DebuggerTemplateNoEval.ts → src/custom-code-helpers/debug-protection/templates/debug-protection-function/DebuggerTemplateNoEval.ts


+ 16 - 16
src/custom-nodes/domain-lock-nodes/DomainLockNode.ts → src/custom-code-helpers/domain-lock/DomainLockCodeHelper.ts

@@ -4,8 +4,8 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TStatement } from '../../types/node/TStatement';
 import { TStatement } from '../../types/node/TStatement';
 
 
-import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
-import { ICustomNodeObfuscator } from '../../interfaces/custom-nodes/ICustomNodeObfuscator';
+import { ICustomCodeHelperFormatter } from '../../interfaces/custom-code-helpers/ICustomCodeHelperFormatter';
+import { ICustomCodeHelperObfuscator } from '../../interfaces/custom-code-helpers/ICustomCodeHelperObfuscator';
 import { ICryptUtils } from '../../interfaces/utils/ICryptUtils';
 import { ICryptUtils } from '../../interfaces/utils/ICryptUtils';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
@@ -14,14 +14,14 @@ import { ObfuscationTarget } from '../../enums/ObfuscationTarget';
 
 
 import { initializable } from '../../decorators/Initializable';
 import { initializable } from '../../decorators/Initializable';
 
 
-import { DomainLockNodeTemplate } from './templates/DomainLockNodeTemplate';
+import { DomainLockTemplate } from './templates/DomainLockTemplate';
 import { GlobalVariableNoEvalTemplate } from '../common/templates/GlobalVariableNoEvalTemplate';
 import { GlobalVariableNoEvalTemplate } from '../common/templates/GlobalVariableNoEvalTemplate';
 
 
-import { AbstractCustomNode } from '../AbstractCustomNode';
+import { AbstractCustomCodeHelper } from '../AbstractCustomCodeHelper';
 import { NodeUtils } from '../../node/NodeUtils';
 import { NodeUtils } from '../../node/NodeUtils';
 
 
 @injectable()
 @injectable()
-export class DomainLockNode extends AbstractCustomNode {
+export class DomainLockCodeHelper extends AbstractCustomCodeHelper {
     /**
     /**
      * @type {string}
      * @type {string}
      */
      */
@@ -35,8 +35,8 @@ export class DomainLockNode extends AbstractCustomNode {
 
 
     /**
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
-     * @param {ICustomNodeFormatter} customNodeFormatter
-     * @param {ICustomNodeObfuscator} customNodeObfuscator
+     * @param {ICustomCodeHelperFormatter} customCodeHelperFormatter
+     * @param {ICustomCodeHelperObfuscator} customCodeHelperObfuscator
      * @param {IRandomGenerator} randomGenerator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      * @param {IOptions} options
      * @param {ICryptUtils} cryptUtils
      * @param {ICryptUtils} cryptUtils
@@ -44,16 +44,16 @@ export class DomainLockNode extends AbstractCustomNode {
     public constructor (
     public constructor (
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
-        @inject(ServiceIdentifiers.ICustomNodeFormatter) customNodeFormatter: ICustomNodeFormatter,
-        @inject(ServiceIdentifiers.ICustomNodeObfuscator) customNodeObfuscator: ICustomNodeObfuscator,
+        @inject(ServiceIdentifiers.ICustomCodeHelperFormatter) customCodeHelperFormatter: ICustomCodeHelperFormatter,
+        @inject(ServiceIdentifiers.ICustomCodeHelperObfuscator) customCodeHelperObfuscator: ICustomCodeHelperObfuscator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions,
         @inject(ServiceIdentifiers.IOptions) options: IOptions,
         @inject(ServiceIdentifiers.ICryptUtils) cryptUtils: ICryptUtils
         @inject(ServiceIdentifiers.ICryptUtils) cryptUtils: ICryptUtils
     ) {
     ) {
         super(
         super(
             identifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory,
-            customNodeFormatter,
-            customNodeObfuscator,
+            customCodeHelperFormatter,
+            customCodeHelperObfuscator,
             randomGenerator,
             randomGenerator,
             options
             options
         );
         );
@@ -69,17 +69,17 @@ export class DomainLockNode extends AbstractCustomNode {
     }
     }
 
 
     /**
     /**
-     * @param {string} nodeTemplate
+     * @param {string} codeHelperTemplate
      * @returns {TStatement[]}
      * @returns {TStatement[]}
      */
      */
-    protected getNodeStructure (nodeTemplate: string): TStatement[] {
-        return NodeUtils.convertCodeToStructure(nodeTemplate);
+    protected getNodeStructure (codeHelperTemplate: string): TStatement[] {
+        return NodeUtils.convertCodeToStructure(codeHelperTemplate);
     }
     }
 
 
     /**
     /**
      * @returns {string}
      * @returns {string}
      */
      */
-    protected getNodeTemplate (): string {
+    protected getCodeHelperTemplate (): string {
         const domainsString: string = this.options.domainLock.join(';');
         const domainsString: string = this.options.domainLock.join(';');
         const [hiddenDomainsString, diff]: string[] = this.cryptUtils.hideString(
         const [hiddenDomainsString, diff]: string[] = this.cryptUtils.hideString(
             domainsString,
             domainsString,
@@ -89,7 +89,7 @@ export class DomainLockNode extends AbstractCustomNode {
             ? this.getGlobalVariableTemplate()
             ? this.getGlobalVariableTemplate()
             : GlobalVariableNoEvalTemplate();
             : GlobalVariableNoEvalTemplate();
 
 
-        return this.customNodeFormatter.formatTemplate(DomainLockNodeTemplate(), {
+        return this.customCodeHelperFormatter.formatTemplate(DomainLockTemplate(), {
             domainLockFunctionName: this.identifierNamesGenerator.generate(),
             domainLockFunctionName: this.identifierNamesGenerator.generate(),
             diff,
             diff,
             domains: hiddenDomainsString,
             domains: hiddenDomainsString,

+ 30 - 30
src/custom-nodes/domain-lock-nodes/group/DomainLockCustomNodeGroup.ts → src/custom-code-helpers/domain-lock/group/DomainLockCustomCodeHelperGroup.ts

@@ -1,52 +1,52 @@
 import { inject, injectable, } from 'inversify';
 import { inject, injectable, } from 'inversify';
 import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
 import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
 
 
-import { TCustomNodeFactory } from '../../../types/container/custom-nodes/TCustomNodeFactory';
+import { TCustomCodeHelperFactory } from '../../../types/container/custom-code-helpers/TCustomCodeHelperFactory';
 import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TInitialData } from '../../../types/TInitialData';
 import { TInitialData } from '../../../types/TInitialData';
 import { TNodeWithStatements } from '../../../types/node/TNodeWithStatements';
 import { TNodeWithStatements } from '../../../types/node/TNodeWithStatements';
 
 
-import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
+import { ICustomCodeHelper } from '../../../interfaces/custom-code-helpers/ICustomCodeHelper';
 import { IOptions } from '../../../interfaces/options/IOptions';
 import { IOptions } from '../../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../../interfaces/utils/IRandomGenerator';
 import { IRandomGenerator } from '../../../interfaces/utils/IRandomGenerator';
 import { ICallsGraphData } from '../../../interfaces/analyzers/calls-graph-analyzer/ICallsGraphData';
 import { ICallsGraphData } from '../../../interfaces/analyzers/calls-graph-analyzer/ICallsGraphData';
 
 
 import { initializable } from '../../../decorators/Initializable';
 import { initializable } from '../../../decorators/Initializable';
 
 
-import { CustomNode } from '../../../enums/custom-nodes/CustomNode';
+import { CustomCodeHelper } from '../../../enums/custom-code-helpers/CustomCodeHelper';
 import { ObfuscationEvent } from '../../../enums/event-emitters/ObfuscationEvent';
 import { ObfuscationEvent } from '../../../enums/event-emitters/ObfuscationEvent';
 
 
-import { AbstractCustomNodeGroup } from '../../AbstractCustomNodeGroup';
-import { DomainLockNode } from '../DomainLockNode';
+import { AbstractCustomCodeHelperGroup } from '../../AbstractCustomCodeHelperGroup';
+import { DomainLockCodeHelper } from '../DomainLockCodeHelper';
 import { NodeAppender } from '../../../node/NodeAppender';
 import { NodeAppender } from '../../../node/NodeAppender';
-import { NodeCallsControllerFunctionNode } from '../../node-calls-controller-nodes/NodeCallsControllerFunctionNode';
+import { CallsControllerFunctionCodeHelper } from '../../calls-controller/CallsControllerFunctionCodeHelper';
 
 
 @injectable()
 @injectable()
-export class DomainLockCustomNodeGroup extends AbstractCustomNodeGroup {
+export class DomainLockCustomCodeHelperGroup extends AbstractCustomCodeHelperGroup {
     /**
     /**
      * @type {ObfuscationEvent}
      * @type {ObfuscationEvent}
      */
      */
     protected readonly appendEvent: ObfuscationEvent = ObfuscationEvent.BeforeObfuscation;
     protected readonly appendEvent: ObfuscationEvent = ObfuscationEvent.BeforeObfuscation;
 
 
     /**
     /**
-     * @type {Map<CustomNode, ICustomNode>}
+     * @type {Map<CustomCodeHelper, ICustomCodeHelper>}
      */
      */
     @initializable()
     @initializable()
-    protected customNodes!: Map <CustomNode, ICustomNode>;
+    protected customCodeHelpers!: Map <CustomCodeHelper, ICustomCodeHelper>;
 
 
     /**
     /**
-     * @type {TCustomNodeFactory}
+     * @type {TCustomCodeHelperFactory}
      */
      */
-    private readonly customNodeFactory: TCustomNodeFactory;
+    private readonly customCodeHelperFactory: TCustomCodeHelperFactory;
 
 
     /**
     /**
-     * @param {TCustomNodeFactory} customNodeFactory
+     * @param {TCustomCodeHelperFactory} customCodeHelperFactory
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {IRandomGenerator} randomGenerator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      * @param {IOptions} options
      */
      */
     public constructor (
     public constructor (
-        @inject(ServiceIdentifiers.Factory__ICustomNode) customNodeFactory: TCustomNodeFactory,
+        @inject(ServiceIdentifiers.Factory__ICustomCodeHelper) customCodeHelperFactory: TCustomCodeHelperFactory,
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
@@ -54,38 +54,38 @@ export class DomainLockCustomNodeGroup extends AbstractCustomNodeGroup {
     ) {
     ) {
         super(identifierNamesGeneratorFactory, randomGenerator, options);
         super(identifierNamesGeneratorFactory, randomGenerator, options);
 
 
-        this.customNodeFactory = customNodeFactory;
+        this.customCodeHelperFactory = customCodeHelperFactory;
     }
     }
 
 
     /**
     /**
      * @param {TNodeWithStatements} nodeWithStatements
      * @param {TNodeWithStatements} nodeWithStatements
      * @param {ICallsGraphData[]} callsGraphData
      * @param {ICallsGraphData[]} callsGraphData
      */
      */
-    public appendCustomNodes (nodeWithStatements: TNodeWithStatements, callsGraphData: ICallsGraphData[]): void {
+    public appendNodes (nodeWithStatements: TNodeWithStatements, callsGraphData: ICallsGraphData[]): void {
         const randomCallsGraphIndex: number = this.getRandomCallsGraphIndex(callsGraphData.length);
         const randomCallsGraphIndex: number = this.getRandomCallsGraphIndex(callsGraphData.length);
 
 
-        // domainLockNode append
-        this.appendCustomNodeIfExist(CustomNode.DomainLockNode, (customNode: ICustomNode) => {
+        // domainLock helper nodes append
+        this.appendCustomNodeIfExist(CustomCodeHelper.DomainLock, (customCodeHelper: ICustomCodeHelper) => {
             NodeAppender.appendToOptimalBlockScope(
             NodeAppender.appendToOptimalBlockScope(
                 callsGraphData,
                 callsGraphData,
                 nodeWithStatements,
                 nodeWithStatements,
-                customNode.getNode(),
+                customCodeHelper.getNode(),
                 randomCallsGraphIndex
                 randomCallsGraphIndex
             );
             );
         });
         });
 
 
-        // nodeCallsControllerFunctionNode append
-        this.appendCustomNodeIfExist(CustomNode.NodeCallsControllerFunctionNode, (customNode: ICustomNode) => {
+        // nodeCallsControllerFunction helper nodes append
+        this.appendCustomNodeIfExist(CustomCodeHelper.CallsControllerFunction, (customCodeHelper: ICustomCodeHelper) => {
             const targetNodeWithStatements: TNodeWithStatements = callsGraphData.length
             const targetNodeWithStatements: TNodeWithStatements = callsGraphData.length
                 ? NodeAppender.getOptimalBlockScope(callsGraphData, randomCallsGraphIndex, 1)
                 ? NodeAppender.getOptimalBlockScope(callsGraphData, randomCallsGraphIndex, 1)
                 : nodeWithStatements;
                 : nodeWithStatements;
 
 
-            NodeAppender.prepend(targetNodeWithStatements, customNode.getNode());
+            NodeAppender.prepend(targetNodeWithStatements, customCodeHelper.getNode());
         });
         });
     }
     }
 
 
     public initialize (): void {
     public initialize (): void {
-        this.customNodes = new Map <CustomNode, ICustomNode>();
+        this.customCodeHelpers = new Map <CustomCodeHelper, ICustomCodeHelper>();
 
 
         if (!this.options.domainLock.length) {
         if (!this.options.domainLock.length) {
             return;
             return;
@@ -93,15 +93,15 @@ export class DomainLockCustomNodeGroup extends AbstractCustomNodeGroup {
 
 
         const callsControllerFunctionName: string = this.identifierNamesGenerator.generate();
         const callsControllerFunctionName: string = this.identifierNamesGenerator.generate();
 
 
-        const domainLockNode: ICustomNode<TInitialData<DomainLockNode>> =
-            this.customNodeFactory(CustomNode.DomainLockNode);
-        const nodeCallsControllerFunctionNode: ICustomNode<TInitialData<NodeCallsControllerFunctionNode>> =
-            this.customNodeFactory(CustomNode.NodeCallsControllerFunctionNode);
+        const domainLockCodeHelper: ICustomCodeHelper<TInitialData<DomainLockCodeHelper>> =
+            this.customCodeHelperFactory(CustomCodeHelper.DomainLock);
+        const nodeCallsControllerFunctionCodeHelper: ICustomCodeHelper<TInitialData<CallsControllerFunctionCodeHelper>> =
+            this.customCodeHelperFactory(CustomCodeHelper.CallsControllerFunction);
 
 
-        domainLockNode.initialize(callsControllerFunctionName);
-        nodeCallsControllerFunctionNode.initialize(this.appendEvent, callsControllerFunctionName);
+        domainLockCodeHelper.initialize(callsControllerFunctionName);
+        nodeCallsControllerFunctionCodeHelper.initialize(this.appendEvent, callsControllerFunctionName);
 
 
-        this.customNodes.set(CustomNode.DomainLockNode, domainLockNode);
-        this.customNodes.set(CustomNode.NodeCallsControllerFunctionNode, nodeCallsControllerFunctionNode);
+        this.customCodeHelpers.set(CustomCodeHelper.DomainLock, domainLockCodeHelper);
+        this.customCodeHelpers.set(CustomCodeHelper.CallsControllerFunction, nodeCallsControllerFunctionCodeHelper);
     }
     }
 }
 }

+ 1 - 1
src/custom-nodes/domain-lock-nodes/templates/DomainLockNodeTemplate.ts → src/custom-code-helpers/domain-lock/templates/DomainLockTemplate.ts

@@ -1,7 +1,7 @@
 /**
 /**
  * @returns {string}
  * @returns {string}
  */
  */
-export function DomainLockNodeTemplate (): string {
+export function DomainLockTemplate (): string {
     return `
     return `
         const {domainLockFunctionName} = {singleNodeCallControllerFunctionName}(this, function () {
         const {domainLockFunctionName} = {singleNodeCallControllerFunctionName}(this, function () {
             
             

+ 16 - 16
src/custom-nodes/self-defending-nodes/SelfDefendingUnicodeNode.ts → src/custom-code-helpers/self-defending/SelfDefendingUnicodeCodeHelper.ts

@@ -4,8 +4,8 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TStatement } from '../../types/node/TStatement';
 import { TStatement } from '../../types/node/TStatement';
 
 
-import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
-import { ICustomNodeObfuscator } from '../../interfaces/custom-nodes/ICustomNodeObfuscator';
+import { ICustomCodeHelperFormatter } from '../../interfaces/custom-code-helpers/ICustomCodeHelperFormatter';
+import { ICustomCodeHelperObfuscator } from '../../interfaces/custom-code-helpers/ICustomCodeHelperObfuscator';
 import { IEscapeSequenceEncoder } from '../../interfaces/utils/IEscapeSequenceEncoder';
 import { IEscapeSequenceEncoder } from '../../interfaces/utils/IEscapeSequenceEncoder';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
@@ -14,11 +14,11 @@ import { initializable } from '../../decorators/Initializable';
 
 
 import { SelfDefendingTemplate } from './templates/SelfDefendingTemplate';
 import { SelfDefendingTemplate } from './templates/SelfDefendingTemplate';
 
 
-import { AbstractCustomNode } from '../AbstractCustomNode';
+import { AbstractCustomCodeHelper } from '../AbstractCustomCodeHelper';
 import { NodeUtils } from '../../node/NodeUtils';
 import { NodeUtils } from '../../node/NodeUtils';
 
 
 @injectable()
 @injectable()
-export class SelfDefendingUnicodeNode extends AbstractCustomNode {
+export class SelfDefendingUnicodeCodeHelper extends AbstractCustomCodeHelper {
     /**
     /**
      * @type {IEscapeSequenceEncoder}
      * @type {IEscapeSequenceEncoder}
      */
      */
@@ -32,8 +32,8 @@ export class SelfDefendingUnicodeNode extends AbstractCustomNode {
 
 
     /**
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
-     * @param {ICustomNodeFormatter} customNodeFormatter
-     * @param {ICustomNodeObfuscator} customNodeObfuscator
+     * @param {ICustomCodeHelperFormatter} customCodeHelperFormatter
+     * @param {ICustomCodeHelperObfuscator} customCodeHelperObfuscator
      * @param {IRandomGenerator} randomGenerator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      * @param {IOptions} options
      * @param {IEscapeSequenceEncoder} escapeSequenceEncoder
      * @param {IEscapeSequenceEncoder} escapeSequenceEncoder
@@ -41,16 +41,16 @@ export class SelfDefendingUnicodeNode extends AbstractCustomNode {
     public constructor (
     public constructor (
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
-        @inject(ServiceIdentifiers.ICustomNodeFormatter) customNodeFormatter: ICustomNodeFormatter,
-        @inject(ServiceIdentifiers.ICustomNodeObfuscator) customNodeObfuscator: ICustomNodeObfuscator,
+        @inject(ServiceIdentifiers.ICustomCodeHelperFormatter) customCodeHelperFormatter: ICustomCodeHelperFormatter,
+        @inject(ServiceIdentifiers.ICustomCodeHelperObfuscator) customCodeHelperObfuscator: ICustomCodeHelperObfuscator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions,
         @inject(ServiceIdentifiers.IOptions) options: IOptions,
         @inject(ServiceIdentifiers.IEscapeSequenceEncoder) escapeSequenceEncoder: IEscapeSequenceEncoder
         @inject(ServiceIdentifiers.IEscapeSequenceEncoder) escapeSequenceEncoder: IEscapeSequenceEncoder
     ) {
     ) {
         super(
         super(
             identifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory,
-            customNodeFormatter,
-            customNodeObfuscator,
+            customCodeHelperFormatter,
+            customCodeHelperObfuscator,
             randomGenerator,
             randomGenerator,
             options
             options
         );
         );
@@ -66,19 +66,19 @@ export class SelfDefendingUnicodeNode extends AbstractCustomNode {
     }
     }
 
 
     /**
     /**
-     * @param {string} nodeTemplate
+     * @param {string} codeHelperTemplate
      * @returns {TStatement[]}
      * @returns {TStatement[]}
      */
      */
-    protected getNodeStructure (nodeTemplate: string): TStatement[] {
-        return NodeUtils.convertCodeToStructure(nodeTemplate);
+    protected getNodeStructure (codeHelperTemplate: string): TStatement[] {
+        return NodeUtils.convertCodeToStructure(codeHelperTemplate);
     }
     }
 
 
     /**
     /**
      * @returns {string}
      * @returns {string}
      */
      */
-    protected getNodeTemplate (): string {
-        return this.customNodeObfuscator.obfuscateTemplate(
-            this.customNodeFormatter.formatTemplate(SelfDefendingTemplate(this.escapeSequenceEncoder), {
+    protected getCodeHelperTemplate (): string {
+        return this.customCodeHelperObfuscator.obfuscateTemplate(
+            this.customCodeHelperFormatter.formatTemplate(SelfDefendingTemplate(this.escapeSequenceEncoder), {
                 selfDefendingFunctionName: this.identifierNamesGenerator.generate(),
                 selfDefendingFunctionName: this.identifierNamesGenerator.generate(),
                 singleNodeCallControllerFunctionName: this.callsControllerFunctionName
                 singleNodeCallControllerFunctionName: this.callsControllerFunctionName
             }),
             }),

+ 30 - 30
src/custom-nodes/self-defending-nodes/group/SelfDefendingCustomNodeGroup.ts → src/custom-code-helpers/self-defending/group/SelfDefendingCodeHelperGroup.ts

@@ -1,52 +1,52 @@
 import { inject, injectable, } from 'inversify';
 import { inject, injectable, } from 'inversify';
 import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
 import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
 
 
-import { TCustomNodeFactory } from '../../../types/container/custom-nodes/TCustomNodeFactory';
+import { TCustomCodeHelperFactory } from '../../../types/container/custom-code-helpers/TCustomCodeHelperFactory';
 import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TInitialData } from '../../../types/TInitialData';
 import { TInitialData } from '../../../types/TInitialData';
 import { TNodeWithStatements } from '../../../types/node/TNodeWithStatements';
 import { TNodeWithStatements } from '../../../types/node/TNodeWithStatements';
 
 
-import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
+import { ICustomCodeHelper } from '../../../interfaces/custom-code-helpers/ICustomCodeHelper';
 import { IOptions } from '../../../interfaces/options/IOptions';
 import { IOptions } from '../../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../../interfaces/utils/IRandomGenerator';
 import { IRandomGenerator } from '../../../interfaces/utils/IRandomGenerator';
 import { ICallsGraphData } from '../../../interfaces/analyzers/calls-graph-analyzer/ICallsGraphData';
 import { ICallsGraphData } from '../../../interfaces/analyzers/calls-graph-analyzer/ICallsGraphData';
 
 
 import { initializable } from '../../../decorators/Initializable';
 import { initializable } from '../../../decorators/Initializable';
 
 
-import { CustomNode } from '../../../enums/custom-nodes/CustomNode';
+import { CustomCodeHelper } from '../../../enums/custom-code-helpers/CustomCodeHelper';
 import { ObfuscationEvent } from '../../../enums/event-emitters/ObfuscationEvent';
 import { ObfuscationEvent } from '../../../enums/event-emitters/ObfuscationEvent';
 
 
-import { AbstractCustomNodeGroup } from '../../AbstractCustomNodeGroup';
+import { AbstractCustomCodeHelperGroup } from '../../AbstractCustomCodeHelperGroup';
 import { NodeAppender } from '../../../node/NodeAppender';
 import { NodeAppender } from '../../../node/NodeAppender';
-import { NodeCallsControllerFunctionNode } from '../../node-calls-controller-nodes/NodeCallsControllerFunctionNode';
-import { SelfDefendingUnicodeNode } from '../SelfDefendingUnicodeNode';
+import { CallsControllerFunctionCodeHelper } from '../../calls-controller/CallsControllerFunctionCodeHelper';
+import { SelfDefendingUnicodeCodeHelper } from '../SelfDefendingUnicodeCodeHelper';
 
 
 @injectable()
 @injectable()
-export class SelfDefendingCustomNodeGroup extends AbstractCustomNodeGroup {
+export class SelfDefendingCodeHelperGroup extends AbstractCustomCodeHelperGroup {
     /**
     /**
      * @type {ObfuscationEvent}
      * @type {ObfuscationEvent}
      */
      */
     protected appendEvent: ObfuscationEvent = ObfuscationEvent.AfterObfuscation;
     protected appendEvent: ObfuscationEvent = ObfuscationEvent.AfterObfuscation;
 
 
     /**
     /**
-     * @type {Map<CustomNode, ICustomNode>}
+     * @type {Map<CustomCodeHelper, ICustomCodeHelper>}
      */
      */
     @initializable()
     @initializable()
-    protected customNodes!: Map <CustomNode, ICustomNode>;
+    protected customCodeHelpers!: Map <CustomCodeHelper, ICustomCodeHelper>;
 
 
     /**
     /**
-     * @type {TCustomNodeFactory}
+     * @type {TCustomCodeHelperFactory}
      */
      */
-    private readonly customNodeFactory: TCustomNodeFactory;
+    private readonly customCodeHelperFactory: TCustomCodeHelperFactory;
 
 
     /**
     /**
-     * @param {TCustomNodeFactory} customNodeFactory
+     * @param {TCustomCodeHelperFactory} customCodeHelperFactory
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {IRandomGenerator} randomGenerator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      * @param {IOptions} options
      */
      */
     public constructor (
     public constructor (
-        @inject(ServiceIdentifiers.Factory__ICustomNode) customNodeFactory: TCustomNodeFactory,
+        @inject(ServiceIdentifiers.Factory__ICustomCodeHelper) customCodeHelperFactory: TCustomCodeHelperFactory,
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
@@ -54,38 +54,38 @@ export class SelfDefendingCustomNodeGroup extends AbstractCustomNodeGroup {
     ) {
     ) {
         super(identifierNamesGeneratorFactory, randomGenerator, options);
         super(identifierNamesGeneratorFactory, randomGenerator, options);
 
 
-        this.customNodeFactory = customNodeFactory;
+        this.customCodeHelperFactory = customCodeHelperFactory;
     }
     }
 
 
     /**
     /**
      * @param {TNodeWithStatements} nodeWithStatements
      * @param {TNodeWithStatements} nodeWithStatements
      * @param {ICallsGraphData[]} callsGraphData
      * @param {ICallsGraphData[]} callsGraphData
      */
      */
-    public appendCustomNodes (nodeWithStatements: TNodeWithStatements, callsGraphData: ICallsGraphData[]): void {
+    public appendNodes (nodeWithStatements: TNodeWithStatements, callsGraphData: ICallsGraphData[]): void {
         const randomCallsGraphIndex: number = this.getRandomCallsGraphIndex(callsGraphData.length);
         const randomCallsGraphIndex: number = this.getRandomCallsGraphIndex(callsGraphData.length);
 
 
-        // selfDefendingUnicodeNode append
-        this.appendCustomNodeIfExist(CustomNode.SelfDefendingUnicodeNode, (customNode: ICustomNode) => {
+        // selfDefendingUnicode helper nodes append
+        this.appendCustomNodeIfExist(CustomCodeHelper.SelfDefendingUnicode, (customCodeHelper: ICustomCodeHelper) => {
             NodeAppender.appendToOptimalBlockScope(
             NodeAppender.appendToOptimalBlockScope(
                 callsGraphData,
                 callsGraphData,
                 nodeWithStatements,
                 nodeWithStatements,
-                customNode.getNode(),
+                customCodeHelper.getNode(),
                 randomCallsGraphIndex
                 randomCallsGraphIndex
             );
             );
         });
         });
 
 
-        // nodeCallsControllerFunctionNode append
-        this.appendCustomNodeIfExist(CustomNode.NodeCallsControllerFunctionNode, (customNode: ICustomNode) => {
+        // nodeCallsControllerFunction helper nodes append
+        this.appendCustomNodeIfExist(CustomCodeHelper.CallsControllerFunction, (customCodeHelper: ICustomCodeHelper) => {
             const targetNodeWithStatements: TNodeWithStatements = callsGraphData.length
             const targetNodeWithStatements: TNodeWithStatements = callsGraphData.length
                 ? NodeAppender.getOptimalBlockScope(callsGraphData, randomCallsGraphIndex, 1)
                 ? NodeAppender.getOptimalBlockScope(callsGraphData, randomCallsGraphIndex, 1)
                 : nodeWithStatements;
                 : nodeWithStatements;
 
 
-            NodeAppender.prepend(targetNodeWithStatements, customNode.getNode());
+            NodeAppender.prepend(targetNodeWithStatements, customCodeHelper.getNode());
         });
         });
     }
     }
 
 
     public initialize (): void {
     public initialize (): void {
-        this.customNodes = new Map <CustomNode, ICustomNode>();
+        this.customCodeHelpers = new Map <CustomCodeHelper, ICustomCodeHelper>();
 
 
         if (!this.options.selfDefending) {
         if (!this.options.selfDefending) {
             return;
             return;
@@ -93,15 +93,15 @@ export class SelfDefendingCustomNodeGroup extends AbstractCustomNodeGroup {
 
 
         const callsControllerFunctionName: string = this.identifierNamesGenerator.generate();
         const callsControllerFunctionName: string = this.identifierNamesGenerator.generate();
 
 
-        const selfDefendingUnicodeNode: ICustomNode<TInitialData<SelfDefendingUnicodeNode>> =
-            this.customNodeFactory(CustomNode.SelfDefendingUnicodeNode);
-        const nodeCallsControllerFunctionNode: ICustomNode<TInitialData<NodeCallsControllerFunctionNode>> =
-            this.customNodeFactory(CustomNode.NodeCallsControllerFunctionNode);
+        const selfDefendingUnicodeCodeHelper: ICustomCodeHelper<TInitialData<SelfDefendingUnicodeCodeHelper>> =
+            this.customCodeHelperFactory(CustomCodeHelper.SelfDefendingUnicode);
+        const nodeCallsControllerFunctionCodeHelper: ICustomCodeHelper<TInitialData<CallsControllerFunctionCodeHelper>> =
+            this.customCodeHelperFactory(CustomCodeHelper.CallsControllerFunction);
 
 
-        selfDefendingUnicodeNode.initialize(callsControllerFunctionName);
-        nodeCallsControllerFunctionNode.initialize(this.appendEvent, callsControllerFunctionName);
+        selfDefendingUnicodeCodeHelper.initialize(callsControllerFunctionName);
+        nodeCallsControllerFunctionCodeHelper.initialize(this.appendEvent, callsControllerFunctionName);
 
 
-        this.customNodes.set(CustomNode.SelfDefendingUnicodeNode, selfDefendingUnicodeNode);
-        this.customNodes.set(CustomNode.NodeCallsControllerFunctionNode, nodeCallsControllerFunctionNode);
+        this.customCodeHelpers.set(CustomCodeHelper.SelfDefendingUnicode, selfDefendingUnicodeCodeHelper);
+        this.customCodeHelpers.set(CustomCodeHelper.CallsControllerFunction, nodeCallsControllerFunctionCodeHelper);
     }
     }
 }
 }

+ 0 - 0
src/custom-nodes/self-defending-nodes/templates/SelfDefendingTemplate.ts → src/custom-code-helpers/self-defending/templates/SelfDefendingTemplate.ts


+ 26 - 26
src/custom-nodes/string-array-nodes/StringArrayCallsWrapper.ts → src/custom-code-helpers/string-array/StringArrayCallsWrapperCodeHelper.ts

@@ -4,8 +4,8 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TStatement } from '../../types/node/TStatement';
 import { TStatement } from '../../types/node/TStatement';
 
 
-import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
-import { ICustomNodeObfuscator } from '../../interfaces/custom-nodes/ICustomNodeObfuscator';
+import { ICustomCodeHelperFormatter } from '../../interfaces/custom-code-helpers/ICustomCodeHelperFormatter';
+import { ICustomCodeHelperObfuscator } from '../../interfaces/custom-code-helpers/ICustomCodeHelperObfuscator';
 import { IEscapeSequenceEncoder } from '../../interfaces/utils/IEscapeSequenceEncoder';
 import { IEscapeSequenceEncoder } from '../../interfaces/utils/IEscapeSequenceEncoder';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
@@ -19,15 +19,15 @@ import { AtobTemplate } from './templates/string-array-calls-wrapper/AtobTemplat
 import { GlobalVariableNoEvalTemplate } from '../common/templates/GlobalVariableNoEvalTemplate';
 import { GlobalVariableNoEvalTemplate } from '../common/templates/GlobalVariableNoEvalTemplate';
 import { Rc4Template } from './templates/string-array-calls-wrapper/Rc4Template';
 import { Rc4Template } from './templates/string-array-calls-wrapper/Rc4Template';
 import { SelfDefendingTemplate } from './templates/string-array-calls-wrapper/SelfDefendingTemplate';
 import { SelfDefendingTemplate } from './templates/string-array-calls-wrapper/SelfDefendingTemplate';
-import { StringArrayBase64DecodeNodeTemplate } from './templates/string-array-calls-wrapper/StringArrayBase64DecodeNodeTemplate';
+import { StringArrayBase64DecodeTemplate } from './templates/string-array-calls-wrapper/StringArrayBase64DecodeTemplate';
 import { StringArrayCallsWrapperTemplate } from './templates/string-array-calls-wrapper/StringArrayCallsWrapperTemplate';
 import { StringArrayCallsWrapperTemplate } from './templates/string-array-calls-wrapper/StringArrayCallsWrapperTemplate';
-import { StringArrayRc4DecodeNodeTemplate } from './templates/string-array-calls-wrapper/StringArrayRC4DecodeNodeTemplate';
+import { StringArrayRC4DecodeTemplate } from './templates/string-array-calls-wrapper/StringArrayRC4DecodeTemplate';
 
 
-import { AbstractCustomNode } from '../AbstractCustomNode';
+import { AbstractCustomCodeHelper } from '../AbstractCustomCodeHelper';
 import { NodeUtils } from '../../node/NodeUtils';
 import { NodeUtils } from '../../node/NodeUtils';
 
 
 @injectable()
 @injectable()
-export class StringArrayCallsWrapper extends AbstractCustomNode {
+export class StringArrayCallsWrapperCodeHelper extends AbstractCustomCodeHelper {
     /**
     /**
      * @type {IEscapeSequenceEncoder}
      * @type {IEscapeSequenceEncoder}
      */
      */
@@ -47,8 +47,8 @@ export class StringArrayCallsWrapper extends AbstractCustomNode {
 
 
     /**
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
-     * @param {ICustomNodeFormatter} customNodeFormatter
-     * @param {ICustomNodeObfuscator} customNodeObfuscator
+     * @param {ICustomCodeHelperFormatter} customCodeHelperFormatter
+     * @param {ICustomCodeHelperObfuscator} customCodeHelperObfuscator
      * @param {IRandomGenerator} randomGenerator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      * @param {IOptions} options
      * @param {IEscapeSequenceEncoder} escapeSequenceEncoder
      * @param {IEscapeSequenceEncoder} escapeSequenceEncoder
@@ -56,16 +56,16 @@ export class StringArrayCallsWrapper extends AbstractCustomNode {
     public constructor (
     public constructor (
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
-        @inject(ServiceIdentifiers.ICustomNodeFormatter) customNodeFormatter: ICustomNodeFormatter,
-        @inject(ServiceIdentifiers.ICustomNodeObfuscator) customNodeObfuscator: ICustomNodeObfuscator,
+        @inject(ServiceIdentifiers.ICustomCodeHelperFormatter) customCodeHelperFormatter: ICustomCodeHelperFormatter,
+        @inject(ServiceIdentifiers.ICustomCodeHelperObfuscator) customCodeHelperObfuscator: ICustomCodeHelperObfuscator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions,
         @inject(ServiceIdentifiers.IOptions) options: IOptions,
         @inject(ServiceIdentifiers.IEscapeSequenceEncoder) escapeSequenceEncoder: IEscapeSequenceEncoder
         @inject(ServiceIdentifiers.IEscapeSequenceEncoder) escapeSequenceEncoder: IEscapeSequenceEncoder
     ) {
     ) {
         super(
         super(
             identifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory,
-            customNodeFormatter,
-            customNodeObfuscator,
+            customCodeHelperFormatter,
+            customCodeHelperObfuscator,
             randomGenerator,
             randomGenerator,
             options
             options
         );
         );
@@ -86,24 +86,24 @@ export class StringArrayCallsWrapper extends AbstractCustomNode {
     }
     }
 
 
     /**
     /**
-     * @param {string} nodeTemplate
+     * @param {string} codeHelperTemplate
      * @returns {TStatement[]}
      * @returns {TStatement[]}
      */
      */
-    protected getNodeStructure (nodeTemplate: string): TStatement[] {
-        return NodeUtils.convertCodeToStructure(nodeTemplate);
+    protected getNodeStructure (codeHelperTemplate: string): TStatement[] {
+        return NodeUtils.convertCodeToStructure(codeHelperTemplate);
     }
     }
 
 
     /**
     /**
      * @returns {string}
      * @returns {string}
      */
      */
-    protected getNodeTemplate (): string {
-        const decodeNodeTemplate: string = this.getDecodeStringArrayTemplate();
+    protected getCodeHelperTemplate (): string {
+        const decodeCodeHelperTemplate: string = this.getDecodeStringArrayTemplate();
 
 
         const preservedNames: string[] = [this.stringArrayName];
         const preservedNames: string[] = [this.stringArrayName];
 
 
-        return this.customNodeObfuscator.obfuscateTemplate(
-            this.customNodeFormatter.formatTemplate(StringArrayCallsWrapperTemplate(), {
-                decodeNodeTemplate,
+        return this.customCodeHelperObfuscator.obfuscateTemplate(
+            this.customCodeHelperFormatter.formatTemplate(StringArrayCallsWrapperTemplate(), {
+                decodeCodeHelperTemplate,
                 stringArrayCallsWrapperName: this.stringArrayCallsWrapperName,
                 stringArrayCallsWrapperName: this.stringArrayCallsWrapperName,
                 stringArrayName: this.stringArrayName
                 stringArrayName: this.stringArrayName
             }),
             }),
@@ -120,13 +120,13 @@ export class StringArrayCallsWrapper extends AbstractCustomNode {
         const globalVariableTemplate: string = this.options.target !== ObfuscationTarget.BrowserNoEval
         const globalVariableTemplate: string = this.options.target !== ObfuscationTarget.BrowserNoEval
             ? this.getGlobalVariableTemplate()
             ? this.getGlobalVariableTemplate()
             : GlobalVariableNoEvalTemplate();
             : GlobalVariableNoEvalTemplate();
-        const atobPolyfill: string = this.customNodeFormatter.formatTemplate(AtobTemplate(), { globalVariableTemplate });
+        const atobPolyfill: string = this.customCodeHelperFormatter.formatTemplate(AtobTemplate(), { globalVariableTemplate });
 
 
         let decodeStringArrayTemplate: string = '';
         let decodeStringArrayTemplate: string = '';
         let selfDefendingCode: string = '';
         let selfDefendingCode: string = '';
 
 
         if (this.options.selfDefending) {
         if (this.options.selfDefending) {
-            selfDefendingCode = this.customNodeFormatter.formatTemplate(
+            selfDefendingCode = this.customCodeHelperFormatter.formatTemplate(
                 SelfDefendingTemplate(
                 SelfDefendingTemplate(
                     this.randomGenerator,
                     this.randomGenerator,
                     this.escapeSequenceEncoder
                     this.escapeSequenceEncoder
@@ -140,8 +140,8 @@ export class StringArrayCallsWrapper extends AbstractCustomNode {
 
 
         switch (this.options.stringArrayEncoding) {
         switch (this.options.stringArrayEncoding) {
             case StringArrayEncoding.Rc4:
             case StringArrayEncoding.Rc4:
-                decodeStringArrayTemplate = this.customNodeFormatter.formatTemplate(
-                    StringArrayRc4DecodeNodeTemplate(this.randomGenerator),
+                decodeStringArrayTemplate = this.customCodeHelperFormatter.formatTemplate(
+                    StringArrayRC4DecodeTemplate(this.randomGenerator),
                     {
                     {
                         atobPolyfill,
                         atobPolyfill,
                         selfDefendingCode,
                         selfDefendingCode,
@@ -153,8 +153,8 @@ export class StringArrayCallsWrapper extends AbstractCustomNode {
                 break;
                 break;
 
 
             case StringArrayEncoding.Base64:
             case StringArrayEncoding.Base64:
-                decodeStringArrayTemplate = this.customNodeFormatter.formatTemplate(
-                    StringArrayBase64DecodeNodeTemplate(this.randomGenerator),
+                decodeStringArrayTemplate = this.customCodeHelperFormatter.formatTemplate(
+                    StringArrayBase64DecodeTemplate(this.randomGenerator),
                     {
                     {
                         atobPolyfill,
                         atobPolyfill,
                         selfDefendingCode,
                         selfDefendingCode,

+ 16 - 16
src/custom-nodes/string-array-nodes/StringArrayNode.ts → src/custom-code-helpers/string-array/StringArrayCodeHelper.ts

@@ -4,21 +4,21 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TStatement } from '../../types/node/TStatement';
 import { TStatement } from '../../types/node/TStatement';
 
 
-import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
-import { ICustomNodeObfuscator } from '../../interfaces/custom-nodes/ICustomNodeObfuscator';
+import { ICustomCodeHelperFormatter } from '../../interfaces/custom-code-helpers/ICustomCodeHelperFormatter';
+import { ICustomCodeHelperObfuscator } from '../../interfaces/custom-code-helpers/ICustomCodeHelperObfuscator';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
 import { IStringArrayStorage } from '../../interfaces/storages/string-array-storage/IStringArrayStorage';
 import { IStringArrayStorage } from '../../interfaces/storages/string-array-storage/IStringArrayStorage';
 
 
 import { initializable } from '../../decorators/Initializable';
 import { initializable } from '../../decorators/Initializable';
 
 
-import { StringArrayTemplate } from './templates/string-array-node/StringArrayTemplate';
+import { StringArrayTemplate } from './templates/string-array/StringArrayTemplate';
 
 
-import { AbstractCustomNode } from '../AbstractCustomNode';
+import { AbstractCustomCodeHelper } from '../AbstractCustomCodeHelper';
 import { NodeUtils } from '../../node/NodeUtils';
 import { NodeUtils } from '../../node/NodeUtils';
 
 
 @injectable()
 @injectable()
-export class StringArrayNode extends AbstractCustomNode {
+export class StringArrayCodeHelper extends AbstractCustomCodeHelper {
     /**
     /**
      * @type {IStringArrayStorage}
      * @type {IStringArrayStorage}
      */
      */
@@ -33,23 +33,23 @@ export class StringArrayNode extends AbstractCustomNode {
 
 
     /**
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
-     * @param {ICustomNodeFormatter} customNodeFormatter
-     * @param {ICustomNodeObfuscator} customNodeObfuscator
+     * @param {ICustomCodeHelperFormatter} customCodeHelperFormatter
+     * @param {ICustomCodeHelperObfuscator} customCodeHelperObfuscator
      * @param {IRandomGenerator} randomGenerator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      * @param {IOptions} options
      */
      */
     public constructor (
     public constructor (
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
-        @inject(ServiceIdentifiers.ICustomNodeFormatter) customNodeFormatter: ICustomNodeFormatter,
-        @inject(ServiceIdentifiers.ICustomNodeObfuscator) customNodeObfuscator: ICustomNodeObfuscator,
+        @inject(ServiceIdentifiers.ICustomCodeHelperFormatter) customCodeHelperFormatter: ICustomCodeHelperFormatter,
+        @inject(ServiceIdentifiers.ICustomCodeHelperObfuscator) customCodeHelperObfuscator: ICustomCodeHelperObfuscator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
     ) {
         super(
         super(
             identifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory,
-            customNodeFormatter,
-            customNodeObfuscator,
+            customCodeHelperFormatter,
+            customCodeHelperObfuscator,
             randomGenerator,
             randomGenerator,
             options
             options
         );
         );
@@ -68,18 +68,18 @@ export class StringArrayNode extends AbstractCustomNode {
     }
     }
 
 
     /**
     /**
-     * @param {string} nodeTemplate
+     * @param {string} codeHelperTemplate
      * @returns {TStatement[]}
      * @returns {TStatement[]}
      */
      */
-    protected getNodeStructure (nodeTemplate: string): TStatement[] {
-        return NodeUtils.convertCodeToStructure(nodeTemplate);
+    protected getNodeStructure (codeHelperTemplate: string): TStatement[] {
+        return NodeUtils.convertCodeToStructure(codeHelperTemplate);
     }
     }
 
 
     /**
     /**
      * @returns {string}
      * @returns {string}
      */
      */
-    protected getNodeTemplate (): string {
-        return this.customNodeFormatter.formatTemplate(StringArrayTemplate(), {
+    protected getCodeHelperTemplate (): string {
+        return this.customCodeHelperFormatter.formatTemplate(StringArrayTemplate(), {
             stringArrayName: this.stringArrayName,
             stringArrayName: this.stringArrayName,
             stringArray: this.stringArrayStorage.toString()
             stringArray: this.stringArrayStorage.toString()
         });
         });

+ 19 - 19
src/custom-nodes/string-array-nodes/StringArrayRotateFunctionNode.ts → src/custom-code-helpers/string-array/StringArrayRotateFunctionCodeHelper.ts

@@ -4,23 +4,23 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TStatement } from '../../types/node/TStatement';
 import { TStatement } from '../../types/node/TStatement';
 
 
-import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
-import { ICustomNodeObfuscator } from '../../interfaces/custom-nodes/ICustomNodeObfuscator';
+import { ICustomCodeHelperFormatter } from '../../interfaces/custom-code-helpers/ICustomCodeHelperFormatter';
+import { ICustomCodeHelperObfuscator } from '../../interfaces/custom-code-helpers/ICustomCodeHelperObfuscator';
 import { IEscapeSequenceEncoder } from '../../interfaces/utils/IEscapeSequenceEncoder';
 import { IEscapeSequenceEncoder } from '../../interfaces/utils/IEscapeSequenceEncoder';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
 
 
 import { initializable } from '../../decorators/Initializable';
 import { initializable } from '../../decorators/Initializable';
 
 
-import { SelfDefendingTemplate } from './templates/string-array-rotate-function-node/SelfDefendingTemplate';
-import { StringArrayRotateFunctionTemplate } from './templates/string-array-rotate-function-node/StringArrayRotateFunctionTemplate';
+import { SelfDefendingTemplate } from './templates/string-array-rotate-function/SelfDefendingTemplate';
+import { StringArrayRotateFunctionTemplate } from './templates/string-array-rotate-function/StringArrayRotateFunctionTemplate';
 
 
-import { AbstractCustomNode } from '../AbstractCustomNode';
+import { AbstractCustomCodeHelper } from '../AbstractCustomCodeHelper';
 import { NodeUtils } from '../../node/NodeUtils';
 import { NodeUtils } from '../../node/NodeUtils';
 import { NumberUtils } from '../../utils/NumberUtils';
 import { NumberUtils } from '../../utils/NumberUtils';
 
 
 @injectable()
 @injectable()
-export class StringArrayRotateFunctionNode extends AbstractCustomNode {
+export class StringArrayRotateFunctionCodeHelper extends AbstractCustomCodeHelper {
     /**
     /**
      * @type {IEscapeSequenceEncoder}
      * @type {IEscapeSequenceEncoder}
      */
      */
@@ -40,8 +40,8 @@ export class StringArrayRotateFunctionNode extends AbstractCustomNode {
 
 
     /**
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
-     * @param {ICustomNodeFormatter} customNodeFormatter
-     * @param {ICustomNodeObfuscator} customNodeObfuscator
+     * @param {ICustomCodeHelperFormatter} customCodeHelperFormatter
+     * @param {ICustomCodeHelperObfuscator} customCodeHelperObfuscator
      * @param {IRandomGenerator} randomGenerator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      * @param {IOptions} options
      * @param {IEscapeSequenceEncoder} escapeSequenceEncoder
      * @param {IEscapeSequenceEncoder} escapeSequenceEncoder
@@ -49,16 +49,16 @@ export class StringArrayRotateFunctionNode extends AbstractCustomNode {
     public constructor (
     public constructor (
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
-        @inject(ServiceIdentifiers.ICustomNodeFormatter) customNodeFormatter: ICustomNodeFormatter,
-        @inject(ServiceIdentifiers.ICustomNodeObfuscator) customNodeObfuscator: ICustomNodeObfuscator,
+        @inject(ServiceIdentifiers.ICustomCodeHelperFormatter) customCodeHelperFormatter: ICustomCodeHelperFormatter,
+        @inject(ServiceIdentifiers.ICustomCodeHelperObfuscator) customCodeHelperObfuscator: ICustomCodeHelperObfuscator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions,
         @inject(ServiceIdentifiers.IOptions) options: IOptions,
         @inject(ServiceIdentifiers.IEscapeSequenceEncoder) escapeSequenceEncoder: IEscapeSequenceEncoder
         @inject(ServiceIdentifiers.IEscapeSequenceEncoder) escapeSequenceEncoder: IEscapeSequenceEncoder
     ) {
     ) {
         super(
         super(
             identifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory,
-            customNodeFormatter,
-            customNodeObfuscator,
+            customCodeHelperFormatter,
+            customCodeHelperObfuscator,
             randomGenerator,
             randomGenerator,
             options
             options
         );
         );
@@ -79,17 +79,17 @@ export class StringArrayRotateFunctionNode extends AbstractCustomNode {
     }
     }
 
 
     /**
     /**
-     * @param {string} nodeTemplate
+     * @param {string} codeHelperTemplate
      * @returns {TStatement[]}
      * @returns {TStatement[]}
      */
      */
-    protected getNodeStructure (nodeTemplate: string): TStatement[] {
-        return NodeUtils.convertCodeToStructure(nodeTemplate);
+    protected getNodeStructure (codeHelperTemplate: string): TStatement[] {
+        return NodeUtils.convertCodeToStructure(codeHelperTemplate);
     }
     }
 
 
     /**
     /**
      * @returns {string}
      * @returns {string}
      */
      */
-    protected getNodeTemplate (): string {
+    protected getCodeHelperTemplate (): string {
         const timesName: string = this.identifierNamesGenerator.generate();
         const timesName: string = this.identifierNamesGenerator.generate();
         const whileFunctionName: string = this.identifierNamesGenerator.generate();
         const whileFunctionName: string = this.identifierNamesGenerator.generate();
         const preservedNames: string[] = [this.stringArrayName];
         const preservedNames: string[] = [this.stringArrayName];
@@ -97,7 +97,7 @@ export class StringArrayRotateFunctionNode extends AbstractCustomNode {
         let code: string = '';
         let code: string = '';
 
 
         if (this.options.selfDefending) {
         if (this.options.selfDefending) {
-            code = this.customNodeFormatter.formatTemplate(SelfDefendingTemplate(this.escapeSequenceEncoder), {
+            code = this.customCodeHelperFormatter.formatTemplate(SelfDefendingTemplate(this.escapeSequenceEncoder), {
                 timesName,
                 timesName,
                 whileFunctionName
                 whileFunctionName
             });
             });
@@ -105,8 +105,8 @@ export class StringArrayRotateFunctionNode extends AbstractCustomNode {
             code = `${whileFunctionName}(++${timesName})`;
             code = `${whileFunctionName}(++${timesName})`;
         }
         }
 
 
-        return this.customNodeObfuscator.obfuscateTemplate(
-            this.customNodeFormatter.formatTemplate(StringArrayRotateFunctionTemplate(), {
+        return this.customCodeHelperObfuscator.obfuscateTemplate(
+            this.customCodeHelperFormatter.formatTemplate(StringArrayRotateFunctionTemplate(), {
                 code,
                 code,
                 timesName,
                 timesName,
                 whileFunctionName,
                 whileFunctionName,

+ 124 - 0
src/custom-code-helpers/string-array/group/StringArrayCodeHelperGroup.ts

@@ -0,0 +1,124 @@
+import { inject, injectable, } from 'inversify';
+import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
+
+import { TCustomCodeHelperFactory } from '../../../types/container/custom-code-helpers/TCustomCodeHelperFactory';
+import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory';
+import { TInitialData } from '../../../types/TInitialData';
+import { TNodeWithStatements } from '../../../types/node/TNodeWithStatements';
+
+import { ICallsGraphData } from '../../../interfaces/analyzers/calls-graph-analyzer/ICallsGraphData';
+import { ICustomCodeHelper } from '../../../interfaces/custom-code-helpers/ICustomCodeHelper';
+import { IOptions } from '../../../interfaces/options/IOptions';
+import { IRandomGenerator } from '../../../interfaces/utils/IRandomGenerator';
+import { IStringArrayStorage } from '../../../interfaces/storages/string-array-storage/IStringArrayStorage';
+
+import { initializable } from '../../../decorators/Initializable';
+
+import { CustomCodeHelper } from '../../../enums/custom-code-helpers/CustomCodeHelper';
+import { ObfuscationEvent } from '../../../enums/event-emitters/ObfuscationEvent';
+
+import { AbstractCustomCodeHelperGroup } from '../../AbstractCustomCodeHelperGroup';
+import { NodeAppender } from '../../../node/NodeAppender';
+import { StringArrayCodeHelper } from '../StringArrayCodeHelper';
+import { StringArrayCallsWrapperCodeHelper } from '../StringArrayCallsWrapperCodeHelper';
+import { StringArrayRotateFunctionCodeHelper } from '../StringArrayRotateFunctionCodeHelper';
+
+@injectable()
+export class StringArrayCodeHelperGroup extends AbstractCustomCodeHelperGroup {
+    /**
+     * @type {ObfuscationEvent}
+     */
+    protected appendEvent: ObfuscationEvent = ObfuscationEvent.AfterObfuscation;
+
+    /**
+     * @type {Map<CustomCodeHelper, ICustomCodeHelper>}
+     */
+    @initializable()
+    protected customCodeHelpers!: Map <CustomCodeHelper, ICustomCodeHelper>;
+
+    /**
+     * @type {TCustomCodeHelperFactory}
+     */
+    private readonly customCodeHelperFactory: TCustomCodeHelperFactory;
+
+    /**
+     * @type {IStringArrayStorage}
+     */
+    private readonly stringArrayStorage: IStringArrayStorage;
+
+    /**
+     * @param {TCustomCodeHelperFactory} customCodeHelperFactory
+     * @param {IStringArrayStorage} stringArrayStorage
+     * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
+     * @param {IRandomGenerator} randomGenerator
+     * @param {IOptions} options
+     */
+    public constructor (
+        @inject(ServiceIdentifiers.Factory__ICustomCodeHelper) customCodeHelperFactory: TCustomCodeHelperFactory,
+        @inject(ServiceIdentifiers.IStringArrayStorage) stringArrayStorage: IStringArrayStorage,
+        @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
+            identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
+        @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
+        @inject(ServiceIdentifiers.IOptions) options: IOptions
+    ) {
+        super(identifierNamesGeneratorFactory, randomGenerator, options);
+
+        this.customCodeHelperFactory = customCodeHelperFactory;
+        this.stringArrayStorage = stringArrayStorage;
+    }
+
+    /**
+     * @param {TNodeWithStatements} nodeWithStatements
+     * @param {ICallsGraphData[]} callsGraphData
+     */
+    public appendNodes (nodeWithStatements: TNodeWithStatements, callsGraphData: ICallsGraphData[]): void {
+        if (!this.stringArrayStorage.getLength()) {
+            return;
+        }
+
+        // stringArray helper nodes append
+        this.appendCustomNodeIfExist(CustomCodeHelper.StringArray, (customCodeHelper: ICustomCodeHelper) => {
+            NodeAppender.prepend(nodeWithStatements, customCodeHelper.getNode());
+        });
+
+        // stringArrayCallsWrapper helper nodes append
+        this.appendCustomNodeIfExist(CustomCodeHelper.StringArrayCallsWrapper, (customCodeHelper: ICustomCodeHelper) => {
+            NodeAppender.insertAtIndex(nodeWithStatements, customCodeHelper.getNode(), 1);
+        });
+
+        // stringArrayRotateFunction helper nodes append
+        this.appendCustomNodeIfExist(CustomCodeHelper.StringArrayRotateFunction, (customCodeHelper: ICustomCodeHelper) => {
+            NodeAppender.insertAtIndex(nodeWithStatements, customCodeHelper.getNode(), 1);
+        });
+    }
+
+    public initialize (): void {
+        this.customCodeHelpers = new Map <CustomCodeHelper, ICustomCodeHelper>();
+
+        if (!this.options.stringArray) {
+            return;
+        }
+
+        const stringArrayCodeHelper: ICustomCodeHelper<TInitialData<StringArrayCodeHelper>> =
+            this.customCodeHelperFactory(CustomCodeHelper.StringArray);
+        const stringArrayCallsWrapperCodeHelper: ICustomCodeHelper<TInitialData<StringArrayCallsWrapperCodeHelper>> =
+            this.customCodeHelperFactory(CustomCodeHelper.StringArrayCallsWrapper);
+        const stringArrayRotateFunctionCodeHelper: ICustomCodeHelper<TInitialData<StringArrayRotateFunctionCodeHelper>> =
+            this.customCodeHelperFactory(CustomCodeHelper.StringArrayRotateFunction);
+
+        const stringArrayName: string = this.stringArrayStorage.getStorageName();
+        const stringArrayCallsWrapperName: string = this.stringArrayStorage.getStorageCallsWrapperName();
+        const stringArrayRotationAmount: number = this.stringArrayStorage.getRotationAmount();
+
+        stringArrayCodeHelper.initialize(this.stringArrayStorage, stringArrayName);
+        stringArrayCallsWrapperCodeHelper.initialize(stringArrayName, stringArrayCallsWrapperName);
+        stringArrayRotateFunctionCodeHelper.initialize(stringArrayName, stringArrayRotationAmount);
+
+        this.customCodeHelpers.set(CustomCodeHelper.StringArray, stringArrayCodeHelper);
+        this.customCodeHelpers.set(CustomCodeHelper.StringArrayCallsWrapper, stringArrayCallsWrapperCodeHelper);
+
+        if (this.options.rotateStringArray) {
+            this.customCodeHelpers.set(CustomCodeHelper.StringArrayRotateFunction, stringArrayRotateFunctionCodeHelper);
+        }
+    }
+}

+ 0 - 0
src/custom-nodes/string-array-nodes/templates/string-array-calls-wrapper/AtobTemplate.ts → src/custom-code-helpers/string-array/templates/string-array-calls-wrapper/AtobTemplate.ts


+ 0 - 0
src/custom-nodes/string-array-nodes/templates/string-array-calls-wrapper/Rc4Template.ts → src/custom-code-helpers/string-array/templates/string-array-calls-wrapper/Rc4Template.ts


+ 0 - 0
src/custom-nodes/string-array-nodes/templates/string-array-calls-wrapper/SelfDefendingTemplate.ts → src/custom-code-helpers/string-array/templates/string-array-calls-wrapper/SelfDefendingTemplate.ts


+ 1 - 1
src/custom-nodes/string-array-nodes/templates/string-array-calls-wrapper/StringArrayBase64DecodeNodeTemplate.ts → src/custom-code-helpers/string-array/templates/string-array-calls-wrapper/StringArrayBase64DecodeTemplate.ts

@@ -5,7 +5,7 @@ import { IRandomGenerator } from '../../../../interfaces/utils/IRandomGenerator'
  * @returns {string}
  * @returns {string}
  * @constructor
  * @constructor
  */
  */
-export function StringArrayBase64DecodeNodeTemplate (
+export function StringArrayBase64DecodeTemplate (
     randomGenerator: IRandomGenerator
     randomGenerator: IRandomGenerator
 ): string {
 ): string {
     const identifierLength: number = 6;
     const identifierLength: number = 6;

+ 1 - 1
src/custom-nodes/string-array-nodes/templates/string-array-calls-wrapper/StringArrayCallsWrapperTemplate.ts → src/custom-code-helpers/string-array/templates/string-array-calls-wrapper/StringArrayCallsWrapperTemplate.ts

@@ -8,7 +8,7 @@ export function StringArrayCallsWrapperTemplate (): string {
             
             
             let value = {stringArrayName}[index];
             let value = {stringArrayName}[index];
             
             
-            {decodeNodeTemplate}
+            {decodeCodeHelperTemplate}
         
         
             return value;
             return value;
         };
         };

+ 1 - 1
src/custom-nodes/string-array-nodes/templates/string-array-calls-wrapper/StringArrayRC4DecodeNodeTemplate.ts → src/custom-code-helpers/string-array/templates/string-array-calls-wrapper/StringArrayRC4DecodeTemplate.ts

@@ -5,7 +5,7 @@ import { IRandomGenerator } from '../../../../interfaces/utils/IRandomGenerator'
  * @returns {string}
  * @returns {string}
  * @constructor
  * @constructor
  */
  */
-export function StringArrayRc4DecodeNodeTemplate (
+export function StringArrayRC4DecodeTemplate (
     randomGenerator: IRandomGenerator
     randomGenerator: IRandomGenerator
 ): string {
 ): string {
     const identifierLength: number = 6;
     const identifierLength: number = 6;

+ 0 - 0
src/custom-nodes/string-array-nodes/templates/string-array-rotate-function-node/SelfDefendingTemplate.ts → src/custom-code-helpers/string-array/templates/string-array-rotate-function/SelfDefendingTemplate.ts


+ 0 - 0
src/custom-nodes/string-array-nodes/templates/string-array-rotate-function-node/StringArrayRotateFunctionTemplate.ts → src/custom-code-helpers/string-array/templates/string-array-rotate-function/StringArrayRotateFunctionTemplate.ts


+ 0 - 0
src/custom-nodes/string-array-nodes/templates/string-array-node/StringArrayTemplate.ts → src/custom-code-helpers/string-array/templates/string-array/StringArrayTemplate.ts


+ 9 - 47
src/custom-nodes/AbstractCustomNode.ts

@@ -5,41 +5,24 @@ import { TIdentifierNamesGeneratorFactory } from '../types/container/generators/
 import { TStatement } from '../types/node/TStatement';
 import { TStatement } from '../types/node/TStatement';
 
 
 import { ICustomNode } from '../interfaces/custom-nodes/ICustomNode';
 import { ICustomNode } from '../interfaces/custom-nodes/ICustomNode';
-import { ICustomNodeFormatter } from '../interfaces/custom-nodes/ICustomNodeFormatter';
-import { ICustomNodeObfuscator } from '../interfaces/custom-nodes/ICustomNodeObfuscator';
+import { ICustomCodeHelperFormatter } from '../interfaces/custom-code-helpers/ICustomCodeHelperFormatter';
 import { IIdentifierNamesGenerator } from '../interfaces/generators/identifier-names-generators/IIdentifierNamesGenerator';
 import { IIdentifierNamesGenerator } from '../interfaces/generators/identifier-names-generators/IIdentifierNamesGenerator';
 import { IOptions } from '../interfaces/options/IOptions';
 import { IOptions } from '../interfaces/options/IOptions';
 import { IRandomGenerator } from '../interfaces/utils/IRandomGenerator';
 import { IRandomGenerator } from '../interfaces/utils/IRandomGenerator';
 
 
-import { GlobalVariableTemplate1 } from './common/templates/GlobalVariableTemplate1';
-import { GlobalVariableTemplate2 } from './common/templates/GlobalVariableTemplate2';
-
 @injectable()
 @injectable()
 export abstract class AbstractCustomNode <
 export abstract class AbstractCustomNode <
     TInitialData extends any[] = any[]
     TInitialData extends any[] = any[]
 > implements ICustomNode <TInitialData> {
 > implements ICustomNode <TInitialData> {
-    /**
-     * @type {string[]}
-     */
-    private static readonly globalVariableTemplateFunctions: string[] = [
-        GlobalVariableTemplate1(),
-        GlobalVariableTemplate2()
-    ];
-
     /**
     /**
      * @type {TStatement[] | null}
      * @type {TStatement[] | null}
      */
      */
     protected cachedNode: TStatement[] | null = null;
     protected cachedNode: TStatement[] | null = null;
 
 
     /**
     /**
-     * @type {ICustomNodeFormatter}
+     * @type {ICustomCodeHelperFormatter}
      */
      */
-    protected readonly customNodeFormatter: ICustomNodeFormatter;
-
-    /**
-     * @type {ICustomNodeObfuscator}
-     */
-    protected readonly customNodeObfuscator: ICustomNodeObfuscator;
+    protected readonly customCodeHelperFormatter: ICustomCodeHelperFormatter;
 
 
     /**
     /**
      * @type {IIdentifierNamesGenerator}
      * @type {IIdentifierNamesGenerator}
@@ -58,22 +41,19 @@ export abstract class AbstractCustomNode <
 
 
     /**
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
-     * @param {ICustomNodeFormatter} customNodeFormatter
-     * @param {ICustomNodeObfuscator} customNodeObfuscator
+     * @param {ICustomCodeHelperFormatter} customCodeHelperFormatter
      * @param {IRandomGenerator} randomGenerator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      * @param {IOptions} options
      */
      */
     protected constructor (
     protected constructor (
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
-        @inject(ServiceIdentifiers.ICustomNodeFormatter) customNodeFormatter: ICustomNodeFormatter,
-        @inject(ServiceIdentifiers.ICustomNodeObfuscator) customNodeObfuscator: ICustomNodeObfuscator,
+        @inject(ServiceIdentifiers.ICustomCodeHelperFormatter) customCodeHelperFormatter: ICustomCodeHelperFormatter,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
     ) {
         this.identifierNamesGenerator = identifierNamesGeneratorFactory(options);
         this.identifierNamesGenerator = identifierNamesGeneratorFactory(options);
-        this.customNodeFormatter = customNodeFormatter;
-        this.customNodeObfuscator = customNodeObfuscator;
+        this.customCodeHelperFormatter = customCodeHelperFormatter;
         this.randomGenerator = randomGenerator;
         this.randomGenerator = randomGenerator;
         this.options = options;
         this.options = options;
     }
     }
@@ -83,32 +63,14 @@ export abstract class AbstractCustomNode <
      */
      */
     public getNode (): TStatement[] {
     public getNode (): TStatement[] {
         if (!this.cachedNode) {
         if (!this.cachedNode) {
-            const nodeTemplate: string = this.getNodeTemplate();
-
-            this.cachedNode = this.customNodeFormatter.formatStructure(
-                this.getNodeStructure(nodeTemplate)
+            this.cachedNode = this.customCodeHelperFormatter.formatStructure(
+                this.getNodeStructure()
             );
             );
         }
         }
 
 
         return this.cachedNode;
         return this.cachedNode;
     }
     }
 
 
-    /**
-     * @returns {string}
-     */
-    protected getGlobalVariableTemplate (): string {
-        return this.randomGenerator
-            .getRandomGenerator()
-            .pickone(AbstractCustomNode.globalVariableTemplateFunctions);
-    }
-
-    /**
-     * @returns {string}
-     */
-    protected getNodeTemplate (): string {
-        return '';
-    }
-
     /**
     /**
      * @param {TInitialData} args
      * @param {TInitialData} args
      */
      */
@@ -117,5 +79,5 @@ export abstract class AbstractCustomNode <
     /**
     /**
      * @returns {TStatement[]}
      * @returns {TStatement[]}
      */
      */
-    protected abstract getNodeStructure (nodeTemplate: string): TStatement[];
+    protected abstract getNodeStructure (): TStatement[];
 }
 }

+ 0 - 107
src/custom-nodes/console-output-nodes/group/ConsoleOutputCustomNodeGroup.ts

@@ -1,107 +0,0 @@
-import { inject, injectable, } from 'inversify';
-import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
-
-import { TCustomNodeFactory } from '../../../types/container/custom-nodes/TCustomNodeFactory';
-import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory';
-import { TInitialData } from '../../../types/TInitialData';
-import { TNodeWithStatements } from '../../../types/node/TNodeWithStatements';
-
-import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
-import { IOptions } from '../../../interfaces/options/IOptions';
-import { IRandomGenerator } from '../../../interfaces/utils/IRandomGenerator';
-import { ICallsGraphData } from '../../../interfaces/analyzers/calls-graph-analyzer/ICallsGraphData';
-
-import { initializable } from '../../../decorators/Initializable';
-
-import { CustomNode } from '../../../enums/custom-nodes/CustomNode';
-import { ObfuscationEvent } from '../../../enums/event-emitters/ObfuscationEvent';
-
-import { AbstractCustomNodeGroup } from '../../AbstractCustomNodeGroup';
-import { ConsoleOutputDisableExpressionNode } from '../ConsoleOutputDisableExpressionNode';
-import { NodeAppender } from '../../../node/NodeAppender';
-import { NodeCallsControllerFunctionNode } from '../../node-calls-controller-nodes/NodeCallsControllerFunctionNode';
-
-@injectable()
-export class ConsoleOutputCustomNodeGroup extends AbstractCustomNodeGroup {
-    /**
-     * @type {ObfuscationEvent}
-     */
-    protected readonly appendEvent: ObfuscationEvent = ObfuscationEvent.BeforeObfuscation;
-
-    /**
-     * @type {Map<CustomNode, ICustomNode>}
-     */
-    @initializable()
-    protected customNodes!: Map <CustomNode, ICustomNode>;
-
-    /**
-     * @type {TCustomNodeFactory}
-     */
-    private readonly customNodeFactory: TCustomNodeFactory;
-
-    /**
-     * @param {TCustomNodeFactory} customNodeFactory
-     * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
-     * @param {IRandomGenerator} randomGenerator
-     * @param {IOptions} options
-     */
-    public constructor (
-        @inject(ServiceIdentifiers.Factory__ICustomNode) customNodeFactory: TCustomNodeFactory,
-        @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
-            identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
-        @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
-        @inject(ServiceIdentifiers.IOptions) options: IOptions
-    ) {
-        super(identifierNamesGeneratorFactory, randomGenerator, options);
-
-        this.customNodeFactory = customNodeFactory;
-    }
-
-    /**
-     * @param {TNodeWithStatements} nodeWithStatements
-     * @param {ICallsGraphData[]} callsGraphData
-     */
-    public appendCustomNodes (nodeWithStatements: TNodeWithStatements, callsGraphData: ICallsGraphData[]): void {
-        const randomCallsGraphIndex: number = this.getRandomCallsGraphIndex(callsGraphData.length);
-
-        // consoleOutputDisableExpressionNode append
-        this.appendCustomNodeIfExist(CustomNode.ConsoleOutputDisableExpressionNode, (customNode: ICustomNode) => {
-            NodeAppender.appendToOptimalBlockScope(
-                callsGraphData,
-                nodeWithStatements,
-                customNode.getNode(),
-                randomCallsGraphIndex
-            );
-        });
-
-        // nodeCallsControllerFunctionNode append
-        this.appendCustomNodeIfExist(CustomNode.NodeCallsControllerFunctionNode, (customNode: ICustomNode) => {
-            const targetNodeWithStatements: TNodeWithStatements = callsGraphData.length
-                ? NodeAppender.getOptimalBlockScope(callsGraphData, randomCallsGraphIndex, 1)
-                : nodeWithStatements;
-
-            NodeAppender.prepend(targetNodeWithStatements, customNode.getNode());
-        });
-    }
-
-    public initialize (): void {
-        this.customNodes = new Map <CustomNode, ICustomNode>();
-
-        if (!this.options.disableConsoleOutput) {
-            return;
-        }
-
-        const callsControllerFunctionName: string = this.identifierNamesGenerator.generate();
-
-        const consoleOutputDisableExpressionNode: ICustomNode<TInitialData<ConsoleOutputDisableExpressionNode>> =
-            this.customNodeFactory(CustomNode.ConsoleOutputDisableExpressionNode);
-        const nodeCallsControllerFunctionNode: ICustomNode<TInitialData<NodeCallsControllerFunctionNode>> =
-            this.customNodeFactory(CustomNode.NodeCallsControllerFunctionNode);
-
-        consoleOutputDisableExpressionNode.initialize(callsControllerFunctionName);
-        nodeCallsControllerFunctionNode.initialize(this.appendEvent, callsControllerFunctionName);
-
-        this.customNodes.set(CustomNode.ConsoleOutputDisableExpressionNode, consoleOutputDisableExpressionNode);
-        this.customNodes.set(CustomNode.NodeCallsControllerFunctionNode, nodeCallsControllerFunctionNode);
-    }
-}

+ 5 - 10
src/custom-nodes/control-flow-flattening-nodes/BinaryExpressionFunctionNode.ts

@@ -6,8 +6,7 @@ import type { BinaryOperator } from 'estree';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TStatement } from '../../types/node/TStatement';
 import { TStatement } from '../../types/node/TStatement';
 
 
-import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
-import { ICustomNodeObfuscator } from '../../interfaces/custom-nodes/ICustomNodeObfuscator';
+import { ICustomCodeHelperFormatter } from '../../interfaces/custom-code-helpers/ICustomCodeHelperFormatter';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
 
 
@@ -24,23 +23,20 @@ export class BinaryExpressionFunctionNode extends AbstractCustomNode {
 
 
     /**
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
-     * @param {ICustomNodeFormatter} customNodeFormatter
-     * @param {ICustomNodeObfuscator} customNodeObfuscator
+     * @param {ICustomCodeHelperFormatter} customCodeHelperFormatter
      * @param {IRandomGenerator} randomGenerator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      * @param {IOptions} options
      */
      */
     public constructor (
     public constructor (
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
-        @inject(ServiceIdentifiers.ICustomNodeFormatter) customNodeFormatter: ICustomNodeFormatter,
-        @inject(ServiceIdentifiers.ICustomNodeObfuscator) customNodeObfuscator: ICustomNodeObfuscator,
+        @inject(ServiceIdentifiers.ICustomCodeHelperFormatter) customCodeHelperFormatter: ICustomCodeHelperFormatter,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
     ) {
         super(
         super(
             identifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory,
-            customNodeFormatter,
-            customNodeObfuscator,
+            customCodeHelperFormatter,
             randomGenerator,
             randomGenerator,
             options
             options
         );
         );
@@ -54,10 +50,9 @@ export class BinaryExpressionFunctionNode extends AbstractCustomNode {
     }
     }
 
 
     /**
     /**
-     * @param {string} nodeTemplate
      * @returns {TStatement[]}
      * @returns {TStatement[]}
      */
      */
-    protected getNodeStructure (nodeTemplate: string): TStatement[] {
+    protected getNodeStructure (): TStatement[] {
         const structure: TStatement = NodeFactory.expressionStatementNode(
         const structure: TStatement = NodeFactory.expressionStatementNode(
             NodeFactory.functionExpressionNode(
             NodeFactory.functionExpressionNode(
                 [
                 [

+ 5 - 10
src/custom-nodes/control-flow-flattening-nodes/BlockStatementControlFlowFlatteningNode.ts

@@ -6,8 +6,7 @@ import * as ESTree from 'estree';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TStatement } from '../../types/node/TStatement';
 import { TStatement } from '../../types/node/TStatement';
 
 
-import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
-import { ICustomNodeObfuscator } from '../../interfaces/custom-nodes/ICustomNodeObfuscator';
+import { ICustomCodeHelperFormatter } from '../../interfaces/custom-code-helpers/ICustomCodeHelperFormatter';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
 
 
@@ -40,23 +39,20 @@ export class BlockStatementControlFlowFlatteningNode extends AbstractCustomNode
 
 
     /**
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
-     * @param {ICustomNodeFormatter} customNodeFormatter
-     * @param {ICustomNodeObfuscator} customNodeObfuscator
+     * @param {ICustomCodeHelperFormatter} customCodeHelperFormatter
      * @param {IRandomGenerator} randomGenerator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      * @param {IOptions} options
      */
      */
     public constructor (
     public constructor (
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
-        @inject(ServiceIdentifiers.ICustomNodeFormatter) customNodeFormatter: ICustomNodeFormatter,
-        @inject(ServiceIdentifiers.ICustomNodeObfuscator) customNodeObfuscator: ICustomNodeObfuscator,
+        @inject(ServiceIdentifiers.ICustomCodeHelperFormatter) customCodeHelperFormatter: ICustomCodeHelperFormatter,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
     ) {
         super(
         super(
             identifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory,
-            customNodeFormatter,
-            customNodeObfuscator,
+            customCodeHelperFormatter,
             randomGenerator,
             randomGenerator,
             options
             options
         );
         );
@@ -78,10 +74,9 @@ export class BlockStatementControlFlowFlatteningNode extends AbstractCustomNode
     }
     }
 
 
     /**
     /**
-     * @param {string} nodeTemplate
      * @returns {TStatement[]}
      * @returns {TStatement[]}
      */
      */
-    protected getNodeStructure (nodeTemplate: string): TStatement[] {
+    protected getNodeStructure (): TStatement[] {
         const controllerIdentifierName: string = this.randomGenerator.getRandomString(6);
         const controllerIdentifierName: string = this.randomGenerator.getRandomString(6);
         const indexIdentifierName: string = this.randomGenerator.getRandomString(6);
         const indexIdentifierName: string = this.randomGenerator.getRandomString(6);
         const structure: ESTree.BlockStatement = NodeFactory.blockStatementNode([
         const structure: ESTree.BlockStatement = NodeFactory.blockStatementNode([

+ 5 - 10
src/custom-nodes/control-flow-flattening-nodes/CallExpressionFunctionNode.ts

@@ -6,8 +6,7 @@ import * as ESTree from 'estree';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TStatement } from '../../types/node/TStatement';
 import { TStatement } from '../../types/node/TStatement';
 
 
-import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
-import { ICustomNodeObfuscator } from '../../interfaces/custom-nodes/ICustomNodeObfuscator';
+import { ICustomCodeHelperFormatter } from '../../interfaces/custom-code-helpers/ICustomCodeHelperFormatter';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
 
 
@@ -27,23 +26,20 @@ export class CallExpressionFunctionNode extends AbstractCustomNode {
 
 
     /**
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
-     * @param {ICustomNodeFormatter} customNodeFormatter
-     * @param {ICustomNodeObfuscator} customNodeObfuscator
+     * @param {ICustomCodeHelperFormatter} customCodeHelperFormatter
      * @param {IRandomGenerator} randomGenerator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      * @param {IOptions} options
      */
      */
     public constructor (
     public constructor (
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
-        @inject(ServiceIdentifiers.ICustomNodeFormatter) customNodeFormatter: ICustomNodeFormatter,
-        @inject(ServiceIdentifiers.ICustomNodeObfuscator) customNodeObfuscator: ICustomNodeObfuscator,
+        @inject(ServiceIdentifiers.ICustomCodeHelperFormatter) customCodeHelperFormatter: ICustomCodeHelperFormatter,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
     ) {
         super(
         super(
             identifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory,
-            customNodeFormatter,
-            customNodeObfuscator,
+            customCodeHelperFormatter,
             randomGenerator,
             randomGenerator,
             options
             options
         );
         );
@@ -57,10 +53,9 @@ export class CallExpressionFunctionNode extends AbstractCustomNode {
     }
     }
 
 
     /**
     /**
-     * @param {string} nodeTemplate
      * @returns {TStatement[]}
      * @returns {TStatement[]}
      */
      */
-    protected getNodeStructure (nodeTemplate: string): TStatement[] {
+    protected getNodeStructure (): TStatement[] {
         const calleeIdentifier: ESTree.Identifier = NodeFactory.identifierNode('callee');
         const calleeIdentifier: ESTree.Identifier = NodeFactory.identifierNode('callee');
         const params: ESTree.Identifier[] = [];
         const params: ESTree.Identifier[] = [];
         const argumentsLength: number = this.expressionArguments.length;
         const argumentsLength: number = this.expressionArguments.length;

+ 5 - 10
src/custom-nodes/control-flow-flattening-nodes/LogicalExpressionFunctionNode.ts

@@ -6,8 +6,7 @@ import type { LogicalOperator } from 'estree';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TStatement } from '../../types/node/TStatement';
 import { TStatement } from '../../types/node/TStatement';
 
 
-import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
-import { ICustomNodeObfuscator } from '../../interfaces/custom-nodes/ICustomNodeObfuscator';
+import { ICustomCodeHelperFormatter } from '../../interfaces/custom-code-helpers/ICustomCodeHelperFormatter';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
 
 
@@ -24,23 +23,20 @@ export class LogicalExpressionFunctionNode extends AbstractCustomNode {
 
 
     /**
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
-     * @param {ICustomNodeFormatter} customNodeFormatter
-     * @param {ICustomNodeObfuscator} customNodeObfuscator
+     * @param {ICustomCodeHelperFormatter} customCodeHelperFormatter
      * @param {IRandomGenerator} randomGenerator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      * @param {IOptions} options
      */
      */
     public constructor (
     public constructor (
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
-        @inject(ServiceIdentifiers.ICustomNodeFormatter) customNodeFormatter: ICustomNodeFormatter,
-        @inject(ServiceIdentifiers.ICustomNodeObfuscator) customNodeObfuscator: ICustomNodeObfuscator,
+        @inject(ServiceIdentifiers.ICustomCodeHelperFormatter) customCodeHelperFormatter: ICustomCodeHelperFormatter,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
     ) {
         super(
         super(
             identifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory,
-            customNodeFormatter,
-            customNodeObfuscator,
+            customCodeHelperFormatter,
             randomGenerator,
             randomGenerator,
             options
             options
         );
         );
@@ -54,10 +50,9 @@ export class LogicalExpressionFunctionNode extends AbstractCustomNode {
     }
     }
 
 
     /**
     /**
-     * @param {string} nodeTemplate
      * @returns {TStatement[]}
      * @returns {TStatement[]}
      */
      */
-    protected getNodeStructure (nodeTemplate: string): TStatement[] {
+    protected getNodeStructure (): TStatement[] {
         const structure: TStatement = NodeFactory.expressionStatementNode(
         const structure: TStatement = NodeFactory.expressionStatementNode(
             NodeFactory.functionExpressionNode(
             NodeFactory.functionExpressionNode(
                 [
                 [

+ 5 - 10
src/custom-nodes/control-flow-flattening-nodes/StringLiteralNode.ts

@@ -4,8 +4,7 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TStatement } from '../../types/node/TStatement';
 import { TStatement } from '../../types/node/TStatement';
 
 
-import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
-import { ICustomNodeObfuscator } from '../../interfaces/custom-nodes/ICustomNodeObfuscator';
+import { ICustomCodeHelperFormatter } from '../../interfaces/custom-code-helpers/ICustomCodeHelperFormatter';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
 
 
@@ -24,23 +23,20 @@ export class StringLiteralNode extends AbstractCustomNode {
 
 
     /**
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
-     * @param {ICustomNodeFormatter} customNodeFormatter
-     * @param {ICustomNodeObfuscator} customNodeObfuscator
+     * @param {ICustomCodeHelperFormatter} customCodeHelperFormatter
      * @param {IRandomGenerator} randomGenerator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      * @param {IOptions} options
      */
      */
     public constructor (
     public constructor (
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
-        @inject(ServiceIdentifiers.ICustomNodeFormatter) customNodeFormatter: ICustomNodeFormatter,
-        @inject(ServiceIdentifiers.ICustomNodeObfuscator) customNodeObfuscator: ICustomNodeObfuscator,
+        @inject(ServiceIdentifiers.ICustomCodeHelperFormatter) customCodeHelperFormatter: ICustomCodeHelperFormatter,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
     ) {
         super(
         super(
             identifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory,
-            customNodeFormatter,
-            customNodeObfuscator,
+            customCodeHelperFormatter,
             randomGenerator,
             randomGenerator,
             options
             options
         );
         );
@@ -54,10 +50,9 @@ export class StringLiteralNode extends AbstractCustomNode {
     }
     }
 
 
     /**
     /**
-     * @param {string} nodeTemplate
      * @returns {TStatement[]}
      * @returns {TStatement[]}
      */
      */
-    protected getNodeStructure (nodeTemplate: string): TStatement[] {
+    protected getNodeStructure (): TStatement[] {
         const structure: TStatement = NodeFactory.expressionStatementNode(
         const structure: TStatement = NodeFactory.expressionStatementNode(
             NodeFactory.literalNode(this.literalValue)
             NodeFactory.literalNode(this.literalValue)
         );
         );

+ 7 - 8
src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/CallExpressionControlFlowStorageCallNode.ts

@@ -6,8 +6,7 @@ import type * as ESTree from 'estree';
 import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TStatement } from '../../../types/node/TStatement';
 import { TStatement } from '../../../types/node/TStatement';
 
 
-import { ICustomNodeFormatter } from '../../../interfaces/custom-nodes/ICustomNodeFormatter';
-import { ICustomNodeObfuscator } from '../../../interfaces/custom-nodes/ICustomNodeObfuscator';
+import { ICustomCodeHelperFormatter } from '../../../interfaces/custom-code-helpers/ICustomCodeHelperFormatter';
 import { IOptions } from '../../../interfaces/options/IOptions';
 import { IOptions } from '../../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../../interfaces/utils/IRandomGenerator';
 import { IRandomGenerator } from '../../../interfaces/utils/IRandomGenerator';
 
 
@@ -45,23 +44,20 @@ export class CallExpressionControlFlowStorageCallNode extends AbstractCustomNode
 
 
     /**
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
-     * @param {ICustomNodeFormatter} customNodeFormatter
-     * @param {ICustomNodeObfuscator} customNodeObfuscator
+     * @param {ICustomCodeHelperFormatter} customCodeHelperFormatter
      * @param {IRandomGenerator} randomGenerator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      * @param {IOptions} options
      */
      */
     public constructor (
     public constructor (
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
-        @inject(ServiceIdentifiers.ICustomNodeFormatter) customNodeFormatter: ICustomNodeFormatter,
-        @inject(ServiceIdentifiers.ICustomNodeObfuscator) customNodeObfuscator: ICustomNodeObfuscator,
+        @inject(ServiceIdentifiers.ICustomCodeHelperFormatter) customCodeHelperFormatter: ICustomCodeHelperFormatter,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
     ) {
         super(
         super(
             identifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory,
-            customNodeFormatter,
-            customNodeObfuscator,
+            customCodeHelperFormatter,
             randomGenerator,
             randomGenerator,
             options
             options
         );
         );
@@ -85,6 +81,9 @@ export class CallExpressionControlFlowStorageCallNode extends AbstractCustomNode
         this.expressionArguments = expressionArguments;
         this.expressionArguments = expressionArguments;
     }
     }
 
 
+    /**
+     * @returns {TStatement[]}
+     */
     protected getNodeStructure (): TStatement[] {
     protected getNodeStructure (): TStatement[] {
         const structure: TStatement = NodeFactory.expressionStatementNode(
         const structure: TStatement = NodeFactory.expressionStatementNode(
             NodeFactory.callExpressionNode(
             NodeFactory.callExpressionNode(

+ 5 - 10
src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ControlFlowStorageNode.ts

@@ -7,8 +7,7 @@ import { TControlFlowStorage } from '../../../types/storages/TControlFlowStorage
 import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TStatement } from '../../../types/node/TStatement';
 import { TStatement } from '../../../types/node/TStatement';
 
 
-import { ICustomNodeFormatter } from '../../../interfaces/custom-nodes/ICustomNodeFormatter';
-import { ICustomNodeObfuscator } from '../../../interfaces/custom-nodes/ICustomNodeObfuscator';
+import { ICustomCodeHelperFormatter } from '../../../interfaces/custom-code-helpers/ICustomCodeHelperFormatter';
 import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
 import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
 import { IOptions } from '../../../interfaces/options/IOptions';
 import { IOptions } from '../../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../../interfaces/utils/IRandomGenerator';
 import { IRandomGenerator } from '../../../interfaces/utils/IRandomGenerator';
@@ -30,23 +29,20 @@ export class ControlFlowStorageNode extends AbstractCustomNode {
 
 
     /**
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
-     * @param {ICustomNodeFormatter} customNodeFormatter
-     * @param {ICustomNodeObfuscator} customNodeObfuscator
+     * @param {ICustomCodeHelperFormatter} customCodeHelperFormatter
      * @param {IRandomGenerator} randomGenerator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      * @param {IOptions} options
      */
      */
     public constructor (
     public constructor (
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
-        @inject(ServiceIdentifiers.ICustomNodeFormatter) customNodeFormatter: ICustomNodeFormatter,
-        @inject(ServiceIdentifiers.ICustomNodeObfuscator) customNodeObfuscator: ICustomNodeObfuscator,
+        @inject(ServiceIdentifiers.ICustomCodeHelperFormatter) customCodeHelperFormatter: ICustomCodeHelperFormatter,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
     ) {
         super(
         super(
             identifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory,
-            customNodeFormatter,
-            customNodeObfuscator,
+            customCodeHelperFormatter,
             randomGenerator,
             randomGenerator,
             options
             options
         );
         );
@@ -60,10 +56,9 @@ export class ControlFlowStorageNode extends AbstractCustomNode {
     }
     }
 
 
     /**
     /**
-     * @param {string} nodeTemplate
      * @returns {TStatement[]}
      * @returns {TStatement[]}
      */
      */
-    protected getNodeStructure (nodeTemplate: string): TStatement[] {
+    protected getNodeStructure (): TStatement[] {
         const propertyNodes: ESTree.Property[] = Array
         const propertyNodes: ESTree.Property[] = Array
             .from<[string, ICustomNode]>(this.controlFlowStorage.getStorage())
             .from<[string, ICustomNode]>(this.controlFlowStorage.getStorage())
             .map(([key, value]: [string, ICustomNode]) => {
             .map(([key, value]: [string, ICustomNode]) => {

+ 7 - 8
src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ExpressionWithOperatorControlFlowStorageCallNode.ts

@@ -6,10 +6,9 @@ import type { Expression } from 'estree';
 import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TStatement } from '../../../types/node/TStatement';
 import { TStatement } from '../../../types/node/TStatement';
 
 
-import { ICustomNodeObfuscator } from '../../../interfaces/custom-nodes/ICustomNodeObfuscator';
+import { ICustomCodeHelperFormatter } from '../../../interfaces/custom-code-helpers/ICustomCodeHelperFormatter';
 import { IOptions } from '../../../interfaces/options/IOptions';
 import { IOptions } from '../../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../../interfaces/utils/IRandomGenerator';
 import { IRandomGenerator } from '../../../interfaces/utils/IRandomGenerator';
-import { ICustomNodeFormatter } from '../../../interfaces/custom-nodes/ICustomNodeFormatter';
 
 
 import { initializable } from '../../../decorators/Initializable';
 import { initializable } from '../../../decorators/Initializable';
 
 
@@ -43,23 +42,20 @@ export class ExpressionWithOperatorControlFlowStorageCallNode extends AbstractCu
 
 
     /**
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
-     * @param {ICustomNodeFormatter} customNodeFormatter
-     * @param {ICustomNodeObfuscator} customNodeObfuscator
+     * @param {ICustomCodeHelperFormatter} customCodeHelperFormatter
      * @param {IRandomGenerator} randomGenerator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      * @param {IOptions} options
      */
      */
     public constructor (
     public constructor (
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
-        @inject(ServiceIdentifiers.ICustomNodeFormatter) customNodeFormatter: ICustomNodeFormatter,
-        @inject(ServiceIdentifiers.ICustomNodeObfuscator) customNodeObfuscator: ICustomNodeObfuscator,
+        @inject(ServiceIdentifiers.ICustomCodeHelperFormatter) customCodeHelperFormatter: ICustomCodeHelperFormatter,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
     ) {
         super(
         super(
             identifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory,
-            customNodeFormatter,
-            customNodeObfuscator,
+            customCodeHelperFormatter,
             randomGenerator,
             randomGenerator,
             options
             options
         );
         );
@@ -83,6 +79,9 @@ export class ExpressionWithOperatorControlFlowStorageCallNode extends AbstractCu
         this.rightValue = rightValue;
         this.rightValue = rightValue;
     }
     }
 
 
+    /**
+     * @returns {TStatement[]}
+     */
     protected getNodeStructure (): TStatement[] {
     protected getNodeStructure (): TStatement[] {
         const structure: TStatement = NodeFactory.expressionStatementNode(
         const structure: TStatement = NodeFactory.expressionStatementNode(
             NodeFactory.callExpressionNode(
             NodeFactory.callExpressionNode(

+ 7 - 8
src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/StringLiteralControlFlowStorageCallNode.ts

@@ -4,8 +4,7 @@ import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
 import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TStatement } from '../../../types/node/TStatement';
 import { TStatement } from '../../../types/node/TStatement';
 
 
-import { ICustomNodeFormatter } from '../../../interfaces/custom-nodes/ICustomNodeFormatter';
-import { ICustomNodeObfuscator } from '../../../interfaces/custom-nodes/ICustomNodeObfuscator';
+import { ICustomCodeHelperFormatter } from '../../../interfaces/custom-code-helpers/ICustomCodeHelperFormatter';
 import { IOptions } from '../../../interfaces/options/IOptions';
 import { IOptions } from '../../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../../interfaces/utils/IRandomGenerator';
 import { IRandomGenerator } from '../../../interfaces/utils/IRandomGenerator';
 
 
@@ -31,23 +30,20 @@ export class StringLiteralControlFlowStorageCallNode extends AbstractCustomNode
 
 
     /**
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
-     * @param {ICustomNodeFormatter} customNodeFormatter
-     * @param {ICustomNodeObfuscator} customNodeObfuscator
+     * @param {ICustomCodeHelperFormatter} customCodeHelperFormatter
      * @param {IRandomGenerator} randomGenerator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      * @param {IOptions} options
      */
      */
     public constructor (
     public constructor (
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
-        @inject(ServiceIdentifiers.ICustomNodeFormatter) customNodeFormatter: ICustomNodeFormatter,
-        @inject(ServiceIdentifiers.ICustomNodeObfuscator) customNodeObfuscator: ICustomNodeObfuscator,
+        @inject(ServiceIdentifiers.ICustomCodeHelperFormatter) customCodeHelperFormatter: ICustomCodeHelperFormatter,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
     ) {
         super(
         super(
             identifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory,
-            customNodeFormatter,
-            customNodeObfuscator,
+            customCodeHelperFormatter,
             randomGenerator,
             randomGenerator,
             options
             options
         );
         );
@@ -65,6 +61,9 @@ export class StringLiteralControlFlowStorageCallNode extends AbstractCustomNode
         this.controlFlowStorageKey = controlFlowStorageKey;
         this.controlFlowStorageKey = controlFlowStorageKey;
     }
     }
 
 
+    /**
+     * @returns {TStatement[]}
+     */
     protected getNodeStructure (): TStatement[] {
     protected getNodeStructure (): TStatement[] {
         const structure: TStatement = NodeFactory.expressionStatementNode(
         const structure: TStatement = NodeFactory.expressionStatementNode(
             NodeFactory.memberExpressionNode(
             NodeFactory.memberExpressionNode(

+ 5 - 10
src/custom-nodes/dead-code-injection-nodes/BlockStatementDeadCodeInjectionNode.ts

@@ -6,8 +6,7 @@ import type { BinaryOperator, BlockStatement } from 'estree';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
 import { TStatement } from '../../types/node/TStatement';
 import { TStatement } from '../../types/node/TStatement';
 
 
-import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
-import { ICustomNodeObfuscator } from '../../interfaces/custom-nodes/ICustomNodeObfuscator';
+import { ICustomCodeHelperFormatter } from '../../interfaces/custom-code-helpers/ICustomCodeHelperFormatter';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
 
 
@@ -29,23 +28,20 @@ export class BlockStatementDeadCodeInjectionNode extends AbstractCustomNode {
 
 
     /**
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
-     * @param {ICustomNodeFormatter} customNodeFormatter
-     * @param {ICustomNodeObfuscator} customNodeObfuscator
+     * @param {ICustomCodeHelperFormatter} customCodeHelperFormatter
      * @param {IRandomGenerator} randomGenerator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      * @param {IOptions} options
      */
      */
     public constructor (
     public constructor (
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
-        @inject(ServiceIdentifiers.ICustomNodeFormatter) customNodeFormatter: ICustomNodeFormatter,
-        @inject(ServiceIdentifiers.ICustomNodeObfuscator) customNodeObfuscator: ICustomNodeObfuscator,
+        @inject(ServiceIdentifiers.ICustomCodeHelperFormatter) customCodeHelperFormatter: ICustomCodeHelperFormatter,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
     ) {
         super(
         super(
             identifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory,
-            customNodeFormatter,
-            customNodeObfuscator,
+            customCodeHelperFormatter,
             randomGenerator,
             randomGenerator,
             options
             options
         );
         );
@@ -64,10 +60,9 @@ export class BlockStatementDeadCodeInjectionNode extends AbstractCustomNode {
     }
     }
 
 
     /**
     /**
-     * @param {string} nodeTemplate
      * @returns {TStatement[]}
      * @returns {TStatement[]}
      */
      */
-    protected getNodeStructure (nodeTemplate: string): TStatement[] {
+    protected getNodeStructure (): TStatement[] {
         const random1: boolean = this.randomGenerator.getMathRandom() > 0.5;
         const random1: boolean = this.randomGenerator.getMathRandom() > 0.5;
         const random2: boolean = this.randomGenerator.getMathRandom() > 0.5;
         const random2: boolean = this.randomGenerator.getMathRandom() > 0.5;
 
 

+ 0 - 138
src/custom-nodes/debug-protection-nodes/group/DebugProtectionCustomNodeGroup.ts

@@ -1,138 +0,0 @@
-import { inject, injectable, } from 'inversify';
-import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
-
-import { TCustomNodeFactory } from '../../../types/container/custom-nodes/TCustomNodeFactory';
-import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory';
-import { TInitialData } from '../../../types/TInitialData';
-import { TNodeWithStatements } from '../../../types/node/TNodeWithStatements';
-
-import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
-import { IOptions } from '../../../interfaces/options/IOptions';
-import { IRandomGenerator } from '../../../interfaces/utils/IRandomGenerator';
-import { ICallsGraphData } from '../../../interfaces/analyzers/calls-graph-analyzer/ICallsGraphData';
-
-import { initializable } from '../../../decorators/Initializable';
-
-import { CustomNode } from '../../../enums/custom-nodes/CustomNode';
-import { ObfuscationEvent } from '../../../enums/event-emitters/ObfuscationEvent';
-
-import { AbstractCustomNodeGroup } from '../../AbstractCustomNodeGroup';
-import { DebugProtectionFunctionNode } from '../DebugProtectionFunctionNode';
-import { DebugProtectionFunctionCallNode } from '../DebugProtectionFunctionCallNode';
-import { DebugProtectionFunctionIntervalNode } from '../DebugProtectionFunctionIntervalNode';
-import { NodeAppender } from '../../../node/NodeAppender';
-import { NodeCallsControllerFunctionNode } from '../../node-calls-controller-nodes/NodeCallsControllerFunctionNode';
-import { NodeGuards } from '../../../node/NodeGuards';
-
-@injectable()
-export class DebugProtectionCustomNodeGroup extends AbstractCustomNodeGroup {
-    /**
-     * @type {ObfuscationEvent}
-     */
-    protected readonly appendEvent: ObfuscationEvent = ObfuscationEvent.BeforeObfuscation;
-
-    /**
-     * @type {Map<CustomNode, ICustomNode>}
-     */
-    @initializable()
-    protected customNodes!: Map <CustomNode, ICustomNode>;
-
-    /**
-     * @type {TCustomNodeFactory}
-     */
-    private readonly customNodeFactory: TCustomNodeFactory;
-
-    /**
-     * @param {TCustomNodeFactory} customNodeFactory
-     * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
-     * @param {IRandomGenerator} randomGenerator
-     * @param {IOptions} options
-     */
-    public constructor (
-        @inject(ServiceIdentifiers.Factory__ICustomNode) customNodeFactory: TCustomNodeFactory,
-        @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
-            identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
-        @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
-        @inject(ServiceIdentifiers.IOptions) options: IOptions
-    ) {
-        super(identifierNamesGeneratorFactory, randomGenerator, options);
-
-        this.customNodeFactory = customNodeFactory;
-    }
-
-    /**
-     * @param {TNodeWithStatements} nodeWithStatements
-     * @param {ICallsGraphData[]} callsGraphData
-     */
-    public appendCustomNodes (nodeWithStatements: TNodeWithStatements, callsGraphData: ICallsGraphData[]): void {
-        const randomCallsGraphIndex: number = this.getRandomCallsGraphIndex(callsGraphData.length);
-
-        // debugProtectionFunctionCallNode append
-        this.appendCustomNodeIfExist(CustomNode.DebugProtectionFunctionCallNode, (customNode: ICustomNode) => {
-            NodeAppender.appendToOptimalBlockScope(
-                callsGraphData,
-                nodeWithStatements,
-                customNode.getNode(),
-                randomCallsGraphIndex
-            );
-        });
-
-        // debugProtectionFunctionNode append
-        this.appendCustomNodeIfExist(CustomNode.DebugProtectionFunctionNode, (customNode: ICustomNode) => {
-            NodeAppender.append(nodeWithStatements, customNode.getNode());
-        });
-
-        // debugProtectionFunctionIntervalNode append
-        this.appendCustomNodeIfExist(CustomNode.DebugProtectionFunctionIntervalNode, (customNode: ICustomNode) => {
-            const programBodyLength: number = NodeGuards.isSwitchCaseNode(nodeWithStatements)
-                ? nodeWithStatements.consequent.length
-                : nodeWithStatements.body.length;
-            const randomIndex: number = this.randomGenerator.getRandomInteger(0, programBodyLength);
-
-            NodeAppender.insertAtIndex(nodeWithStatements, customNode.getNode(), randomIndex);
-        });
-
-        // nodeCallsControllerFunctionNode append
-        this.appendCustomNodeIfExist(CustomNode.NodeCallsControllerFunctionNode, (customNode: ICustomNode) => {
-            const targetNodeWithStatements: TNodeWithStatements = callsGraphData.length
-                ? NodeAppender.getOptimalBlockScope(callsGraphData, randomCallsGraphIndex, 1)
-                : nodeWithStatements;
-
-            NodeAppender.prepend(targetNodeWithStatements, customNode.getNode());
-        });
-    }
-
-    public initialize (): void {
-        this.customNodes = new Map <CustomNode, ICustomNode>();
-
-        if (!this.options.debugProtection) {
-            return;
-        }
-
-        const debugProtectionFunctionName: string = this.identifierNamesGenerator.generate();
-        const callsControllerFunctionName: string = this.identifierNamesGenerator.generate();
-
-        const debugProtectionFunctionNode: ICustomNode<TInitialData<DebugProtectionFunctionNode>> =
-            this.customNodeFactory(CustomNode.DebugProtectionFunctionNode);
-        const debugProtectionFunctionCallNode: ICustomNode<TInitialData<DebugProtectionFunctionCallNode>> =
-            this.customNodeFactory(CustomNode.DebugProtectionFunctionCallNode);
-        const debugProtectionFunctionIntervalNode: ICustomNode<TInitialData<DebugProtectionFunctionIntervalNode>> =
-            this.customNodeFactory(CustomNode.DebugProtectionFunctionIntervalNode);
-        const nodeCallsControllerFunctionNode: ICustomNode<TInitialData<NodeCallsControllerFunctionNode>> =
-            this.customNodeFactory(CustomNode.NodeCallsControllerFunctionNode);
-
-        debugProtectionFunctionNode.initialize(debugProtectionFunctionName);
-        debugProtectionFunctionCallNode.initialize(debugProtectionFunctionName, callsControllerFunctionName);
-        debugProtectionFunctionIntervalNode.initialize(debugProtectionFunctionName);
-        nodeCallsControllerFunctionNode.initialize(this.appendEvent, callsControllerFunctionName);
-
-        this.customNodes.set(CustomNode.DebugProtectionFunctionNode, debugProtectionFunctionNode);
-        this.customNodes.set(CustomNode.DebugProtectionFunctionCallNode, debugProtectionFunctionCallNode);
-
-        if (this.options.debugProtectionInterval) {
-            this.customNodes.set(CustomNode.DebugProtectionFunctionIntervalNode, debugProtectionFunctionIntervalNode);
-        }
-
-        this.customNodes.set(CustomNode.NodeCallsControllerFunctionNode, nodeCallsControllerFunctionNode);
-    }
-}

+ 5 - 10
src/custom-nodes/object-expression-keys-transformer-nodes/ObjectExpressionVariableDeclarationHostNode.ts

@@ -7,8 +7,7 @@ import { TIdentifierNamesGeneratorFactory } from '../../types/container/generato
 import { TNodeWithLexicalScope } from '../../types/node/TNodeWithLexicalScope';
 import { TNodeWithLexicalScope } from '../../types/node/TNodeWithLexicalScope';
 import { TStatement } from '../../types/node/TStatement';
 import { TStatement } from '../../types/node/TStatement';
 
 
-import { ICustomNodeFormatter } from '../../interfaces/custom-nodes/ICustomNodeFormatter';
-import { ICustomNodeObfuscator } from '../../interfaces/custom-nodes/ICustomNodeObfuscator';
+import { ICustomCodeHelperFormatter } from '../../interfaces/custom-code-helpers/ICustomCodeHelperFormatter';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
 
 
@@ -29,23 +28,20 @@ export class ObjectExpressionVariableDeclarationHostNode extends AbstractCustomN
 
 
     /**
     /**
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
      * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
-     * @param {ICustomNodeFormatter} customNodeFormatter
-     * @param {ICustomNodeObfuscator} customNodeObfuscator
+     * @param {ICustomCodeHelperFormatter} customCodeHelperFormatter
      * @param {IRandomGenerator} randomGenerator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      * @param {IOptions} options
      */
      */
     public constructor (
     public constructor (
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
         @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
-        @inject(ServiceIdentifiers.ICustomNodeFormatter) customNodeFormatter: ICustomNodeFormatter,
-        @inject(ServiceIdentifiers.ICustomNodeObfuscator) customNodeObfuscator: ICustomNodeObfuscator,
+        @inject(ServiceIdentifiers.ICustomCodeHelperFormatter) customCodeHelperFormatter: ICustomCodeHelperFormatter,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
     ) {
         super(
         super(
             identifierNamesGeneratorFactory,
             identifierNamesGeneratorFactory,
-            customNodeFormatter,
-            customNodeObfuscator,
+            customCodeHelperFormatter,
             randomGenerator,
             randomGenerator,
             options
             options
         );
         );
@@ -57,10 +53,9 @@ export class ObjectExpressionVariableDeclarationHostNode extends AbstractCustomN
     }
     }
 
 
     /**
     /**
-     * @param {string} nodeTemplate
      * @returns {TStatement[]}
      * @returns {TStatement[]}
      */
      */
-    protected getNodeStructure (nodeTemplate: string): TStatement[] {
+    protected getNodeStructure (): TStatement[] {
         const variableDeclarationName: string = NodeGuards.isProgramNode(this.lexicalScopeNode)
         const variableDeclarationName: string = NodeGuards.isProgramNode(this.lexicalScopeNode)
             ? this.identifierNamesGenerator.generate()
             ? this.identifierNamesGenerator.generate()
             : this.identifierNamesGenerator.generateForLexicalScope(this.lexicalScopeNode);
             : this.identifierNamesGenerator.generateForLexicalScope(this.lexicalScopeNode);

+ 0 - 124
src/custom-nodes/string-array-nodes/group/StringArrayCustomNodeGroup.ts

@@ -1,124 +0,0 @@
-import { inject, injectable, } from 'inversify';
-import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
-
-import { TCustomNodeFactory } from '../../../types/container/custom-nodes/TCustomNodeFactory';
-import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory';
-import { TInitialData } from '../../../types/TInitialData';
-import { TNodeWithStatements } from '../../../types/node/TNodeWithStatements';
-
-import { ICallsGraphData } from '../../../interfaces/analyzers/calls-graph-analyzer/ICallsGraphData';
-import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
-import { IOptions } from '../../../interfaces/options/IOptions';
-import { IRandomGenerator } from '../../../interfaces/utils/IRandomGenerator';
-import { IStringArrayStorage } from '../../../interfaces/storages/string-array-storage/IStringArrayStorage';
-
-import { initializable } from '../../../decorators/Initializable';
-
-import { CustomNode } from '../../../enums/custom-nodes/CustomNode';
-import { ObfuscationEvent } from '../../../enums/event-emitters/ObfuscationEvent';
-
-import { AbstractCustomNodeGroup } from '../../AbstractCustomNodeGroup';
-import { NodeAppender } from '../../../node/NodeAppender';
-import { StringArrayNode } from '../StringArrayNode';
-import { StringArrayCallsWrapper } from '../StringArrayCallsWrapper';
-import { StringArrayRotateFunctionNode } from '../StringArrayRotateFunctionNode';
-
-@injectable()
-export class StringArrayCustomNodeGroup extends AbstractCustomNodeGroup {
-    /**
-     * @type {ObfuscationEvent}
-     */
-    protected appendEvent: ObfuscationEvent = ObfuscationEvent.AfterObfuscation;
-
-    /**
-     * @type {Map<CustomNode, ICustomNode>}
-     */
-    @initializable()
-    protected customNodes!: Map <CustomNode, ICustomNode>;
-
-    /**
-     * @type {TCustomNodeFactory}
-     */
-    private readonly customNodeFactory: TCustomNodeFactory;
-
-    /**
-     * @type {IStringArrayStorage}
-     */
-    private readonly stringArrayStorage: IStringArrayStorage;
-
-    /**
-     * @param {TCustomNodeFactory} customNodeFactory
-     * @param {IStringArrayStorage} stringArrayStorage
-     * @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
-     * @param {IRandomGenerator} randomGenerator
-     * @param {IOptions} options
-     */
-    public constructor (
-        @inject(ServiceIdentifiers.Factory__ICustomNode) customNodeFactory: TCustomNodeFactory,
-        @inject(ServiceIdentifiers.IStringArrayStorage) stringArrayStorage: IStringArrayStorage,
-        @inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
-            identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
-        @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
-        @inject(ServiceIdentifiers.IOptions) options: IOptions
-    ) {
-        super(identifierNamesGeneratorFactory, randomGenerator, options);
-
-        this.customNodeFactory = customNodeFactory;
-        this.stringArrayStorage = stringArrayStorage;
-    }
-
-    /**
-     * @param {TNodeWithStatements} nodeWithStatements
-     * @param {ICallsGraphData[]} callsGraphData
-     */
-    public appendCustomNodes (nodeWithStatements: TNodeWithStatements, callsGraphData: ICallsGraphData[]): void {
-        if (!this.stringArrayStorage.getLength()) {
-            return;
-        }
-
-        // stringArrayNode append
-        this.appendCustomNodeIfExist(CustomNode.StringArrayNode, (customNode: ICustomNode) => {
-            NodeAppender.prepend(nodeWithStatements, customNode.getNode());
-        });
-
-        // stringArrayCallsWrapper append
-        this.appendCustomNodeIfExist(CustomNode.StringArrayCallsWrapper, (customNode: ICustomNode) => {
-            NodeAppender.insertAtIndex(nodeWithStatements, customNode.getNode(), 1);
-        });
-
-        // stringArrayRotateFunctionNode append
-        this.appendCustomNodeIfExist(CustomNode.StringArrayRotateFunctionNode, (customNode: ICustomNode) => {
-            NodeAppender.insertAtIndex(nodeWithStatements, customNode.getNode(), 1);
-        });
-    }
-
-    public initialize (): void {
-        this.customNodes = new Map <CustomNode, ICustomNode>();
-
-        if (!this.options.stringArray) {
-            return;
-        }
-
-        const stringArrayNode: ICustomNode<TInitialData<StringArrayNode>> =
-            this.customNodeFactory(CustomNode.StringArrayNode);
-        const stringArrayCallsWrapper: ICustomNode<TInitialData<StringArrayCallsWrapper>> =
-            this.customNodeFactory(CustomNode.StringArrayCallsWrapper);
-        const stringArrayRotateFunctionNode: ICustomNode<TInitialData<StringArrayRotateFunctionNode>> =
-            this.customNodeFactory(CustomNode.StringArrayRotateFunctionNode);
-
-        const stringArrayName: string = this.stringArrayStorage.getStorageName();
-        const stringArrayCallsWrapperName: string = this.stringArrayStorage.getStorageCallsWrapperName();
-        const stringArrayRotationAmount: number = this.stringArrayStorage.getRotationAmount();
-
-        stringArrayNode.initialize(this.stringArrayStorage, stringArrayName);
-        stringArrayCallsWrapper.initialize(stringArrayName, stringArrayCallsWrapperName);
-        stringArrayRotateFunctionNode.initialize(stringArrayName, stringArrayRotationAmount);
-
-        this.customNodes.set(CustomNode.StringArrayNode, stringArrayNode);
-        this.customNodes.set(CustomNode.StringArrayCallsWrapper, stringArrayCallsWrapper);
-
-        if (this.options.rotateStringArray) {
-            this.customNodes.set(CustomNode.StringArrayRotateFunctionNode, stringArrayRotateFunctionNode);
-        }
-    }
-}

+ 12 - 0
src/enums/custom-code-helpers/CustomCodeHelper.ts

@@ -0,0 +1,12 @@
+export enum CustomCodeHelper {
+    CallsControllerFunction = 'CallsControllerFunction',
+    ConsoleOutputDisableExpression = 'ConsoleOutputDisableExpression',
+    DebugProtectionFunctionCall = 'DebugProtectionFunctionCall',
+    DebugProtectionFunctionInterval = 'DebugProtectionFunctionInterval',
+    DebugProtectionFunction = 'DebugProtectionFunction',
+    DomainLock = 'DomainLock',
+    SelfDefendingUnicode = 'SelfDefendingUnicode',
+    StringArrayCallsWrapper = 'StringArrayCallsWrapper',
+    StringArray = 'StringArray',
+    StringArrayRotateFunction = 'StringArrayRotateFunction'
+}

+ 7 - 0
src/enums/custom-code-helpers/CustomCodeHelperGroup.ts

@@ -0,0 +1,7 @@
+export enum CustomCodeHelperGroup {
+    ConsoleOutput = 'ConsoleOutput',
+    DebugProtection = 'DebugProtection',
+    DomainLock = 'DomainLock',
+    SelfDefending = 'SelfDefending',
+    StringArray = 'StringArray'
+}

+ 0 - 12
src/enums/custom-nodes/CustomNode.ts

@@ -1,12 +0,0 @@
-export enum CustomNode {
-    ConsoleOutputDisableExpressionNode = 'ConsoleOutputDisableExpressionNode',
-    DebugProtectionFunctionCallNode = 'DebugProtectionFunctionCallNode',
-    DebugProtectionFunctionIntervalNode = 'DebugProtectionFunctionIntervalNode',
-    DebugProtectionFunctionNode = 'DebugProtectionFunctionNode',
-    DomainLockNode = 'DomainLockNode',
-    NodeCallsControllerFunctionNode = 'NodeCallsControllerFunctionNode',
-    SelfDefendingUnicodeNode = 'SelfDefendingUnicodeNode',
-    StringArrayCallsWrapper = 'StringArrayCallsWrapper',
-    StringArrayNode = 'StringArrayNode',
-    StringArrayRotateFunctionNode = 'StringArrayRotateFunctionNode'
-}

+ 0 - 7
src/enums/custom-nodes/CustomNodeGroup.ts

@@ -1,7 +0,0 @@
-export enum CustomNodeGroup {
-    ConsoleOutputCustomNodeGroup = 'ConsoleOutputCustomNodeGroup',
-    DebugProtectionCustomNodeGroup = 'DebugProtectionCustomNodeGroup',
-    DomainLockCustomNodeGroup = 'DomainLockCustomNodeGroup',
-    SelfDefendingCustomNodeGroup = 'SelfDefendingCustomNodeGroup',
-    StringArrayCustomNodeGroup = 'StringArrayCustomNodeGroup'
-}

+ 1 - 1
src/enums/node-transformers/NodeTransformer.ts

@@ -1,7 +1,7 @@
 export enum NodeTransformer {
 export enum NodeTransformer {
     BlockStatementControlFlowTransformer = 'BlockStatementControlFlowTransformer',
     BlockStatementControlFlowTransformer = 'BlockStatementControlFlowTransformer',
     CommentsTransformer = 'CommentsTransformer',
     CommentsTransformer = 'CommentsTransformer',
-    CustomNodesTransformer = 'CustomNodesTransformer',
+    CustomCodeHelpersTransformer = 'CustomCodeHelpersTransformer',
     DeadCodeInjectionTransformer = 'DeadCodeInjectionTransformer',
     DeadCodeInjectionTransformer = 'DeadCodeInjectionTransformer',
     EvalCallExpressionTransformer = 'EvalCallExpressionTransformer',
     EvalCallExpressionTransformer = 'EvalCallExpressionTransformer',
     FunctionControlFlowTransformer = 'FunctionControlFlowTransformer',
     FunctionControlFlowTransformer = 'FunctionControlFlowTransformer',

+ 12 - 0
src/interfaces/custom-code-helpers/ICustomCodeHelper.ts

@@ -0,0 +1,12 @@
+import { TStatement } from '../../types/node/TStatement';
+
+import { IInitializable } from '../IInitializable';
+
+export interface ICustomCodeHelper <
+    TInitialData extends any[] = any[]
+> extends IInitializable<TInitialData> {
+    /**
+     * @returns ESTree.Node[]
+     */
+    getNode (): TStatement[];
+}

+ 1 - 1
src/interfaces/custom-nodes/ICustomNodeFormatter.ts → src/interfaces/custom-code-helpers/ICustomCodeHelperFormatter.ts

@@ -1,7 +1,7 @@
 import { TObject } from '../../types/TObject';
 import { TObject } from '../../types/TObject';
 import { TStatement } from '../../types/node/TStatement';
 import { TStatement } from '../../types/node/TStatement';
 
 
-export interface ICustomNodeFormatter {
+export interface ICustomCodeHelperFormatter {
     /**
     /**
      * @param {string} template
      * @param {string} template
      * @param {TMapping} mapping
      * @param {TMapping} mapping

+ 6 - 6
src/interfaces/custom-nodes/ICustomNodeGroup.ts → src/interfaces/custom-code-helpers/ICustomCodeHelperGroup.ts

@@ -1,18 +1,18 @@
 import { TNodeWithStatements } from '../../types/node/TNodeWithStatements';
 import { TNodeWithStatements } from '../../types/node/TNodeWithStatements';
 
 
-import { ICustomNode } from './ICustomNode';
+import { ICustomCodeHelper } from './ICustomCodeHelper';
 import { IInitializable } from '../IInitializable';
 import { IInitializable } from '../IInitializable';
 import { ICallsGraphData } from '../analyzers/calls-graph-analyzer/ICallsGraphData';
 import { ICallsGraphData } from '../analyzers/calls-graph-analyzer/ICallsGraphData';
 
 
-import { CustomNode } from '../../enums/custom-nodes/CustomNode';
+import { CustomCodeHelper } from '../../enums/custom-code-helpers/CustomCodeHelper';
 import { ObfuscationEvent } from '../../enums/event-emitters/ObfuscationEvent';
 import { ObfuscationEvent } from '../../enums/event-emitters/ObfuscationEvent';
 
 
-export interface ICustomNodeGroup extends IInitializable {
+export interface ICustomCodeHelperGroup extends IInitializable {
     /**
     /**
      * @param nodeWithStatements
      * @param nodeWithStatements
      * @param callsGraphData
      * @param callsGraphData
      */
      */
-    appendCustomNodes (nodeWithStatements: TNodeWithStatements, callsGraphData: ICallsGraphData[]): void;
+    appendNodes (nodeWithStatements: TNodeWithStatements, callsGraphData: ICallsGraphData[]): void;
 
 
     /**
     /**
      * @returns {ObfuscationEvent}
      * @returns {ObfuscationEvent}
@@ -20,9 +20,9 @@ export interface ICustomNodeGroup extends IInitializable {
     getAppendEvent (): ObfuscationEvent;
     getAppendEvent (): ObfuscationEvent;
 
 
     /**
     /**
-     * @type {Map <CustomNode, ICustomNode>}
+     * @type {Map <CustomCodeHelper, ICustomCodeHelper>}
      */
      */
-    getCustomNodes (): Map <CustomNode, ICustomNode>;
+    getCustomCodeHelpers (): Map <CustomCodeHelper, ICustomCodeHelper>;
 
 
     initialize (): void;
     initialize (): void;
 }
 }

+ 1 - 1
src/interfaces/custom-nodes/ICustomNodeObfuscator.ts → src/interfaces/custom-code-helpers/ICustomCodeHelperObfuscator.ts

@@ -1,6 +1,6 @@
 import { TInputOptions } from '../../types/options/TInputOptions';
 import { TInputOptions } from '../../types/options/TInputOptions';
 
 
-export interface ICustomNodeObfuscator {
+export interface ICustomCodeHelperObfuscator {
     /**
     /**
      * @param {string} template
      * @param {string} template
      * @param {TInputOptions} additionalOptions
      * @param {TInputOptions} additionalOptions

+ 14 - 14
src/node-transformers/preparing-transformers/CustomNodesTransformer.ts → src/node-transformers/preparing-transformers/CustomCodeHelpersTransformer.ts

@@ -3,9 +3,9 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
 
 
 import * as ESTree from 'estree';
 import * as ESTree from 'estree';
 
 
-import { TCustomNodeGroupStorage } from '../../types/storages/TCustomNodeGroupStorage';
+import { TCustomCodeHelperGroupStorage } from '../../types/storages/TCustomCodeHelperGroupStorage';
 
 
-import { ICustomNodeGroup } from '../../interfaces/custom-nodes/ICustomNodeGroup';
+import { ICustomCodeHelperGroup } from '../../interfaces/custom-code-helpers/ICustomCodeHelperGroup';
 import { IObfuscationEventEmitter } from '../../interfaces/event-emitters/IObfuscationEventEmitter';
 import { IObfuscationEventEmitter } from '../../interfaces/event-emitters/IObfuscationEventEmitter';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IOptions } from '../../interfaces/options/IOptions';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
 import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
@@ -21,14 +21,14 @@ import { AbstractNodeTransformer } from '../AbstractNodeTransformer';
 import { NodeGuards } from '../../node/NodeGuards';
 import { NodeGuards } from '../../node/NodeGuards';
 
 
 /**
 /**
- * Analyzing AST-tree and appending custom nodes
+ * Analyzing AST-tree and appending custom code helpers
  */
  */
 @injectable()
 @injectable()
-export class CustomNodesTransformer extends AbstractNodeTransformer {
+export class CustomCodeHelpersTransformer extends AbstractNodeTransformer {
     /**
     /**
-     * @type {TCustomNodeGroupStorage}
+     * @type {TCustomCodeHelperGroupStorage}
      */
      */
-    private readonly customNodeGroupStorage: TCustomNodeGroupStorage;
+    private readonly customCodeHelperGroupStorage: TCustomCodeHelperGroupStorage;
 
 
     /**
     /**
      * @type {IObfuscationEventEmitter}
      * @type {IObfuscationEventEmitter}
@@ -54,7 +54,7 @@ export class CustomNodesTransformer extends AbstractNodeTransformer {
      * @param {ICallsGraphAnalyzer} callsGraphAnalyzer
      * @param {ICallsGraphAnalyzer} callsGraphAnalyzer
      * @param {IPrevailingKindOfVariablesAnalyzer} prevailingKindOfVariablesAnalyzer
      * @param {IPrevailingKindOfVariablesAnalyzer} prevailingKindOfVariablesAnalyzer
      * @param {IObfuscationEventEmitter} obfuscationEventEmitter
      * @param {IObfuscationEventEmitter} obfuscationEventEmitter
-     * @param {TCustomNodeGroupStorage} customNodeGroupStorage
+     * @param {TCustomCodeHelperGroupStorage} customCodeHelperGroupStorage
      * @param {IRandomGenerator} randomGenerator
      * @param {IRandomGenerator} randomGenerator
      * @param {IOptions} options
      * @param {IOptions} options
      */
      */
@@ -63,7 +63,7 @@ export class CustomNodesTransformer extends AbstractNodeTransformer {
         @inject(ServiceIdentifiers.IPrevailingKindOfVariablesAnalyzer)
         @inject(ServiceIdentifiers.IPrevailingKindOfVariablesAnalyzer)
             prevailingKindOfVariablesAnalyzer: IPrevailingKindOfVariablesAnalyzer,
             prevailingKindOfVariablesAnalyzer: IPrevailingKindOfVariablesAnalyzer,
         @inject(ServiceIdentifiers.IObfuscationEventEmitter) obfuscationEventEmitter: IObfuscationEventEmitter,
         @inject(ServiceIdentifiers.IObfuscationEventEmitter) obfuscationEventEmitter: IObfuscationEventEmitter,
-        @inject(ServiceIdentifiers.TCustomNodeGroupStorage) customNodeGroupStorage: TCustomNodeGroupStorage,
+        @inject(ServiceIdentifiers.TCustomNodeGroupStorage) customCodeHelperGroupStorage: TCustomCodeHelperGroupStorage,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
         @inject(ServiceIdentifiers.IOptions) options: IOptions
         @inject(ServiceIdentifiers.IOptions) options: IOptions
     ) {
     ) {
@@ -72,7 +72,7 @@ export class CustomNodesTransformer extends AbstractNodeTransformer {
         this.callsGraphAnalyzer = callsGraphAnalyzer;
         this.callsGraphAnalyzer = callsGraphAnalyzer;
         this.prevailingKindOfVariablesAnalyzer = prevailingKindOfVariablesAnalyzer;
         this.prevailingKindOfVariablesAnalyzer = prevailingKindOfVariablesAnalyzer;
         this.obfuscationEventEmitter = obfuscationEventEmitter;
         this.obfuscationEventEmitter = obfuscationEventEmitter;
-        this.customNodeGroupStorage = customNodeGroupStorage;
+        this.customCodeHelperGroupStorage = customCodeHelperGroupStorage;
     }
     }
 
 
     /**
     /**
@@ -130,14 +130,14 @@ export class CustomNodesTransformer extends AbstractNodeTransformer {
      * @param {Node | null} parentNode
      * @param {Node | null} parentNode
      */
      */
     private appendCustomNodesBeforeObfuscation (node: ESTree.Program, parentNode: ESTree.Node | null): void {
     private appendCustomNodesBeforeObfuscation (node: ESTree.Program, parentNode: ESTree.Node | null): void {
-        this.customNodeGroupStorage
+        this.customCodeHelperGroupStorage
             .getStorage()
             .getStorage()
-            .forEach((customNodeGroup: ICustomNodeGroup) => {
-                customNodeGroup.initialize();
+            .forEach((customCodeHelperGroup: ICustomCodeHelperGroup) => {
+                customCodeHelperGroup.initialize();
 
 
                 this.obfuscationEventEmitter.once(
                 this.obfuscationEventEmitter.once(
-                    customNodeGroup.getAppendEvent(),
-                    customNodeGroup.appendCustomNodes.bind(customNodeGroup)
+                    customCodeHelperGroup.getAppendEvent(),
+                    customCodeHelperGroup.appendNodes.bind(customCodeHelperGroup)
                 );
                 );
             });
             });
 
 

+ 57 - 0
src/storages/custom-code-helpers/CustomCodeHelperGroupStorage.ts

@@ -0,0 +1,57 @@
+import { inject, injectable, postConstruct } from 'inversify';
+import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
+
+import { TCustomCodeHelperGroupFactory } from '../../types/container/custom-code-helpers/TCustomCodeHelperGroupFactory';
+
+import { ICustomCodeHelperGroup } from '../../interfaces/custom-code-helpers/ICustomCodeHelperGroup';
+import { IOptions } from '../../interfaces/options/IOptions';
+import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
+
+import { CustomCodeHelperGroup } from '../../enums/custom-code-helpers/CustomCodeHelperGroup';
+
+import { MapStorage } from '../MapStorage';
+
+@injectable()
+export class CustomCodeHelperGroupStorage extends MapStorage <string, ICustomCodeHelperGroup> {
+    /**
+     * @type {CustomCodeHelperGroup[]}
+     */
+    private static readonly customCodeHelperGroupsList: CustomCodeHelperGroup[] = [
+        CustomCodeHelperGroup.ConsoleOutput,
+        CustomCodeHelperGroup.DebugProtection,
+        CustomCodeHelperGroup.DomainLock,
+        CustomCodeHelperGroup.SelfDefending,
+        CustomCodeHelperGroup.StringArray
+    ];
+
+    /**
+     * @type {TCustomNodesFactoriesFactory}
+     */
+    private readonly customCodeHelperGroupFactory: TCustomCodeHelperGroupFactory;
+
+    /**
+     * @param {TCustomCodeHelperGroupFactory} customCodeHelperGroupFactory
+     * @param {IRandomGenerator} randomGenerator
+     * @param {IOptions} options
+     */
+    public constructor (
+        @inject(ServiceIdentifiers.Factory__ICustomCodeHelperGroup) customCodeHelperGroupFactory: TCustomCodeHelperGroupFactory,
+        @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
+        @inject(ServiceIdentifiers.IOptions) options: IOptions
+    ) {
+        super(randomGenerator, options);
+
+        this.customCodeHelperGroupFactory = customCodeHelperGroupFactory;
+    }
+
+    @postConstruct()
+    public initialize (): void {
+        super.initialize();
+
+        CustomCodeHelperGroupStorage.customCodeHelperGroupsList.forEach((customCodeHelperGroupName: CustomCodeHelperGroup) => {
+            const customCodeHelperGroup: ICustomCodeHelperGroup = this.customCodeHelperGroupFactory(customCodeHelperGroupName);
+
+            this.storage.set(customCodeHelperGroupName, customCodeHelperGroup);
+        });
+    }
+}

+ 0 - 57
src/storages/custom-node-group/CustomNodeGroupStorage.ts

@@ -1,57 +0,0 @@
-import { inject, injectable, postConstruct } from 'inversify';
-import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
-
-import { TCustomNodeGroupFactory } from '../../types/container/custom-nodes/TCustomNodeGroupFactory';
-
-import { ICustomNodeGroup } from '../../interfaces/custom-nodes/ICustomNodeGroup';
-import { IOptions } from '../../interfaces/options/IOptions';
-import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
-
-import { CustomNodeGroup } from '../../enums/custom-nodes/CustomNodeGroup';
-
-import { MapStorage } from '../MapStorage';
-
-@injectable()
-export class CustomNodeGroupStorage extends MapStorage <string, ICustomNodeGroup> {
-    /**
-     * @type {CustomNodeGroup[]}
-     */
-    private static readonly customNodeGroupsList: CustomNodeGroup[] = [
-        CustomNodeGroup.ConsoleOutputCustomNodeGroup,
-        CustomNodeGroup.DebugProtectionCustomNodeGroup,
-        CustomNodeGroup.DomainLockCustomNodeGroup,
-        CustomNodeGroup.SelfDefendingCustomNodeGroup,
-        CustomNodeGroup.StringArrayCustomNodeGroup
-    ];
-
-    /**
-     * @type {TCustomNodesFactoriesFactory}
-     */
-    private readonly customNodeGroupFactory: TCustomNodeGroupFactory;
-
-    /**
-     * @param {TCustomNodeGroupFactory} customNodeGroupFactory
-     * @param {IRandomGenerator} randomGenerator
-     * @param {IOptions} options
-     */
-    public constructor (
-        @inject(ServiceIdentifiers.Factory__ICustomNodeGroup) customNodeGroupFactory: TCustomNodeGroupFactory,
-        @inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
-        @inject(ServiceIdentifiers.IOptions) options: IOptions
-    ) {
-        super(randomGenerator, options);
-
-        this.customNodeGroupFactory = customNodeGroupFactory;
-    }
-
-    @postConstruct()
-    public initialize (): void {
-        super.initialize();
-
-        CustomNodeGroupStorage.customNodeGroupsList.forEach((customNodeGroupName: CustomNodeGroup) => {
-            const customNodeGroup: ICustomNodeGroup = this.customNodeGroupFactory(customNodeGroupName);
-
-            this.storage.set(customNodeGroupName, customNodeGroup);
-        });
-    }
-}

+ 0 - 0
src/storages/control-flow/ControlFlowStorage.ts → src/storages/custom-nodes/ControlFlowStorage.ts


+ 7 - 0
src/types/container/custom-code-helpers/TCustomCodeHelperFactory.ts

@@ -0,0 +1,7 @@
+import { ICustomCodeHelper } from '../../../interfaces/custom-code-helpers/ICustomCodeHelper';
+
+import { CustomCodeHelper } from '../../../enums/custom-code-helpers/CustomCodeHelper';
+
+export type TCustomCodeHelperFactory = <
+    TInitialData extends any[] = any[]
+> (customCodeHelperName: CustomCodeHelper) => ICustomCodeHelper<TInitialData>;

+ 5 - 0
src/types/container/custom-code-helpers/TCustomCodeHelperGroupFactory.ts

@@ -0,0 +1,5 @@
+import { ICustomCodeHelperGroup } from '../../../interfaces/custom-code-helpers/ICustomCodeHelperGroup';
+
+import { CustomCodeHelperGroup } from '../../../enums/custom-code-helpers/CustomCodeHelperGroup';
+
+export type TCustomCodeHelperGroupFactory = (customCodeHelperGroupName: CustomCodeHelperGroup) => ICustomCodeHelperGroup;

+ 0 - 7
src/types/container/custom-nodes/TCustomNodeFactory.ts

@@ -1,7 +0,0 @@
-import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
-
-import { CustomNode } from '../../../enums/custom-nodes/CustomNode';
-
-export type TCustomNodeFactory = <
-    TInitialData extends any[] = any[]
-> (customNodeName: CustomNode) => ICustomNode<TInitialData>;

+ 0 - 5
src/types/container/custom-nodes/TCustomNodeGroupFactory.ts

@@ -1,5 +0,0 @@
-import { ICustomNodeGroup } from '../../../interfaces/custom-nodes/ICustomNodeGroup';
-
-import { CustomNodeGroup } from '../../../enums/custom-nodes/CustomNodeGroup';
-
-export type TCustomNodeGroupFactory = (customNodeGroupName: CustomNodeGroup) => ICustomNodeGroup;

+ 4 - 0
src/types/storages/TCustomCodeHelperGroupStorage.ts

@@ -0,0 +1,4 @@
+import { ICustomCodeHelperGroup } from '../../interfaces/custom-code-helpers/ICustomCodeHelperGroup';
+import { IMapStorage } from '../../interfaces/storages/IMapStorage';
+
+export type TCustomCodeHelperGroupStorage = IMapStorage <string, ICustomCodeHelperGroup>;

+ 0 - 4
src/types/storages/TCustomNodeGroupStorage.ts

@@ -1,4 +0,0 @@
-import { ICustomNodeGroup } from '../../interfaces/custom-nodes/ICustomNodeGroup';
-import { IMapStorage } from '../../interfaces/storages/IMapStorage';
-
-export type TCustomNodeGroupStorage = IMapStorage <string, ICustomNodeGroup>;

+ 1 - 1
test/functional-tests/custom-nodes/common/templates/GlobalVariableNoEvalTemplate.spec.ts → test/functional-tests/custom-code-helpers/common/templates/GlobalVariableNoEvalTemplate.spec.ts

@@ -4,7 +4,7 @@ import format from 'string-template';
 
 
 import { assert } from 'chai';
 import { assert } from 'chai';
 
 
-import { GlobalVariableNoEvalTemplate } from '../../../../../src/custom-nodes/common/templates/GlobalVariableNoEvalTemplate';
+import { GlobalVariableNoEvalTemplate } from '../../../../../src/custom-code-helpers/common/templates/GlobalVariableNoEvalTemplate';
 
 
 describe('GlobalVariableNoEvalTemplate', () => {
 describe('GlobalVariableNoEvalTemplate', () => {
     describe('Variant #1: simple', () => {
     describe('Variant #1: simple', () => {

+ 8 - 8
test/functional-tests/custom-nodes/console-output-nodes/ConsoleOutputDisableExpressionNode.spec.ts → test/functional-tests/custom-code-helpers/console-output/ConsoleOutputDisableExpressionCodeHelper.spec.ts

@@ -6,7 +6,7 @@ import { readFileAsString } from '../../../helpers/readFileAsString';
 
 
 import { JavaScriptObfuscator } from '../../../../src/JavaScriptObfuscatorFacade';
 import { JavaScriptObfuscator } from '../../../../src/JavaScriptObfuscatorFacade';
 
 
-describe('ConsoleOutputDisableExpressionNode', () => {
+describe('ConsoleOutputDisableExpressionCodeHelper', () => {
     const consoleLogRegExp: RegExp = /_0x([a-f0-9]){4,6}\['console'\]\['log'\] *= *_0x([a-f0-9]){4,6};/u;
     const consoleLogRegExp: RegExp = /_0x([a-f0-9]){4,6}\['console'\]\['log'\] *= *_0x([a-f0-9]){4,6};/u;
     const consoleErrorRegExp: RegExp = /_0x([a-f0-9]){4,6}\['console'\]\['error'\] *= *_0x([a-f0-9]){4,6};/u;
     const consoleErrorRegExp: RegExp = /_0x([a-f0-9]){4,6}\['console'\]\['error'\] *= *_0x([a-f0-9]){4,6};/u;
     const consoleWarnRegExp: RegExp = /_0x([a-f0-9]){4,6}\['console'\]\['warn'\] *= *_0x([a-f0-9]){4,6};/u;
     const consoleWarnRegExp: RegExp = /_0x([a-f0-9]){4,6}\['console'\]\['warn'\] *= *_0x([a-f0-9]){4,6};/u;
@@ -27,19 +27,19 @@ describe('ConsoleOutputDisableExpressionNode', () => {
             ).getObfuscatedCode();
             ).getObfuscatedCode();
         });
         });
 
 
-        it('match #1: should correctly append custom node into the obfuscated code', () => {
+        it('match #1: should correctly append code helper into the obfuscated code', () => {
             assert.match(obfuscatedCode, consoleLogRegExp);
             assert.match(obfuscatedCode, consoleLogRegExp);
         });
         });
 
 
-        it('match #2: should correctly append custom node into the obfuscated code', () => {
+        it('match #2: should correctly append code helper into the obfuscated code', () => {
             assert.match(obfuscatedCode, consoleErrorRegExp);
             assert.match(obfuscatedCode, consoleErrorRegExp);
         });
         });
 
 
-        it('match #3: should correctly append custom node into the obfuscated code', () => {
+        it('match #3: should correctly append code helper into the obfuscated code', () => {
             assert.match(obfuscatedCode, consoleWarnRegExp);
             assert.match(obfuscatedCode, consoleWarnRegExp);
         });
         });
 
 
-        it('match #4: should correctly append custom node into the obfuscated code', () => {
+        it('match #4: should correctly append code helper into the obfuscated code', () => {
             assert.match(obfuscatedCode, consoleTableRegExp);
             assert.match(obfuscatedCode, consoleTableRegExp);
         });
         });
     });
     });
@@ -59,15 +59,15 @@ describe('ConsoleOutputDisableExpressionNode', () => {
             ).getObfuscatedCode();
             ).getObfuscatedCode();
         });
         });
 
 
-        it('match #1: shouldn\'t append custom node into the obfuscated code', () => {
+        it('match #1: shouldn\'t append code helper into the obfuscated code', () => {
             assert.notMatch(obfuscatedCode, consoleLogRegExp);
             assert.notMatch(obfuscatedCode, consoleLogRegExp);
         });
         });
 
 
-        it('match #2: shouldn\'t append custom node into the obfuscated code', () => {
+        it('match #2: shouldn\'t append code helper into the obfuscated code', () => {
             assert.notMatch(obfuscatedCode, consoleErrorRegExp);
             assert.notMatch(obfuscatedCode, consoleErrorRegExp);
         });
         });
 
 
-        it('match #3: shouldn\'t append custom node into the obfuscated code', () => {
+        it('match #3: shouldn\'t append code helper into the obfuscated code', () => {
             assert.notMatch(obfuscatedCode, consoleWarnRegExp);
             assert.notMatch(obfuscatedCode, consoleWarnRegExp);
         });
         });
     });
     });

+ 0 - 0
test/functional-tests/custom-nodes/console-output-nodes/fixtures/simple-input.js → test/functional-tests/custom-code-helpers/console-output/fixtures/simple-input.js


+ 0 - 0
test/functional-tests/custom-nodes/debug-protection-nodes/templates/DebugProtectionFunctionCallTemplate.spec.ts → test/functional-tests/custom-code-helpers/debug-protection/templates/DebugProtectionFunctionCallTemplate.spec.ts


+ 0 - 0
test/functional-tests/custom-nodes/debug-protection-nodes/templates/fixtures/input.js → test/functional-tests/custom-code-helpers/debug-protection/templates/fixtures/input.js


+ 0 - 0
test/functional-tests/custom-nodes/debug-protection-nodes/templates/fixtures/single-call.js → test/functional-tests/custom-code-helpers/debug-protection/templates/fixtures/single-call.js


+ 0 - 0
test/functional-tests/custom-nodes/debug-protection-nodes/templates/workers/evaluation-worker.js → test/functional-tests/custom-code-helpers/debug-protection/templates/workers/evaluation-worker.js


+ 3 - 3
test/functional-tests/custom-nodes/domain-lock-nodes/DomainLockNode.spec.ts → test/functional-tests/custom-code-helpers/domain-lock/DomainLockCodeHelper.spec.ts

@@ -6,7 +6,7 @@ import { readFileAsString } from '../../../helpers/readFileAsString';
 
 
 import { JavaScriptObfuscator } from '../../../../src/JavaScriptObfuscatorFacade';
 import { JavaScriptObfuscator } from '../../../../src/JavaScriptObfuscatorFacade';
 
 
-describe('DomainLockNode', () => {
+describe('DomainLockCodeHelper', () => {
     const regExp: RegExp = /var _0x([a-f0-9]){4,6} *= *new RegExp/;
     const regExp: RegExp = /var _0x([a-f0-9]){4,6} *= *new RegExp/;
 
 
     describe('`domainLock` option is set', () => {
     describe('`domainLock` option is set', () => {
@@ -24,7 +24,7 @@ describe('DomainLockNode', () => {
             ).getObfuscatedCode();
             ).getObfuscatedCode();
         });
         });
 
 
-        it('should correctly append custom node into the obfuscated code', () => {
+        it('should correctly append code helper into the obfuscated code', () => {
             assert.match(obfuscatedCode, regExp);
             assert.match(obfuscatedCode, regExp);
         });
         });
     });
     });
@@ -44,7 +44,7 @@ describe('DomainLockNode', () => {
             ).getObfuscatedCode();
             ).getObfuscatedCode();
         });
         });
 
 
-        it('shouldn\'t append custom node into the obfuscated code', () => {
+        it('shouldn\'t append code helper into the obfuscated code', () => {
             assert.notMatch(obfuscatedCode, regExp);
             assert.notMatch(obfuscatedCode, regExp);
         });
         });
     });
     });

+ 0 - 0
test/functional-tests/custom-nodes/domain-lock-nodes/fixtures/simple-input.js → test/functional-tests/custom-code-helpers/domain-lock/fixtures/simple-input.js


+ 33 - 33
test/functional-tests/custom-nodes/domain-lock-nodes/templates/DomainLockNodeTemplate.spec.ts → test/functional-tests/custom-code-helpers/domain-lock/templates/DomainLockNodeTemplate.spec.ts

@@ -12,8 +12,8 @@ import { IObfuscatedCode } from '../../../../../src/interfaces/source-code/IObfu
 
 
 import { NO_ADDITIONAL_NODES_PRESET } from '../../../../../src/options/presets/NoCustomNodes';
 import { NO_ADDITIONAL_NODES_PRESET } from '../../../../../src/options/presets/NoCustomNodes';
 
 
-import { DomainLockNodeTemplate } from '../../../../../src/custom-nodes/domain-lock-nodes/templates/DomainLockNodeTemplate';
-import { GlobalVariableTemplate1 } from '../../../../../src/custom-nodes/common/templates/GlobalVariableTemplate1';
+import { DomainLockTemplate } from '../../../../../src/custom-code-helpers/domain-lock/templates/DomainLockTemplate';
+import { GlobalVariableTemplate1 } from '../../../../../src/custom-code-helpers/common/templates/GlobalVariableTemplate1';
 
 
 import { InversifyContainerFacade } from '../../../../../src/container/InversifyContainerFacade';
 import { InversifyContainerFacade } from '../../../../../src/container/InversifyContainerFacade';
 import { JavaScriptObfuscator } from '../../../../../src/JavaScriptObfuscatorFacade';
 import { JavaScriptObfuscator } from '../../../../../src/JavaScriptObfuscatorFacade';
@@ -71,7 +71,7 @@ function getFunctionFromTemplate (
     callsControllerFunctionName: string,
     callsControllerFunctionName: string,
     documentTemplate: string
     documentTemplate: string
 ): Function {
 ): Function {
-    const domainLockTemplate: string = format(DomainLockNodeTemplate(), templateData);
+    const domainLockTemplate: string = format(DomainLockTemplate(), templateData);
 
 
     return Function(`
     return Function(`
         ${documentTemplate}
         ${documentTemplate}
@@ -88,8 +88,8 @@ function getFunctionFromTemplate (
     `)();
     `)();
 }
 }
 
 
-describe('DomainLockNodeTemplate', () => {
-    const singleNodeCallControllerFunctionName: string = 'callsController';
+describe('DomainLockTemplate', () => {
+    const singleCallControllerFunctionName: string = 'callsController';
 
 
     let cryptUtils: ICryptUtils;
     let cryptUtils: ICryptUtils;
 
 
@@ -118,9 +118,9 @@ describe('DomainLockNodeTemplate', () => {
                     diff: diff,
                     diff: diff,
                     domains: hiddenDomainsString,
                     domains: hiddenDomainsString,
                     globalVariableTemplate: GlobalVariableTemplate1(),
                     globalVariableTemplate: GlobalVariableTemplate1(),
-                    singleNodeCallControllerFunctionName
+                    singleCallControllerFunctionName
                 },
                 },
-                singleNodeCallControllerFunctionName,
+                singleCallControllerFunctionName,
                 getDocumentDomainTemplate(currentDomain)
                 getDocumentDomainTemplate(currentDomain)
             );
             );
         });
         });
@@ -148,9 +148,9 @@ describe('DomainLockNodeTemplate', () => {
                     diff: diff,
                     diff: diff,
                     domains: hiddenDomainsString,
                     domains: hiddenDomainsString,
                     globalVariableTemplate: GlobalVariableTemplate1(),
                     globalVariableTemplate: GlobalVariableTemplate1(),
-                    singleNodeCallControllerFunctionName
+                    singleCallControllerFunctionName
                 },
                 },
-                singleNodeCallControllerFunctionName,
+                singleCallControllerFunctionName,
                 getDocumentDomainTemplate(currentDomain)
                 getDocumentDomainTemplate(currentDomain)
             );
             );
         });
         });
@@ -179,9 +179,9 @@ describe('DomainLockNodeTemplate', () => {
                         diff: diff,
                         diff: diff,
                         domains: hiddenDomainsString,
                         domains: hiddenDomainsString,
                         globalVariableTemplate: GlobalVariableTemplate1(),
                         globalVariableTemplate: GlobalVariableTemplate1(),
-                        singleNodeCallControllerFunctionName
+                        singleCallControllerFunctionName
                     },
                     },
-                    singleNodeCallControllerFunctionName,
+                    singleCallControllerFunctionName,
                     getDocumentDomainTemplate(currentDomain)
                     getDocumentDomainTemplate(currentDomain)
                 );
                 );
             });
             });
@@ -209,9 +209,9 @@ describe('DomainLockNodeTemplate', () => {
                         diff: diff,
                         diff: diff,
                         domains: hiddenDomainsString,
                         domains: hiddenDomainsString,
                         globalVariableTemplate: GlobalVariableTemplate1(),
                         globalVariableTemplate: GlobalVariableTemplate1(),
-                        singleNodeCallControllerFunctionName
+                        singleCallControllerFunctionName
                     },
                     },
-                    singleNodeCallControllerFunctionName,
+                    singleCallControllerFunctionName,
                     getDocumentDomainTemplate(currentDomain)
                     getDocumentDomainTemplate(currentDomain)
                 );
                 );
             });
             });
@@ -239,9 +239,9 @@ describe('DomainLockNodeTemplate', () => {
                         diff: diff,
                         diff: diff,
                         domains: hiddenDomainsString,
                         domains: hiddenDomainsString,
                         globalVariableTemplate: GlobalVariableTemplate1(),
                         globalVariableTemplate: GlobalVariableTemplate1(),
-                        singleNodeCallControllerFunctionName
+                        singleCallControllerFunctionName
                     },
                     },
-                    singleNodeCallControllerFunctionName,
+                    singleCallControllerFunctionName,
                     getDocumentDomainTemplate(currentDomain)
                     getDocumentDomainTemplate(currentDomain)
                 );
                 );
             });
             });
@@ -269,9 +269,9 @@ describe('DomainLockNodeTemplate', () => {
                         diff: diff,
                         diff: diff,
                         domains: hiddenDomainsString,
                         domains: hiddenDomainsString,
                         globalVariableTemplate: GlobalVariableTemplate1(),
                         globalVariableTemplate: GlobalVariableTemplate1(),
-                        singleNodeCallControllerFunctionName
+                        singleCallControllerFunctionName
                     },
                     },
-                    singleNodeCallControllerFunctionName,
+                    singleCallControllerFunctionName,
                     getDocumentDomainTemplate(currentDomain)
                     getDocumentDomainTemplate(currentDomain)
                 );
                 );
             });
             });
@@ -300,9 +300,9 @@ describe('DomainLockNodeTemplate', () => {
                     diff: diff,
                     diff: diff,
                     domains: hiddenDomainsString,
                     domains: hiddenDomainsString,
                     globalVariableTemplate: GlobalVariableTemplate1(),
                     globalVariableTemplate: GlobalVariableTemplate1(),
-                    singleNodeCallControllerFunctionName
+                    singleCallControllerFunctionName
                 },
                 },
-                singleNodeCallControllerFunctionName,
+                singleCallControllerFunctionName,
                 getDocumentDomainTemplate(currentDomain)
                 getDocumentDomainTemplate(currentDomain)
             );
             );
         });
         });
@@ -331,9 +331,9 @@ describe('DomainLockNodeTemplate', () => {
                         diff: diff,
                         diff: diff,
                         domains: hiddenDomainsString,
                         domains: hiddenDomainsString,
                         globalVariableTemplate: GlobalVariableTemplate1(),
                         globalVariableTemplate: GlobalVariableTemplate1(),
-                        singleNodeCallControllerFunctionName
+                        singleCallControllerFunctionName
                     },
                     },
-                    singleNodeCallControllerFunctionName,
+                    singleCallControllerFunctionName,
                     getDocumentDomainTemplate(currentDomain)
                     getDocumentDomainTemplate(currentDomain)
                 );
                 );
             });
             });
@@ -360,9 +360,9 @@ describe('DomainLockNodeTemplate', () => {
                         diff: diff,
                         diff: diff,
                         domains: hiddenDomainsString,
                         domains: hiddenDomainsString,
                         globalVariableTemplate: GlobalVariableTemplate1(),
                         globalVariableTemplate: GlobalVariableTemplate1(),
-                        singleNodeCallControllerFunctionName
+                        singleCallControllerFunctionName
                     },
                     },
-                    singleNodeCallControllerFunctionName,
+                    singleCallControllerFunctionName,
                     getDocumentDomainTemplate(currentDomain)
                     getDocumentDomainTemplate(currentDomain)
                 );
                 );
             });
             });
@@ -390,9 +390,9 @@ describe('DomainLockNodeTemplate', () => {
                         diff: diff,
                         diff: diff,
                         domains: hiddenDomainsString,
                         domains: hiddenDomainsString,
                         globalVariableTemplate: GlobalVariableTemplate1(),
                         globalVariableTemplate: GlobalVariableTemplate1(),
-                        singleNodeCallControllerFunctionName
+                        singleCallControllerFunctionName
                     },
                     },
-                    singleNodeCallControllerFunctionName,
+                    singleCallControllerFunctionName,
                     getDocumentDomainTemplate(currentDomain)
                     getDocumentDomainTemplate(currentDomain)
                 );
                 );
             });
             });
@@ -422,9 +422,9 @@ describe('DomainLockNodeTemplate', () => {
                         diff: diff,
                         diff: diff,
                         domains: hiddenDomainsString,
                         domains: hiddenDomainsString,
                         globalVariableTemplate: GlobalVariableTemplate1(),
                         globalVariableTemplate: GlobalVariableTemplate1(),
-                        singleNodeCallControllerFunctionName
+                        singleCallControllerFunctionName
                     },
                     },
-                    singleNodeCallControllerFunctionName,
+                    singleCallControllerFunctionName,
                     getDocumentLocationTemplate(currentHostName)
                     getDocumentLocationTemplate(currentHostName)
                 );
                 );
             });
             });
@@ -452,9 +452,9 @@ describe('DomainLockNodeTemplate', () => {
                         diff: diff,
                         diff: diff,
                         domains: hiddenDomainsString,
                         domains: hiddenDomainsString,
                         globalVariableTemplate: GlobalVariableTemplate1(),
                         globalVariableTemplate: GlobalVariableTemplate1(),
-                        singleNodeCallControllerFunctionName
+                        singleCallControllerFunctionName
                     },
                     },
-                    singleNodeCallControllerFunctionName,
+                    singleCallControllerFunctionName,
                     getDocumentLocationTemplate(currentHostName)
                     getDocumentLocationTemplate(currentHostName)
                 );
                 );
             });
             });
@@ -484,9 +484,9 @@ describe('DomainLockNodeTemplate', () => {
                         diff: diff,
                         diff: diff,
                         domains: hiddenDomainsString,
                         domains: hiddenDomainsString,
                         globalVariableTemplate: GlobalVariableTemplate1(),
                         globalVariableTemplate: GlobalVariableTemplate1(),
-                        singleNodeCallControllerFunctionName
+                        singleCallControllerFunctionName
                     },
                     },
-                    singleNodeCallControllerFunctionName,
+                    singleCallControllerFunctionName,
                     getDocumentDomainAndLocationTemplate(currentHostName)
                     getDocumentDomainAndLocationTemplate(currentHostName)
                 );
                 );
             });
             });
@@ -514,9 +514,9 @@ describe('DomainLockNodeTemplate', () => {
                         diff: diff,
                         diff: diff,
                         domains: hiddenDomainsString,
                         domains: hiddenDomainsString,
                         globalVariableTemplate: GlobalVariableTemplate1(),
                         globalVariableTemplate: GlobalVariableTemplate1(),
-                        singleNodeCallControllerFunctionName
+                        singleCallControllerFunctionName
                     },
                     },
-                    singleNodeCallControllerFunctionName,
+                    singleCallControllerFunctionName,
                     getDocumentDomainAndLocationTemplate(currentHostName)
                     getDocumentDomainAndLocationTemplate(currentHostName)
                 );
                 );
             });
             });

+ 0 - 0
test/functional-tests/custom-nodes/domain-lock-nodes/templates/fixtures/prevailing-kind-of-variables-const.js → test/functional-tests/custom-code-helpers/domain-lock/templates/fixtures/prevailing-kind-of-variables-const.js


+ 0 - 0
test/functional-tests/custom-nodes/domain-lock-nodes/templates/fixtures/prevailing-kind-of-variables-let.js → test/functional-tests/custom-code-helpers/domain-lock/templates/fixtures/prevailing-kind-of-variables-let.js


+ 0 - 0
test/functional-tests/custom-nodes/domain-lock-nodes/templates/fixtures/prevailing-kind-of-variables-var.js → test/functional-tests/custom-code-helpers/domain-lock/templates/fixtures/prevailing-kind-of-variables-var.js


+ 3 - 3
test/functional-tests/custom-nodes/string-array-nodes/StringArrayCallsWrapper.spec.ts → test/functional-tests/custom-code-helpers/string-array/StringArrayCallsWrapperCodeHelper.spec.ts

@@ -6,7 +6,7 @@ import { readFileAsString } from '../../../helpers/readFileAsString';
 
 
 import { JavaScriptObfuscator } from '../../../../src/JavaScriptObfuscatorFacade';
 import { JavaScriptObfuscator } from '../../../../src/JavaScriptObfuscatorFacade';
 
 
-describe('StringArrayCallsWrapper', () => {
+describe('StringArrayCallsWrapperCodeHelper', () => {
     const regExp: RegExp = /_0x([a-f0-9]){4,6} *= *_0x([a-f0-9]){4,6} *- *0x0\;/;
     const regExp: RegExp = /_0x([a-f0-9]){4,6} *= *_0x([a-f0-9]){4,6} *- *0x0\;/;
 
 
     describe('`stringArray` option is set', () => {
     describe('`stringArray` option is set', () => {
@@ -25,7 +25,7 @@ describe('StringArrayCallsWrapper', () => {
             ).getObfuscatedCode();
             ).getObfuscatedCode();
         });
         });
 
 
-        it('should correctly append custom node into the obfuscated code', () => {
+        it('should correctly append code helper into the obfuscated code', () => {
             assert.match(obfuscatedCode, regExp);
             assert.match(obfuscatedCode, regExp);
         });
         });
     });
     });
@@ -45,7 +45,7 @@ describe('StringArrayCallsWrapper', () => {
             ).getObfuscatedCode();
             ).getObfuscatedCode();
         });
         });
 
 
-        it('shouldn\'t append custom node into the obfuscated code', () => {
+        it('shouldn\'t append code helper into the obfuscated code', () => {
             assert.notMatch(obfuscatedCode, regExp);
             assert.notMatch(obfuscatedCode, regExp);
         });
         });
     });
     });

+ 3 - 3
test/functional-tests/custom-nodes/string-array-nodes/StringArrayNode.spec.ts → test/functional-tests/custom-code-helpers/string-array/StringArrayCodeHelper.spec.ts

@@ -6,7 +6,7 @@ import { readFileAsString } from '../../../helpers/readFileAsString';
 
 
 import { JavaScriptObfuscator } from '../../../../src/JavaScriptObfuscatorFacade';
 import { JavaScriptObfuscator } from '../../../../src/JavaScriptObfuscatorFacade';
 
 
-describe('StringArrayNode', () => {
+describe('StringArrayCodeHelper', () => {
     const regExp: RegExp = /^var _0x([a-f0-9]){4} *= *\[/;
     const regExp: RegExp = /^var _0x([a-f0-9]){4} *= *\[/;
 
 
     describe('`stringArray` option is set', () => {
     describe('`stringArray` option is set', () => {
@@ -25,7 +25,7 @@ describe('StringArrayNode', () => {
             ).getObfuscatedCode();
             ).getObfuscatedCode();
         });
         });
 
 
-        it('should correctly append custom node into the obfuscated code', () => {
+        it('should correctly append code helper into the obfuscated code', () => {
             assert.match(obfuscatedCode, regExp);
             assert.match(obfuscatedCode, regExp);
         });
         });
     });
     });
@@ -45,7 +45,7 @@ describe('StringArrayNode', () => {
             ).getObfuscatedCode();
             ).getObfuscatedCode();
         });
         });
 
 
-        it('shouldn\'t append custom node into the obfuscated code', () => {
+        it('shouldn\'t append code helper into the obfuscated code', () => {
             assert.notMatch(obfuscatedCode, regExp);
             assert.notMatch(obfuscatedCode, regExp);
         });
         });
     });
     });

+ 3 - 3
test/functional-tests/custom-nodes/string-array-nodes/StringArrayRotateFunctionNode.spec.ts → test/functional-tests/custom-code-helpers/string-array/StringArrayRotateFunctionCodeHelper.spec.ts

@@ -6,7 +6,7 @@ import { readFileAsString } from '../../../helpers/readFileAsString';
 
 
 import { JavaScriptObfuscator } from '../../../../src/JavaScriptObfuscatorFacade';
 import { JavaScriptObfuscator } from '../../../../src/JavaScriptObfuscatorFacade';
 
 
-describe('StringArrayRotateFunctionNode', () => {
+describe('StringArrayRotateFunctionCodeHelper', () => {
     const regExp: RegExp = /while *\(-- *_0x([a-f0-9]){4,6}\) *\{/;
     const regExp: RegExp = /while *\(-- *_0x([a-f0-9]){4,6}\) *\{/;
 
 
     describe('`stringArray` option is set', () => {
     describe('`stringArray` option is set', () => {
@@ -26,7 +26,7 @@ describe('StringArrayRotateFunctionNode', () => {
             ).getObfuscatedCode();
             ).getObfuscatedCode();
         });
         });
 
 
-        it('should correctly append custom node into the obfuscated code', () => {
+        it('should correctly append code helper into the obfuscated code', () => {
             assert.match(obfuscatedCode, regExp);
             assert.match(obfuscatedCode, regExp);
         });
         });
     });
     });
@@ -48,7 +48,7 @@ describe('StringArrayRotateFunctionNode', () => {
             ).getObfuscatedCode();
             ).getObfuscatedCode();
         });
         });
 
 
-        it('shouldn\'t append custom node into the obfuscated code', () => {
+        it('shouldn\'t append code helper into the obfuscated code', () => {
             assert.notMatch(obfuscatedCode, regExp);
             assert.notMatch(obfuscatedCode, regExp);
         });
         });
     });
     });

部分文件因为文件数量过多而无法显示