mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
identifierNamesGenerator option
This commit is contained in:
@@ -240,11 +240,11 @@ export class JavaScriptObfuscatorCLI implements IInitializable {
|
||||
ArraySanitizer
|
||||
)
|
||||
.option(
|
||||
'--log <boolean>', 'Enables logging of the information to the console',
|
||||
'--identifier-names-generator <string> [hexadecimal, mangled]', 'Sets identifier names generator (Default: hexadecimal)',
|
||||
BooleanSanitizer
|
||||
)
|
||||
.option(
|
||||
'--mangle <boolean>', 'Enables mangling of variable names',
|
||||
'--log <boolean>', 'Enables logging of the information to the console',
|
||||
BooleanSanitizer
|
||||
)
|
||||
.option(
|
||||
|
||||
@@ -4,7 +4,7 @@ export enum ServiceIdentifiers {
|
||||
Factory__IControlFlowReplacer = 'Factory<IControlFlowReplacer>',
|
||||
Factory__ICustomNode = 'Factory<ICustomNode>',
|
||||
Factory__ICustomNodeGroup = 'Factory<ICustomNodeGroup>',
|
||||
Factory__IIdentifierNameGenerator = 'Factory<IIdentifierNameGenerator>',
|
||||
Factory__IIdentifierNamesGenerator = 'Factory<IIdentifierNamesGenerator>',
|
||||
Factory__IIdentifierObfuscatingReplacer = 'Factory<IIdentifierObfuscatingReplacer>',
|
||||
Factory__INodeGuard = 'Factory<INodeGuard>',
|
||||
Factory__INodeTransformer = 'Factory<INodeTransformer[]>',
|
||||
@@ -18,7 +18,7 @@ export enum ServiceIdentifiers {
|
||||
ICustomNodeGroup = 'ICustomNodeGroup',
|
||||
IControlFlowReplacer = 'IControlFlowReplacer',
|
||||
IEscapeSequenceEncoder = 'IEscapeSequenceEncoder',
|
||||
IIdentifierNameGenerator = 'IIdentifierNameGenerator',
|
||||
IIdentifierNamesGenerator = 'IIdentifierNamesGenerator',
|
||||
IIdentifierObfuscatingReplacer = 'IIdentifierObfuscatingReplacer',
|
||||
IJavaScriptObfuscator = 'IJavaScriptObfuscator',
|
||||
ILogger = 'ILogger',
|
||||
|
||||
@@ -145,7 +145,7 @@ export const customNodesModule: interfaces.ContainerModule = new ContainerModule
|
||||
.toFactory<ICustomNode>(InversifyContainerFacade
|
||||
.getConstructorFactory<ControlFlowCustomNode, ICustomNode>(
|
||||
ServiceIdentifiers.Newable__ICustomNode,
|
||||
ServiceIdentifiers.Factory__IIdentifierNameGenerator,
|
||||
ServiceIdentifiers.Factory__IIdentifierNamesGenerator,
|
||||
ServiceIdentifiers.IRandomGenerator,
|
||||
ServiceIdentifiers.IOptions
|
||||
));
|
||||
|
||||
@@ -1,58 +1,58 @@
|
||||
import { ContainerModule, interfaces } from 'inversify';
|
||||
import { ServiceIdentifiers } from '../../ServiceIdentifiers';
|
||||
|
||||
import { IIdentifierNameGenerator } from '../../../interfaces/generators/identifier-name-generators/IIdentifierNameGenerator';
|
||||
import { IIdentifierNamesGenerator } from '../../../interfaces/generators/identifier-names-generators/IIdentifierNamesGenerator';
|
||||
import { IOptions } from '../../../interfaces/options/IOptions';
|
||||
|
||||
import { IdentifierNameGenerator } from '../../../enums/generators/identifier-name-generators/IdentifierNameGenerator';
|
||||
import { IdentifierNamesGenerator } from '../../../enums/generators/identifier-names-generators/IdentifierNamesGenerator';
|
||||
|
||||
import { HexadecimalIdentifierNameGenerator } from '../../../generators/identifier-name-generators/HexadecimalIdentifierNameGenerator';
|
||||
import { MangledIdentifierNameGenerator } from '../../../generators/identifier-name-generators/MangledIdentifierNameGenerator';
|
||||
import { HexadecimalIdentifierNamesGenerator } from '../../../generators/identifier-names-generators/HexadecimalIdentifierNamesGenerator';
|
||||
import { MangledIdentifierNamesGenerator } from '../../../generators/identifier-names-generators/MangledIdentifierNamesGenerator';
|
||||
|
||||
export const generatorsModule: interfaces.ContainerModule = new ContainerModule((bind: interfaces.Bind) => {
|
||||
// identifier name generators
|
||||
bind<IIdentifierNameGenerator>(ServiceIdentifiers.IIdentifierNameGenerator)
|
||||
.to(HexadecimalIdentifierNameGenerator)
|
||||
bind<IIdentifierNamesGenerator>(ServiceIdentifiers.IIdentifierNamesGenerator)
|
||||
.to(HexadecimalIdentifierNamesGenerator)
|
||||
.inSingletonScope()
|
||||
.whenTargetNamed(IdentifierNameGenerator.HexadecimalIdentifierNameGenerator);
|
||||
.whenTargetNamed(IdentifierNamesGenerator.HexadecimalIdentifierNamesGenerator);
|
||||
|
||||
bind<IIdentifierNameGenerator>(ServiceIdentifiers.IIdentifierNameGenerator)
|
||||
.to(MangledIdentifierNameGenerator)
|
||||
bind<IIdentifierNamesGenerator>(ServiceIdentifiers.IIdentifierNamesGenerator)
|
||||
.to(MangledIdentifierNamesGenerator)
|
||||
.inSingletonScope()
|
||||
.whenTargetNamed(IdentifierNameGenerator.MangledIdentifierNameGenerator);
|
||||
.whenTargetNamed(IdentifierNamesGenerator.MangledIdentifierNamesGenerator);
|
||||
|
||||
// identifier name generator factory
|
||||
bind<IIdentifierNameGenerator>(ServiceIdentifiers.Factory__IIdentifierNameGenerator)
|
||||
.toFactory<IIdentifierNameGenerator>((context: interfaces.Context): (options: IOptions) => IIdentifierNameGenerator => {
|
||||
const cache: Map <boolean, IIdentifierNameGenerator> = new Map();
|
||||
bind<IIdentifierNamesGenerator>(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
|
||||
.toFactory<IIdentifierNamesGenerator>((context: interfaces.Context): (options: IOptions) => IIdentifierNamesGenerator => {
|
||||
let cachedIdentifierNamesGenerator: IIdentifierNamesGenerator | null = null;
|
||||
|
||||
return (options: IOptions) => {
|
||||
if (cache.has(options.mangle)) {
|
||||
return <IIdentifierNameGenerator>cache.get(options.mangle);
|
||||
if (cachedIdentifierNamesGenerator) {
|
||||
return cachedIdentifierNamesGenerator;
|
||||
}
|
||||
|
||||
let identifierNameGenerator: IIdentifierNameGenerator;
|
||||
let identifierNamesGenerator: IIdentifierNamesGenerator;
|
||||
|
||||
switch (options.mangle) {
|
||||
case true:
|
||||
identifierNameGenerator = context.container.getNamed<IIdentifierNameGenerator>(
|
||||
ServiceIdentifiers.IIdentifierNameGenerator,
|
||||
IdentifierNameGenerator.MangledIdentifierNameGenerator
|
||||
switch (options.identifierNamesGenerator) {
|
||||
case IdentifierNamesGenerator.MangledIdentifierNamesGenerator:
|
||||
identifierNamesGenerator = context.container.getNamed<IIdentifierNamesGenerator>(
|
||||
ServiceIdentifiers.IIdentifierNamesGenerator,
|
||||
IdentifierNamesGenerator.MangledIdentifierNamesGenerator
|
||||
);
|
||||
|
||||
break;
|
||||
|
||||
case false:
|
||||
case IdentifierNamesGenerator.HexadecimalIdentifierNamesGenerator:
|
||||
default:
|
||||
identifierNameGenerator = context.container.getNamed<IIdentifierNameGenerator>(
|
||||
ServiceIdentifiers.IIdentifierNameGenerator,
|
||||
IdentifierNameGenerator.HexadecimalIdentifierNameGenerator
|
||||
identifierNamesGenerator = context.container.getNamed<IIdentifierNamesGenerator>(
|
||||
ServiceIdentifiers.IIdentifierNamesGenerator,
|
||||
IdentifierNamesGenerator.HexadecimalIdentifierNamesGenerator
|
||||
);
|
||||
}
|
||||
|
||||
cache.set(options.mangle, identifierNameGenerator);
|
||||
cachedIdentifierNamesGenerator = identifierNamesGenerator;
|
||||
|
||||
return identifierNameGenerator;
|
||||
return identifierNamesGenerator;
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { inject, injectable } from 'inversify';
|
||||
import { ServiceIdentifiers } from '../container/ServiceIdentifiers';
|
||||
|
||||
import { TIdentifierNameGeneratorFactory } from '../types/container/generators/TIdentifierNameGeneratorFactory';
|
||||
import { TIdentifierNamesGeneratorFactory } from '../types/container/generators/TIdentifierNamesGeneratorFactory';
|
||||
import { TStatement } from '../types/node/TStatement';
|
||||
|
||||
import { ICustomNode } from '../interfaces/custom-nodes/ICustomNode';
|
||||
import { IIdentifierNameGenerator } from '../interfaces/generators/identifier-name-generators/IIdentifierNameGenerator';
|
||||
import { IIdentifierNamesGenerator } from '../interfaces/generators/identifier-names-generators/IIdentifierNamesGenerator';
|
||||
import { IOptions } from '../interfaces/options/IOptions';
|
||||
import { IRandomGenerator } from '../interfaces/utils/IRandomGenerator';
|
||||
|
||||
@@ -35,9 +35,9 @@ export abstract class AbstractCustomNode implements ICustomNode {
|
||||
protected cachedNode: TStatement[];
|
||||
|
||||
/**
|
||||
* @type {IIdentifierNameGenerator}
|
||||
* @type {IIdentifierNamesGenerator}
|
||||
*/
|
||||
protected readonly identifierNameGenerator: IIdentifierNameGenerator;
|
||||
protected readonly identifierNamesGenerator: IIdentifierNamesGenerator;
|
||||
|
||||
/**
|
||||
* @type {IOptions}
|
||||
@@ -50,17 +50,17 @@ export abstract class AbstractCustomNode implements ICustomNode {
|
||||
protected readonly randomGenerator: IRandomGenerator;
|
||||
|
||||
/**
|
||||
* @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory
|
||||
* @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
|
||||
* @param {IRandomGenerator} randomGenerator
|
||||
* @param {IOptions} options
|
||||
*/
|
||||
constructor (
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator)
|
||||
identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
|
||||
identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
|
||||
@inject(ServiceIdentifiers.IOptions) options: IOptions
|
||||
) {
|
||||
this.identifierNameGenerator = identifierNameGeneratorFactory(options);
|
||||
this.identifierNamesGenerator = identifierNamesGeneratorFactory(options);
|
||||
this.randomGenerator = randomGenerator;
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { inject, injectable } from 'inversify';
|
||||
import { ServiceIdentifiers } from '../container/ServiceIdentifiers';
|
||||
|
||||
import { TIdentifierNameGeneratorFactory } from '../types/container/generators/TIdentifierNameGeneratorFactory';
|
||||
import { TIdentifierNamesGeneratorFactory } from '../types/container/generators/TIdentifierNamesGeneratorFactory';
|
||||
import { TNodeWithBlockStatement } from '../types/node/TNodeWithBlockStatement';
|
||||
|
||||
import { ICustomNode } from '../interfaces/custom-nodes/ICustomNode';
|
||||
import { ICustomNodeGroup } from '../interfaces/custom-nodes/ICustomNodeGroup';
|
||||
import { IIdentifierNameGenerator } from '../interfaces/generators/identifier-name-generators/IIdentifierNameGenerator';
|
||||
import { IIdentifierNamesGenerator } from '../interfaces/generators/identifier-names-generators/IIdentifierNamesGenerator';
|
||||
import { IOptions } from '../interfaces/options/IOptions';
|
||||
import { IRandomGenerator } from '../interfaces/utils/IRandomGenerator';
|
||||
import { IStackTraceData } from '../interfaces/analyzers/stack-trace-analyzer/IStackTraceData';
|
||||
@@ -27,9 +27,9 @@ export abstract class AbstractCustomNodeGroup implements ICustomNodeGroup {
|
||||
protected abstract customNodes: Map <CustomNode, ICustomNode>;
|
||||
|
||||
/**
|
||||
* @type {IIdentifierNameGenerator}
|
||||
* @type {IIdentifierNamesGenerator}
|
||||
*/
|
||||
protected readonly identifierNameGenerator: IIdentifierNameGenerator;
|
||||
protected readonly identifierNamesGenerator: IIdentifierNamesGenerator;
|
||||
|
||||
/**
|
||||
* @type {IOptions}
|
||||
@@ -47,17 +47,17 @@ export abstract class AbstractCustomNodeGroup implements ICustomNodeGroup {
|
||||
protected readonly stackTraceData: IStackTraceData[];
|
||||
|
||||
/**
|
||||
* @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory
|
||||
* @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
|
||||
* @param {IRandomGenerator} randomGenerator
|
||||
* @param {IOptions} options
|
||||
*/
|
||||
constructor (
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator)
|
||||
identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
|
||||
identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
|
||||
@inject(ServiceIdentifiers.IOptions) options: IOptions
|
||||
) {
|
||||
this.identifierNameGenerator = identifierNameGeneratorFactory(options);
|
||||
this.identifierNamesGenerator = identifierNamesGeneratorFactory(options);
|
||||
this.randomGenerator = randomGenerator;
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ import { initializable } from '../../decorators/Initializable';
|
||||
|
||||
import { AbstractCustomNode } from '../AbstractCustomNode';
|
||||
import { NodeUtils } from '../../node/NodeUtils';
|
||||
import { TIdentifierNameGeneratorFactory } from '../../types/container/generators/TIdentifierNameGeneratorFactory';
|
||||
import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
|
||||
|
||||
@injectable()
|
||||
export class ConsoleOutputDisableExpressionNode extends AbstractCustomNode {
|
||||
@@ -28,17 +28,17 @@ export class ConsoleOutputDisableExpressionNode extends AbstractCustomNode {
|
||||
private callsControllerFunctionName: string;
|
||||
|
||||
/**
|
||||
* @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory
|
||||
* @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
|
||||
* @param {IRandomGenerator} randomGenerator
|
||||
* @param {IOptions} options
|
||||
*/
|
||||
constructor (
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator)
|
||||
identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
|
||||
identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
|
||||
@inject(ServiceIdentifiers.IOptions) options: IOptions
|
||||
) {
|
||||
super(identifierNameGeneratorFactory, randomGenerator, options);
|
||||
super(identifierNamesGeneratorFactory, randomGenerator, options);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -64,7 +64,7 @@ export class ConsoleOutputDisableExpressionNode extends AbstractCustomNode {
|
||||
: GlobalVariableNoEvalTemplate();
|
||||
|
||||
return format(ConsoleOutputDisableExpressionTemplate(), {
|
||||
consoleLogDisableFunctionName: this.identifierNameGenerator.generate(6),
|
||||
consoleLogDisableFunctionName: this.identifierNamesGenerator.generate(6),
|
||||
globalVariableTemplate,
|
||||
singleNodeCallControllerFunctionName: this.callsControllerFunctionName
|
||||
});
|
||||
|
||||
@@ -2,7 +2,7 @@ import { inject, injectable, } from 'inversify';
|
||||
import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
|
||||
|
||||
import { TCustomNodeFactory } from '../../../types/container/custom-nodes/TCustomNodeFactory';
|
||||
import { TIdentifierNameGeneratorFactory } from '../../../types/container/generators/TIdentifierNameGeneratorFactory';
|
||||
import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory';
|
||||
import { TNodeWithBlockStatement } from '../../../types/node/TNodeWithBlockStatement';
|
||||
|
||||
import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
|
||||
@@ -38,18 +38,18 @@ export class ConsoleOutputCustomNodeGroup extends AbstractCustomNodeGroup {
|
||||
|
||||
/**
|
||||
* @param {TCustomNodeFactory} customNodeFactory
|
||||
* @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory
|
||||
* @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
|
||||
* @param {IRandomGenerator} randomGenerator
|
||||
* @param {IOptions} options
|
||||
*/
|
||||
constructor (
|
||||
@inject(ServiceIdentifiers.Factory__ICustomNode) customNodeFactory: TCustomNodeFactory,
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator)
|
||||
identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
|
||||
identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
|
||||
@inject(ServiceIdentifiers.IOptions) options: IOptions
|
||||
) {
|
||||
super(identifierNameGeneratorFactory, randomGenerator, options);
|
||||
super(identifierNamesGeneratorFactory, randomGenerator, options);
|
||||
|
||||
this.customNodeFactory = customNodeFactory;
|
||||
}
|
||||
@@ -92,7 +92,7 @@ export class ConsoleOutputCustomNodeGroup extends AbstractCustomNodeGroup {
|
||||
return;
|
||||
}
|
||||
|
||||
const callsControllerFunctionName: string = this.identifierNameGenerator.generate(6);
|
||||
const callsControllerFunctionName: string = this.identifierNamesGenerator.generate(6);
|
||||
|
||||
const consoleOutputDisableExpressionNode: ICustomNode = this.customNodeFactory(CustomNode.ConsoleOutputDisableExpressionNode);
|
||||
const nodeCallsControllerFunctionNode: ICustomNode = this.customNodeFactory(CustomNode.NodeCallsControllerFunctionNode);
|
||||
|
||||
@@ -3,7 +3,7 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
|
||||
|
||||
import { BinaryOperator } from 'estree';
|
||||
|
||||
import { TIdentifierNameGeneratorFactory } from '../../types/container/generators/TIdentifierNameGeneratorFactory';
|
||||
import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
|
||||
import { TStatement } from '../../types/node/TStatement';
|
||||
|
||||
import { IOptions } from '../../interfaces/options/IOptions';
|
||||
@@ -24,17 +24,17 @@ export class BinaryExpressionFunctionNode extends AbstractCustomNode {
|
||||
private operator: BinaryOperator;
|
||||
|
||||
/**
|
||||
* @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory
|
||||
* @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
|
||||
* @param {IRandomGenerator} randomGenerator
|
||||
* @param {IOptions} options
|
||||
*/
|
||||
constructor (
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator)
|
||||
identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
|
||||
identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
|
||||
@inject(ServiceIdentifiers.IOptions) options: IOptions
|
||||
) {
|
||||
super(identifierNameGeneratorFactory, randomGenerator, options);
|
||||
super(identifierNamesGeneratorFactory, randomGenerator, options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+5
-5
@@ -3,7 +3,7 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
|
||||
|
||||
import * as ESTree from 'estree';
|
||||
|
||||
import { TIdentifierNameGeneratorFactory } from '../../types/container/generators/TIdentifierNameGeneratorFactory';
|
||||
import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
|
||||
import { TStatement } from '../../types/node/TStatement';
|
||||
|
||||
import { IOptions } from '../../interfaces/options/IOptions';
|
||||
@@ -37,17 +37,17 @@ export class BlockStatementControlFlowFlatteningNode extends AbstractCustomNode
|
||||
private shuffledKeys: number[];
|
||||
|
||||
/**
|
||||
* @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory
|
||||
* @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
|
||||
* @param {IRandomGenerator} randomGenerator
|
||||
* @param {IOptions} options
|
||||
*/
|
||||
constructor (
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator)
|
||||
identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
|
||||
identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
|
||||
@inject(ServiceIdentifiers.IOptions) options: IOptions
|
||||
) {
|
||||
super(identifierNameGeneratorFactory, randomGenerator, options);
|
||||
super(identifierNamesGeneratorFactory, randomGenerator, options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,7 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
|
||||
|
||||
import * as ESTree from 'estree';
|
||||
|
||||
import { TIdentifierNameGeneratorFactory } from '../../types/container/generators/TIdentifierNameGeneratorFactory';
|
||||
import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
|
||||
import { TStatement } from '../../types/node/TStatement';
|
||||
|
||||
import { IOptions } from '../../interfaces/options/IOptions';
|
||||
@@ -24,17 +24,17 @@ export class CallExpressionFunctionNode extends AbstractCustomNode {
|
||||
private expressionArguments: (ESTree.Expression | ESTree.SpreadElement)[];
|
||||
|
||||
/**
|
||||
* @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory
|
||||
* @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
|
||||
* @param {IRandomGenerator} randomGenerator
|
||||
* @param {IOptions} options
|
||||
*/
|
||||
constructor (
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator)
|
||||
identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
|
||||
identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
|
||||
@inject(ServiceIdentifiers.IOptions) options: IOptions
|
||||
) {
|
||||
super(identifierNameGeneratorFactory, randomGenerator, options);
|
||||
super(identifierNamesGeneratorFactory, randomGenerator, options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,7 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
|
||||
|
||||
import { LogicalOperator } from 'estree';
|
||||
|
||||
import { TIdentifierNameGeneratorFactory } from '../../types/container/generators/TIdentifierNameGeneratorFactory';
|
||||
import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
|
||||
import { TStatement } from '../../types/node/TStatement';
|
||||
|
||||
import { IOptions } from '../../interfaces/options/IOptions';
|
||||
@@ -24,17 +24,17 @@ export class LogicalExpressionFunctionNode extends AbstractCustomNode {
|
||||
private operator: LogicalOperator;
|
||||
|
||||
/**
|
||||
* @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory
|
||||
* @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
|
||||
* @param {IRandomGenerator} randomGenerator
|
||||
* @param {IOptions} options
|
||||
*/
|
||||
constructor (
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator)
|
||||
identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
|
||||
identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
|
||||
@inject(ServiceIdentifiers.IOptions) options: IOptions
|
||||
) {
|
||||
super(identifierNameGeneratorFactory, randomGenerator, options);
|
||||
super(identifierNamesGeneratorFactory, randomGenerator, options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { inject, injectable, } from 'inversify';
|
||||
import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
|
||||
|
||||
import { TIdentifierNameGeneratorFactory } from '../../types/container/generators/TIdentifierNameGeneratorFactory';
|
||||
import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
|
||||
import { TStatement } from '../../types/node/TStatement';
|
||||
|
||||
import { IOptions } from '../../interfaces/options/IOptions';
|
||||
@@ -21,17 +21,17 @@ export class StringLiteralNode extends AbstractCustomNode {
|
||||
private literalValue: string;
|
||||
|
||||
/**
|
||||
* @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory
|
||||
* @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
|
||||
* @param {IRandomGenerator} randomGenerator
|
||||
* @param {IOptions} options
|
||||
*/
|
||||
constructor (
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator)
|
||||
identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
|
||||
identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
|
||||
@inject(ServiceIdentifiers.IOptions) options: IOptions
|
||||
) {
|
||||
super(identifierNameGeneratorFactory, randomGenerator, options);
|
||||
super(identifierNamesGeneratorFactory, randomGenerator, options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+5
-5
@@ -4,7 +4,7 @@ import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
|
||||
import * as ESTree from 'estree';
|
||||
import { Expression } from 'estree';
|
||||
|
||||
import { TIdentifierNameGeneratorFactory } from '../../../types/container/generators/TIdentifierNameGeneratorFactory';
|
||||
import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory';
|
||||
import { TStatement } from '../../../types/node/TStatement';
|
||||
|
||||
import { IOptions } from '../../../interfaces/options/IOptions';
|
||||
@@ -43,17 +43,17 @@ export class CallExpressionControlFlowStorageCallNode extends AbstractCustomNode
|
||||
private expressionArguments: (ESTree.Expression | ESTree.SpreadElement)[];
|
||||
|
||||
/**
|
||||
* @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory
|
||||
* @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
|
||||
* @param {IRandomGenerator} randomGenerator
|
||||
* @param {IOptions} options
|
||||
*/
|
||||
constructor (
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator)
|
||||
identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
|
||||
identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
|
||||
@inject(ServiceIdentifiers.IOptions) options: IOptions
|
||||
) {
|
||||
super(identifierNameGeneratorFactory, randomGenerator, options);
|
||||
super(identifierNamesGeneratorFactory, randomGenerator, options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+5
-5
@@ -3,7 +3,7 @@ import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
|
||||
|
||||
import * as ESTree from 'estree';
|
||||
|
||||
import { TIdentifierNameGeneratorFactory } from '../../../types/container/generators/TIdentifierNameGeneratorFactory';
|
||||
import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory';
|
||||
import { TStatement } from '../../../types/node/TStatement';
|
||||
|
||||
import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
|
||||
@@ -26,17 +26,17 @@ export class ControlFlowStorageNode extends AbstractCustomNode {
|
||||
private controlFlowStorage: IStorage <ICustomNode>;
|
||||
|
||||
/**
|
||||
* @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory
|
||||
* @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
|
||||
* @param {IRandomGenerator} randomGenerator
|
||||
* @param {IOptions} options
|
||||
*/
|
||||
constructor (
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator)
|
||||
identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
|
||||
identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
|
||||
@inject(ServiceIdentifiers.IOptions) options: IOptions
|
||||
) {
|
||||
super(identifierNameGeneratorFactory, randomGenerator, options);
|
||||
super(identifierNamesGeneratorFactory, randomGenerator, options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+5
-5
@@ -3,7 +3,7 @@ import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
|
||||
|
||||
import { Expression } from 'estree';
|
||||
|
||||
import { TIdentifierNameGeneratorFactory } from '../../../types/container/generators/TIdentifierNameGeneratorFactory';
|
||||
import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory';
|
||||
import { TStatement } from '../../../types/node/TStatement';
|
||||
|
||||
import { IOptions } from '../../../interfaces/options/IOptions';
|
||||
@@ -42,17 +42,17 @@ export class ExpressionWithOperatorControlFlowStorageCallNode extends AbstractCu
|
||||
private rightValue: Expression;
|
||||
|
||||
/**
|
||||
* @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory
|
||||
* @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
|
||||
* @param {IRandomGenerator} randomGenerator
|
||||
* @param {IOptions} options
|
||||
*/
|
||||
constructor (
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator)
|
||||
identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
|
||||
identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
|
||||
@inject(ServiceIdentifiers.IOptions) options: IOptions
|
||||
) {
|
||||
super(identifierNameGeneratorFactory, randomGenerator, options);
|
||||
super(identifierNamesGeneratorFactory, randomGenerator, options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+5
-5
@@ -1,7 +1,7 @@
|
||||
import { inject, injectable, } from 'inversify';
|
||||
import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
|
||||
|
||||
import { TIdentifierNameGeneratorFactory } from '../../../types/container/generators/TIdentifierNameGeneratorFactory';
|
||||
import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory';
|
||||
import { TStatement } from '../../../types/node/TStatement';
|
||||
|
||||
import { IOptions } from '../../../interfaces/options/IOptions';
|
||||
@@ -28,17 +28,17 @@ export class StringLiteralControlFlowStorageCallNode extends AbstractCustomNode
|
||||
private controlFlowStorageName: string;
|
||||
|
||||
/**
|
||||
* @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory
|
||||
* @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
|
||||
* @param {IRandomGenerator} randomGenerator
|
||||
* @param {IOptions} options
|
||||
*/
|
||||
constructor (
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator)
|
||||
identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
|
||||
identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
|
||||
@inject(ServiceIdentifiers.IOptions) options: IOptions
|
||||
) {
|
||||
super(identifierNameGeneratorFactory, randomGenerator, options);
|
||||
super(identifierNamesGeneratorFactory, randomGenerator, options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,7 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
|
||||
|
||||
import * as format from 'string-template';
|
||||
|
||||
import { TIdentifierNameGeneratorFactory } from '../../types/container/generators/TIdentifierNameGeneratorFactory';
|
||||
import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
|
||||
import { TStatement } from '../../types/node/TStatement';
|
||||
|
||||
import { IOptions } from '../../interfaces/options/IOptions';
|
||||
@@ -31,17 +31,17 @@ export class DebugProtectionFunctionCallNode extends AbstractCustomNode {
|
||||
private debugProtectionFunctionName: string;
|
||||
|
||||
/**
|
||||
* @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory
|
||||
* @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
|
||||
* @param {IRandomGenerator} randomGenerator
|
||||
* @param {IOptions} options
|
||||
*/
|
||||
constructor (
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator)
|
||||
identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
|
||||
identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
|
||||
@inject(ServiceIdentifiers.IOptions) options: IOptions
|
||||
) {
|
||||
super(identifierNameGeneratorFactory, randomGenerator, options);
|
||||
super(identifierNamesGeneratorFactory, randomGenerator, options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,7 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
|
||||
|
||||
import * as format from 'string-template';
|
||||
|
||||
import { TIdentifierNameGeneratorFactory } from '../../types/container/generators/TIdentifierNameGeneratorFactory';
|
||||
import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
|
||||
import { TStatement } from '../../types/node/TStatement';
|
||||
|
||||
import { IOptions } from '../../interfaces/options/IOptions';
|
||||
@@ -25,17 +25,17 @@ export class DebugProtectionFunctionIntervalNode extends AbstractCustomNode {
|
||||
private debugProtectionFunctionName: string;
|
||||
|
||||
/**
|
||||
* @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory
|
||||
* @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
|
||||
* @param {IRandomGenerator} randomGenerator
|
||||
* @param {IOptions} options
|
||||
*/
|
||||
constructor (
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator)
|
||||
identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
|
||||
identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
|
||||
@inject(ServiceIdentifiers.IOptions) options: IOptions
|
||||
) {
|
||||
super(identifierNameGeneratorFactory, randomGenerator, options);
|
||||
super(identifierNamesGeneratorFactory, randomGenerator, options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,7 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
|
||||
|
||||
import * as format from 'string-template';
|
||||
|
||||
import { TIdentifierNameGeneratorFactory } from '../../types/container/generators/TIdentifierNameGeneratorFactory';
|
||||
import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
|
||||
import { TStatement } from '../../types/node/TStatement';
|
||||
|
||||
import { IOptions } from '../../interfaces/options/IOptions';
|
||||
@@ -29,17 +29,17 @@ export class DebugProtectionFunctionNode extends AbstractCustomNode {
|
||||
private debugProtectionFunctionName: string;
|
||||
|
||||
/**
|
||||
* @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory
|
||||
* @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
|
||||
* @param {IRandomGenerator} randomGenerator
|
||||
* @param {IOptions} options
|
||||
*/
|
||||
constructor (
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator)
|
||||
identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
|
||||
identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
|
||||
@inject(ServiceIdentifiers.IOptions) options: IOptions
|
||||
) {
|
||||
super(identifierNameGeneratorFactory, randomGenerator, options);
|
||||
super(identifierNamesGeneratorFactory, randomGenerator, options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@ import { inject, injectable, } from 'inversify';
|
||||
import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
|
||||
|
||||
import { TCustomNodeFactory } from '../../../types/container/custom-nodes/TCustomNodeFactory';
|
||||
import { TIdentifierNameGeneratorFactory } from '../../../types/container/generators/TIdentifierNameGeneratorFactory';
|
||||
import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory';
|
||||
import { TNodeWithBlockStatement } from '../../../types/node/TNodeWithBlockStatement';
|
||||
|
||||
import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
|
||||
@@ -38,18 +38,18 @@ export class DebugProtectionCustomNodeGroup extends AbstractCustomNodeGroup {
|
||||
|
||||
/**
|
||||
* @param {TCustomNodeFactory} customNodeFactory
|
||||
* @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory
|
||||
* @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
|
||||
* @param {IRandomGenerator} randomGenerator
|
||||
* @param {IOptions} options
|
||||
*/
|
||||
constructor (
|
||||
@inject(ServiceIdentifiers.Factory__ICustomNode) customNodeFactory: TCustomNodeFactory,
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator)
|
||||
identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
|
||||
identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
|
||||
@inject(ServiceIdentifiers.IOptions) options: IOptions
|
||||
) {
|
||||
super(identifierNameGeneratorFactory, randomGenerator, options);
|
||||
super(identifierNamesGeneratorFactory, randomGenerator, options);
|
||||
|
||||
this.customNodeFactory = customNodeFactory;
|
||||
}
|
||||
@@ -105,8 +105,8 @@ export class DebugProtectionCustomNodeGroup extends AbstractCustomNodeGroup {
|
||||
return;
|
||||
}
|
||||
|
||||
const debugProtectionFunctionName: string = this.identifierNameGenerator.generate(6);
|
||||
const callsControllerFunctionName: string = this.identifierNameGenerator.generate(6);
|
||||
const debugProtectionFunctionName: string = this.identifierNamesGenerator.generate(6);
|
||||
const callsControllerFunctionName: string = this.identifierNamesGenerator.generate(6);
|
||||
|
||||
const debugProtectionFunctionNode: ICustomNode = this.customNodeFactory(CustomNode.DebugProtectionFunctionNode);
|
||||
const debugProtectionFunctionCallNode: ICustomNode = this.customNodeFactory(CustomNode.DebugProtectionFunctionCallNode);
|
||||
|
||||
@@ -3,7 +3,7 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
|
||||
|
||||
import * as format from 'string-template';
|
||||
|
||||
import { TIdentifierNameGeneratorFactory } from '../../types/container/generators/TIdentifierNameGeneratorFactory';
|
||||
import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
|
||||
import { TStatement } from '../../types/node/TStatement';
|
||||
|
||||
import { ICryptUtils } from '../../interfaces/utils/ICryptUtils';
|
||||
@@ -34,19 +34,19 @@ export class DomainLockNode extends AbstractCustomNode {
|
||||
private readonly cryptUtils: ICryptUtils;
|
||||
|
||||
/**
|
||||
* @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory
|
||||
* @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
|
||||
* @param {IRandomGenerator} randomGenerator
|
||||
* @param {ICryptUtils} cryptUtils
|
||||
* @param {IOptions} options
|
||||
*/
|
||||
constructor (
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator)
|
||||
identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
|
||||
identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
|
||||
@inject(ServiceIdentifiers.ICryptUtils) cryptUtils: ICryptUtils,
|
||||
@inject(ServiceIdentifiers.IOptions) options: IOptions
|
||||
) {
|
||||
super(identifierNameGeneratorFactory, randomGenerator, options);
|
||||
super(identifierNamesGeneratorFactory, randomGenerator, options);
|
||||
|
||||
this.cryptUtils = cryptUtils;
|
||||
}
|
||||
@@ -79,7 +79,7 @@ export class DomainLockNode extends AbstractCustomNode {
|
||||
: GlobalVariableNoEvalTemplate();
|
||||
|
||||
return format(DomainLockNodeTemplate(), {
|
||||
domainLockFunctionName: this.identifierNameGenerator.generate(6),
|
||||
domainLockFunctionName: this.identifierNamesGenerator.generate(6),
|
||||
diff: diff,
|
||||
domains: hiddenDomainsString,
|
||||
globalVariableTemplate,
|
||||
|
||||
@@ -2,7 +2,7 @@ import { inject, injectable, } from 'inversify';
|
||||
import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
|
||||
|
||||
import { TCustomNodeFactory } from '../../../types/container/custom-nodes/TCustomNodeFactory';
|
||||
import { TIdentifierNameGeneratorFactory } from '../../../types/container/generators/TIdentifierNameGeneratorFactory';
|
||||
import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory';
|
||||
import { TNodeWithBlockStatement } from '../../../types/node/TNodeWithBlockStatement';
|
||||
|
||||
import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
|
||||
@@ -38,18 +38,18 @@ export class DomainLockCustomNodeGroup extends AbstractCustomNodeGroup {
|
||||
|
||||
/**
|
||||
* @param {TCustomNodeFactory} customNodeFactory
|
||||
* @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory
|
||||
* @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
|
||||
* @param {IRandomGenerator} randomGenerator
|
||||
* @param {IOptions} options
|
||||
*/
|
||||
constructor (
|
||||
@inject(ServiceIdentifiers.Factory__ICustomNode) customNodeFactory: TCustomNodeFactory,
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator)
|
||||
identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
|
||||
identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
|
||||
@inject(ServiceIdentifiers.IOptions) options: IOptions
|
||||
) {
|
||||
super(identifierNameGeneratorFactory, randomGenerator, options);
|
||||
super(identifierNamesGeneratorFactory, randomGenerator, options);
|
||||
|
||||
this.customNodeFactory = customNodeFactory;
|
||||
}
|
||||
@@ -92,7 +92,7 @@ export class DomainLockCustomNodeGroup extends AbstractCustomNodeGroup {
|
||||
return;
|
||||
}
|
||||
|
||||
const callsControllerFunctionName: string = this.identifierNameGenerator.generate(6);
|
||||
const callsControllerFunctionName: string = this.identifierNamesGenerator.generate(6);
|
||||
|
||||
const domainLockNode: ICustomNode = this.customNodeFactory(CustomNode.DomainLockNode);
|
||||
const nodeCallsControllerFunctionNode: ICustomNode = this.customNodeFactory(CustomNode.NodeCallsControllerFunctionNode);
|
||||
|
||||
@@ -3,7 +3,7 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
|
||||
|
||||
import * as format from 'string-template';
|
||||
|
||||
import { TIdentifierNameGeneratorFactory } from '../../types/container/generators/TIdentifierNameGeneratorFactory';
|
||||
import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
|
||||
import { TStatement } from '../../types/node/TStatement';
|
||||
|
||||
import { IOptions } from '../../interfaces/options/IOptions';
|
||||
@@ -36,17 +36,17 @@ export class NodeCallsControllerFunctionNode extends AbstractCustomNode {
|
||||
private appendEvent: ObfuscationEvent;
|
||||
|
||||
/**
|
||||
* @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory
|
||||
* @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
|
||||
* @param {IRandomGenerator} randomGenerator
|
||||
* @param {IOptions} options
|
||||
*/
|
||||
constructor (
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator)
|
||||
identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
|
||||
identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
|
||||
@inject(ServiceIdentifiers.IOptions) options: IOptions
|
||||
) {
|
||||
super(identifierNameGeneratorFactory, randomGenerator, options);
|
||||
super(identifierNamesGeneratorFactory, randomGenerator, options);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -76,7 +76,7 @@ export class NodeCallsControllerFunctionNode extends AbstractCustomNode {
|
||||
}),
|
||||
{
|
||||
...NO_CUSTOM_NODES_PRESET,
|
||||
mangle: this.options.mangle,
|
||||
identifierNamesGenerator: this.options.identifierNamesGenerator,
|
||||
seed: this.options.seed
|
||||
}
|
||||
).getObfuscatedCode();
|
||||
|
||||
@@ -3,7 +3,7 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
|
||||
|
||||
import * as format from 'string-template';
|
||||
|
||||
import { TIdentifierNameGeneratorFactory } from '../../types/container/generators/TIdentifierNameGeneratorFactory';
|
||||
import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
|
||||
import { TStatement } from '../../types/node/TStatement';
|
||||
|
||||
import { IEscapeSequenceEncoder } from '../../interfaces/utils/IEscapeSequenceEncoder';
|
||||
@@ -34,19 +34,19 @@ export class SelfDefendingUnicodeNode extends AbstractCustomNode {
|
||||
private callsControllerFunctionName: string;
|
||||
|
||||
/**
|
||||
* @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory
|
||||
* @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
|
||||
* @param {IRandomGenerator} randomGenerator
|
||||
* @param {IEscapeSequenceEncoder} escapeSequenceEncoder
|
||||
* @param {IOptions} options
|
||||
*/
|
||||
constructor (
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator)
|
||||
identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
|
||||
identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
|
||||
@inject(ServiceIdentifiers.IEscapeSequenceEncoder) escapeSequenceEncoder: IEscapeSequenceEncoder,
|
||||
@inject(ServiceIdentifiers.IOptions) options: IOptions
|
||||
) {
|
||||
super(identifierNameGeneratorFactory, randomGenerator, options);
|
||||
super(identifierNamesGeneratorFactory, randomGenerator, options);
|
||||
|
||||
this.escapeSequenceEncoder = escapeSequenceEncoder;
|
||||
}
|
||||
@@ -71,12 +71,12 @@ export class SelfDefendingUnicodeNode extends AbstractCustomNode {
|
||||
protected getTemplate (): string {
|
||||
return JavaScriptObfuscator.obfuscate(
|
||||
format(SelfDefendingTemplate(this.escapeSequenceEncoder), {
|
||||
selfDefendingFunctionName: this.identifierNameGenerator.generate(6),
|
||||
selfDefendingFunctionName: this.identifierNamesGenerator.generate(6),
|
||||
singleNodeCallControllerFunctionName: this.callsControllerFunctionName
|
||||
}),
|
||||
{
|
||||
...NO_CUSTOM_NODES_PRESET,
|
||||
mangle: this.options.mangle,
|
||||
identifierNamesGenerator: this.options.identifierNamesGenerator,
|
||||
seed: this.options.seed,
|
||||
unicodeEscapeSequence: true
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import { inject, injectable, } from 'inversify';
|
||||
import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
|
||||
|
||||
import { TCustomNodeFactory } from '../../../types/container/custom-nodes/TCustomNodeFactory';
|
||||
import { TIdentifierNameGeneratorFactory } from '../../../types/container/generators/TIdentifierNameGeneratorFactory';
|
||||
import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory';
|
||||
import { TNodeWithBlockStatement } from '../../../types/node/TNodeWithBlockStatement';
|
||||
|
||||
import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
|
||||
@@ -38,18 +38,18 @@ export class SelfDefendingCustomNodeGroup extends AbstractCustomNodeGroup {
|
||||
|
||||
/**
|
||||
* @param {TCustomNodeFactory} customNodeFactory
|
||||
* @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory
|
||||
* @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
|
||||
* @param {IRandomGenerator} randomGenerator
|
||||
* @param {IOptions} options
|
||||
*/
|
||||
constructor (
|
||||
@inject(ServiceIdentifiers.Factory__ICustomNode) customNodeFactory: TCustomNodeFactory,
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator)
|
||||
identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
|
||||
identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
|
||||
@inject(ServiceIdentifiers.IOptions) options: IOptions
|
||||
) {
|
||||
super(identifierNameGeneratorFactory, randomGenerator, options);
|
||||
super(identifierNamesGeneratorFactory, randomGenerator, options);
|
||||
|
||||
this.customNodeFactory = customNodeFactory;
|
||||
}
|
||||
@@ -92,7 +92,7 @@ export class SelfDefendingCustomNodeGroup extends AbstractCustomNodeGroup {
|
||||
return;
|
||||
}
|
||||
|
||||
const callsControllerFunctionName: string = this.identifierNameGenerator.generate(6);
|
||||
const callsControllerFunctionName: string = this.identifierNamesGenerator.generate(6);
|
||||
|
||||
const selfDefendingUnicodeNode: ICustomNode = this.customNodeFactory(CustomNode.SelfDefendingUnicodeNode);
|
||||
const nodeCallsControllerFunctionNode: ICustomNode = this.customNodeFactory(CustomNode.NodeCallsControllerFunctionNode);
|
||||
|
||||
@@ -3,7 +3,7 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
|
||||
|
||||
import * as format from 'string-template';
|
||||
|
||||
import { TIdentifierNameGeneratorFactory } from '../../types/container/generators/TIdentifierNameGeneratorFactory';
|
||||
import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
|
||||
import { TStatement } from '../../types/node/TStatement';
|
||||
|
||||
import { IEscapeSequenceEncoder } from '../../interfaces/utils/IEscapeSequenceEncoder';
|
||||
@@ -49,19 +49,19 @@ export class StringArrayCallsWrapper extends AbstractCustomNode {
|
||||
private stringArrayCallsWrapperName: string;
|
||||
|
||||
/**
|
||||
* @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory
|
||||
* @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
|
||||
* @param {IRandomGenerator} randomGenerator
|
||||
* @param {IEscapeSequenceEncoder} escapeSequenceEncoder
|
||||
* @param {IOptions} options
|
||||
*/
|
||||
constructor (
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator)
|
||||
identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
|
||||
identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
|
||||
@inject(ServiceIdentifiers.IEscapeSequenceEncoder) escapeSequenceEncoder: IEscapeSequenceEncoder,
|
||||
@inject(ServiceIdentifiers.IOptions) options: IOptions
|
||||
) {
|
||||
super(identifierNameGeneratorFactory, randomGenerator, options);
|
||||
super(identifierNamesGeneratorFactory, randomGenerator, options);
|
||||
|
||||
this.escapeSequenceEncoder = escapeSequenceEncoder;
|
||||
}
|
||||
@@ -99,7 +99,7 @@ export class StringArrayCallsWrapper extends AbstractCustomNode {
|
||||
}),
|
||||
{
|
||||
...NO_CUSTOM_NODES_PRESET,
|
||||
mangle: this.options.mangle,
|
||||
identifierNamesGenerator: this.options.identifierNamesGenerator,
|
||||
seed: this.options.seed
|
||||
}
|
||||
).getObfuscatedCode();
|
||||
|
||||
@@ -3,7 +3,7 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
|
||||
|
||||
import * as format from 'string-template';
|
||||
|
||||
import { TIdentifierNameGeneratorFactory } from '../../types/container/generators/TIdentifierNameGeneratorFactory';
|
||||
import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
|
||||
import { TStatement } from '../../types/node/TStatement';
|
||||
|
||||
import { IOptions } from '../../interfaces/options/IOptions';
|
||||
@@ -39,17 +39,17 @@ export class StringArrayNode extends AbstractCustomNode {
|
||||
private stringArrayRotateValue: number;
|
||||
|
||||
/**
|
||||
* @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory
|
||||
* @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
|
||||
* @param {IRandomGenerator} randomGenerator
|
||||
* @param {IOptions} options
|
||||
*/
|
||||
constructor (
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator)
|
||||
identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
|
||||
identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
|
||||
@inject(ServiceIdentifiers.IOptions) options: IOptions
|
||||
) {
|
||||
super(identifierNameGeneratorFactory, randomGenerator, options);
|
||||
super(identifierNamesGeneratorFactory, randomGenerator, options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,7 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
|
||||
|
||||
import * as format from 'string-template';
|
||||
|
||||
import { TIdentifierNameGeneratorFactory } from '../../types/container/generators/TIdentifierNameGeneratorFactory';
|
||||
import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
|
||||
import { TStatement } from '../../types/node/TStatement';
|
||||
|
||||
import { IEscapeSequenceEncoder } from '../../interfaces/utils/IEscapeSequenceEncoder';
|
||||
@@ -42,19 +42,19 @@ export class StringArrayRotateFunctionNode extends AbstractCustomNode {
|
||||
private stringArrayRotateValue: number;
|
||||
|
||||
/**
|
||||
* @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory
|
||||
* @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
|
||||
* @param {IRandomGenerator} randomGenerator
|
||||
* @param {IEscapeSequenceEncoder} escapeSequenceEncoder
|
||||
* @param {IOptions} options
|
||||
*/
|
||||
constructor (
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator)
|
||||
identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
|
||||
identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
|
||||
@inject(ServiceIdentifiers.IEscapeSequenceEncoder) escapeSequenceEncoder: IEscapeSequenceEncoder,
|
||||
@inject(ServiceIdentifiers.IOptions) options: IOptions
|
||||
) {
|
||||
super(identifierNameGeneratorFactory, randomGenerator, options);
|
||||
super(identifierNamesGeneratorFactory, randomGenerator, options);
|
||||
|
||||
this.escapeSequenceEncoder = escapeSequenceEncoder;
|
||||
}
|
||||
@@ -82,8 +82,8 @@ export class StringArrayRotateFunctionNode extends AbstractCustomNode {
|
||||
* @returns {string}
|
||||
*/
|
||||
protected getTemplate (): string {
|
||||
const timesName: string = this.identifierNameGenerator.generate(6);
|
||||
const whileFunctionName: string = this.identifierNameGenerator.generate(6);
|
||||
const timesName: string = this.identifierNamesGenerator.generate(6);
|
||||
const whileFunctionName: string = this.identifierNamesGenerator.generate(6);
|
||||
|
||||
let code: string = '';
|
||||
|
||||
@@ -106,7 +106,7 @@ export class StringArrayRotateFunctionNode extends AbstractCustomNode {
|
||||
}),
|
||||
{
|
||||
...NO_CUSTOM_NODES_PRESET,
|
||||
mangle: this.options.mangle,
|
||||
identifierNamesGenerator: this.options.identifierNamesGenerator,
|
||||
seed: this.options.seed
|
||||
}
|
||||
).getObfuscatedCode();
|
||||
|
||||
@@ -2,7 +2,7 @@ import { inject, injectable, } from 'inversify';
|
||||
import { ServiceIdentifiers } from '../../../container/ServiceIdentifiers';
|
||||
|
||||
import { TCustomNodeFactory } from '../../../types/container/custom-nodes/TCustomNodeFactory';
|
||||
import { TIdentifierNameGeneratorFactory } from '../../../types/container/generators/TIdentifierNameGeneratorFactory';
|
||||
import { TIdentifierNamesGeneratorFactory } from '../../../types/container/generators/TIdentifierNamesGeneratorFactory';
|
||||
import { TNodeWithBlockStatement } from '../../../types/node/TNodeWithBlockStatement';
|
||||
|
||||
import { ICustomNode } from '../../../interfaces/custom-nodes/ICustomNode';
|
||||
@@ -46,19 +46,19 @@ export class StringArrayCustomNodeGroup extends AbstractCustomNodeGroup {
|
||||
/**
|
||||
* @param {TCustomNodeFactory} customNodeFactory
|
||||
* @param {IStorage<string>} stringArrayStorage
|
||||
* @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory
|
||||
* @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
|
||||
* @param {IRandomGenerator} randomGenerator
|
||||
* @param {IOptions} options
|
||||
*/
|
||||
constructor (
|
||||
@inject(ServiceIdentifiers.Factory__ICustomNode) customNodeFactory: TCustomNodeFactory,
|
||||
@inject(ServiceIdentifiers.TStringArrayStorage) stringArrayStorage: IStorage<string>,
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator)
|
||||
identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
|
||||
identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
|
||||
@inject(ServiceIdentifiers.IOptions) options: IOptions
|
||||
) {
|
||||
super(identifierNameGeneratorFactory, randomGenerator, options);
|
||||
super(identifierNamesGeneratorFactory, randomGenerator, options);
|
||||
|
||||
this.customNodeFactory = customNodeFactory;
|
||||
this.stringArrayStorage = stringArrayStorage;
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
export enum IdentifierNameGenerator {
|
||||
HexadecimalIdentifierNameGenerator,
|
||||
MangledIdentifierNameGenerator
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
export enum IdentifierNamesGenerator {
|
||||
HexadecimalIdentifierNamesGenerator = 'hexadecimal',
|
||||
MangledIdentifierNamesGenerator = 'mangled'
|
||||
}
|
||||
+2
-2
@@ -1,12 +1,12 @@
|
||||
import { inject, injectable } from 'inversify';
|
||||
import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
|
||||
|
||||
import { IIdentifierNameGenerator } from '../../interfaces/generators/identifier-name-generators/IIdentifierNameGenerator';
|
||||
import { IIdentifierNamesGenerator } from '../../interfaces/generators/identifier-names-generators/IIdentifierNamesGenerator';
|
||||
import { IOptions } from '../../interfaces/options/IOptions';
|
||||
import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
|
||||
|
||||
@injectable()
|
||||
export abstract class AbstractIdentifierNameGenerator implements IIdentifierNameGenerator {
|
||||
export abstract class AbstractIdentifierNamesGenerator implements IIdentifierNamesGenerator {
|
||||
/**
|
||||
* @type {IOptions}
|
||||
*/
|
||||
+2
-2
@@ -4,11 +4,11 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
|
||||
import { IOptions } from '../../interfaces/options/IOptions';
|
||||
import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
|
||||
|
||||
import { AbstractIdentifierNameGenerator } from './AbstractIdentifierNameGenerator';
|
||||
import { AbstractIdentifierNamesGenerator } from './AbstractIdentifierNamesGenerator';
|
||||
import { Utils } from '../../utils/Utils';
|
||||
|
||||
@injectable()
|
||||
export class HexadecimalIdentifierNameGenerator extends AbstractIdentifierNameGenerator {
|
||||
export class HexadecimalIdentifierNamesGenerator extends AbstractIdentifierNamesGenerator {
|
||||
/**
|
||||
* @type {Set<string>}
|
||||
*/
|
||||
+8
-8
@@ -4,10 +4,10 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
|
||||
import { IOptions } from '../../interfaces/options/IOptions';
|
||||
import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
|
||||
|
||||
import { AbstractIdentifierNameGenerator } from './AbstractIdentifierNameGenerator';
|
||||
import { AbstractIdentifierNamesGenerator } from './AbstractIdentifierNamesGenerator';
|
||||
|
||||
@injectable()
|
||||
export class MangledIdentifierNameGenerator extends AbstractIdentifierNameGenerator {
|
||||
export class MangledIdentifierNamesGenerator extends AbstractIdentifierNamesGenerator {
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
@@ -32,7 +32,7 @@ export class MangledIdentifierNameGenerator extends AbstractIdentifierNameGenera
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
private previousMangledName: string = MangledIdentifierNameGenerator.initMangledNameCharacter;
|
||||
private previousMangledName: string = MangledIdentifierNamesGenerator.initMangledNameCharacter;
|
||||
|
||||
/**
|
||||
* @param {IRandomGenerator} randomGenerator
|
||||
@@ -51,7 +51,7 @@ export class MangledIdentifierNameGenerator extends AbstractIdentifierNameGenera
|
||||
*/
|
||||
private static generateNewMangledName (previousMangledName: string): string {
|
||||
const generateNewMangledName: (name: string) => string = (name: string): string => {
|
||||
const nameSequence: string[] = MangledIdentifierNameGenerator.nameSequence;
|
||||
const nameSequence: string[] = MangledIdentifierNamesGenerator.nameSequence;
|
||||
const zeroSequenceCache: string[] = [];
|
||||
|
||||
const zeroSequence: (num: number) => string = (num: number): string => {
|
||||
@@ -87,8 +87,8 @@ export class MangledIdentifierNameGenerator extends AbstractIdentifierNameGenera
|
||||
|
||||
let newMangledName: string = generateNewMangledName(previousMangledName);
|
||||
|
||||
if (!MangledIdentifierNameGenerator.validateMangledName(newMangledName)) {
|
||||
newMangledName = MangledIdentifierNameGenerator.generateNewMangledName(newMangledName);
|
||||
if (!MangledIdentifierNamesGenerator.validateMangledName(newMangledName)) {
|
||||
newMangledName = MangledIdentifierNamesGenerator.generateNewMangledName(newMangledName);
|
||||
}
|
||||
|
||||
return newMangledName;
|
||||
@@ -99,7 +99,7 @@ export class MangledIdentifierNameGenerator extends AbstractIdentifierNameGenera
|
||||
* @returns {boolean}
|
||||
*/
|
||||
private static validateMangledName (mangledName: string): boolean {
|
||||
return !MangledIdentifierNameGenerator.reservedNames.includes(mangledName);
|
||||
return !MangledIdentifierNamesGenerator.reservedNames.includes(mangledName);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -107,7 +107,7 @@ export class MangledIdentifierNameGenerator extends AbstractIdentifierNameGenera
|
||||
* @returns {string}
|
||||
*/
|
||||
public generate (length: number): string {
|
||||
const newName: string = MangledIdentifierNameGenerator.generateNewMangledName(this.previousMangledName);
|
||||
const newName: string = MangledIdentifierNamesGenerator.generateNewMangledName(this.previousMangledName);
|
||||
|
||||
this.previousMangledName = newName;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
export interface IIdentifierNameGenerator {
|
||||
export interface IIdentifierNamesGenerator {
|
||||
/**
|
||||
* @param {number} length
|
||||
* @returns {string}
|
||||
Vendored
+2
-1
@@ -1,5 +1,6 @@
|
||||
import { TStringArrayEncoding } from '../../types/options/TStringArrayEncoding';
|
||||
|
||||
import { IdentifierNamesGenerator } from '../../enums/generators/identifier-names-generators/IdentifierNamesGenerator';
|
||||
import { ObfuscationTarget } from '../../enums/ObfuscationTarget';
|
||||
import { SourceMapMode } from '../../enums/source-map/SourceMapMode';
|
||||
|
||||
@@ -13,8 +14,8 @@ export interface IOptions {
|
||||
readonly debugProtectionInterval: boolean;
|
||||
readonly disableConsoleOutput: boolean;
|
||||
readonly domainLock: string[];
|
||||
readonly identifierNamesGenerator: IdentifierNamesGenerator;
|
||||
readonly log: boolean;
|
||||
readonly mangle: boolean;
|
||||
readonly renameGlobals: boolean;
|
||||
readonly reservedNames: string[];
|
||||
readonly rotateStringArray: boolean;
|
||||
|
||||
+9
-9
@@ -3,9 +3,9 @@ import { ServiceIdentifiers } from '../../../../container/ServiceIdentifiers';
|
||||
|
||||
import * as ESTree from 'estree';
|
||||
|
||||
import { TIdentifierNameGeneratorFactory } from '../../../../types/container/generators/TIdentifierNameGeneratorFactory';
|
||||
import { TIdentifierNamesGeneratorFactory } from '../../../../types/container/generators/TIdentifierNamesGeneratorFactory';
|
||||
|
||||
import { IIdentifierNameGenerator } from '../../../../interfaces/generators/identifier-name-generators/IIdentifierNameGenerator';
|
||||
import { IIdentifierNamesGenerator } from '../../../../interfaces/generators/identifier-names-generators/IIdentifierNamesGenerator';
|
||||
import { IIdentifierObfuscatingReplacer } from '../../../../interfaces/node-transformers/obfuscating-transformers/obfuscating-replacers/IIdentifierObfuscatingReplacer';
|
||||
import { IOptions } from '../../../../interfaces/options/IOptions';
|
||||
|
||||
@@ -15,9 +15,9 @@ import { Nodes } from '../../../../node/Nodes';
|
||||
@injectable()
|
||||
export class BaseIdentifierObfuscatingReplacer extends AbstractObfuscatingReplacer implements IIdentifierObfuscatingReplacer {
|
||||
/**
|
||||
* @type {IIdentifierNameGenerator}
|
||||
* @type {IIdentifierNamesGenerator}
|
||||
*/
|
||||
private readonly identifierNameGenerator: IIdentifierNameGenerator;
|
||||
private readonly identifierNamesGenerator: IIdentifierNamesGenerator;
|
||||
|
||||
/**
|
||||
* @type {Map<string, string>}
|
||||
@@ -25,17 +25,17 @@ export class BaseIdentifierObfuscatingReplacer extends AbstractObfuscatingReplac
|
||||
private readonly namesMap: Map<string, string> = new Map();
|
||||
|
||||
/**
|
||||
* @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory
|
||||
* @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
|
||||
* @param {IOptions} options
|
||||
*/
|
||||
constructor (
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator)
|
||||
identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
|
||||
identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.IOptions) options: IOptions
|
||||
) {
|
||||
super(options);
|
||||
|
||||
this.identifierNameGenerator = identifierNameGeneratorFactory(options);
|
||||
this.identifierNamesGenerator = identifierNamesGeneratorFactory(options);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -65,7 +65,7 @@ export class BaseIdentifierObfuscatingReplacer extends AbstractObfuscatingReplac
|
||||
return;
|
||||
}
|
||||
|
||||
this.namesMap.set(`${nodeName}-${String(nodeIdentifier)}`, this.identifierNameGenerator.generate(6));
|
||||
this.namesMap.set(`${nodeName}-${String(nodeIdentifier)}`, this.identifierNamesGenerator.generate(6));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,6 +21,7 @@ import { TStringArrayEncoding } from '../types/options/TStringArrayEncoding';
|
||||
|
||||
import { IOptions } from '../interfaces/options/IOptions';
|
||||
|
||||
import { IdentifierNamesGenerator } from '../enums/generators/identifier-names-generators/IdentifierNamesGenerator';
|
||||
import { ObfuscationTarget } from '../enums/ObfuscationTarget';
|
||||
import { SourceMapMode } from '../enums/source-map/SourceMapMode';
|
||||
import { StringArrayEncoding } from '../enums/StringArrayEncoding';
|
||||
@@ -102,16 +103,19 @@ export class Options implements IOptions {
|
||||
public readonly domainLock: string[];
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
* @type {IdentifierNamesGenerator}
|
||||
*/
|
||||
@IsBoolean()
|
||||
public readonly log: boolean;
|
||||
@IsIn([
|
||||
IdentifierNamesGenerator.HexadecimalIdentifierNamesGenerator,
|
||||
IdentifierNamesGenerator.MangledIdentifierNamesGenerator
|
||||
])
|
||||
public readonly identifierNamesGenerator: IdentifierNamesGenerator;
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
@IsBoolean()
|
||||
public readonly mangle: boolean;
|
||||
public readonly log: boolean;
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { TInputOptions } from '../../types/options/TInputOptions';
|
||||
|
||||
import { IdentifierNamesGenerator } from '../../enums/generators/identifier-names-generators/IdentifierNamesGenerator';
|
||||
import { ObfuscationTarget } from '../../enums/ObfuscationTarget';
|
||||
import { SourceMapMode } from '../../enums/source-map/SourceMapMode';
|
||||
|
||||
@@ -14,8 +15,8 @@ export const DEFAULT_PRESET: TInputOptions = Object.freeze({
|
||||
debugProtectionInterval: false,
|
||||
disableConsoleOutput: false,
|
||||
domainLock: [],
|
||||
identifierNamesGenerator: IdentifierNamesGenerator.HexadecimalIdentifierNamesGenerator,
|
||||
log: false,
|
||||
mangle: false,
|
||||
renameGlobals: false,
|
||||
reservedNames: [],
|
||||
rotateStringArray: true,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { TInputOptions } from '../../types/options/TInputOptions';
|
||||
|
||||
import { IdentifierNamesGenerator } from '../../enums/generators/identifier-names-generators/IdentifierNamesGenerator';
|
||||
import { ObfuscationTarget } from '../../enums/ObfuscationTarget';
|
||||
import { SourceMapMode } from '../../enums/source-map/SourceMapMode';
|
||||
|
||||
@@ -13,8 +14,8 @@ export const NO_CUSTOM_NODES_PRESET: TInputOptions = Object.freeze({
|
||||
debugProtectionInterval: false,
|
||||
disableConsoleOutput: false,
|
||||
domainLock: [],
|
||||
identifierNamesGenerator: IdentifierNamesGenerator.HexadecimalIdentifierNamesGenerator,
|
||||
log: false,
|
||||
mangle: false,
|
||||
renameGlobals: false,
|
||||
reservedNames: [],
|
||||
rotateStringArray: false,
|
||||
|
||||
@@ -4,8 +4,8 @@ import { ServiceIdentifiers } from '../../container/ServiceIdentifiers';
|
||||
import { IArrayUtils } from '../../interfaces/utils/IArrayUtils';
|
||||
import { IRandomGenerator } from '../../interfaces/utils/IRandomGenerator';
|
||||
|
||||
import { TIdentifierNameGeneratorFactory } from '../../types/container/generators/TIdentifierNameGeneratorFactory';
|
||||
import { IIdentifierNameGenerator } from '../../interfaces/generators/identifier-name-generators/IIdentifierNameGenerator';
|
||||
import { TIdentifierNamesGeneratorFactory } from '../../types/container/generators/TIdentifierNamesGeneratorFactory';
|
||||
import { IIdentifierNamesGenerator } from '../../interfaces/generators/identifier-names-generators/IIdentifierNamesGenerator';
|
||||
import { IOptions } from '../../interfaces/options/IOptions';
|
||||
|
||||
import { ArrayStorage } from '../ArrayStorage';
|
||||
@@ -18,26 +18,26 @@ export class StringArrayStorage extends ArrayStorage <string> {
|
||||
private readonly arrayUtils: IArrayUtils;
|
||||
|
||||
/**
|
||||
* @type {IIdentifierNameGenerator}
|
||||
* @type {IIdentifierNamesGenerator}
|
||||
*/
|
||||
private readonly identifierNameGenerator: IIdentifierNameGenerator;
|
||||
private readonly identifierNamesGenerator: IIdentifierNamesGenerator;
|
||||
|
||||
/**
|
||||
* @param {TIdentifierNameGeneratorFactory} identifierNameGeneratorFactory
|
||||
* @param {TIdentifierNamesGeneratorFactory} identifierNamesGeneratorFactory
|
||||
* @param {IArrayUtils} arrayUtils
|
||||
* @param {IRandomGenerator} randomGenerator
|
||||
* @param {IOptions} options
|
||||
*/
|
||||
constructor (
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNameGenerator)
|
||||
identifierNameGeneratorFactory: TIdentifierNameGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.Factory__IIdentifierNamesGenerator)
|
||||
identifierNamesGeneratorFactory: TIdentifierNamesGeneratorFactory,
|
||||
@inject(ServiceIdentifiers.IArrayUtils) arrayUtils: IArrayUtils,
|
||||
@inject(ServiceIdentifiers.IRandomGenerator) randomGenerator: IRandomGenerator,
|
||||
@inject(ServiceIdentifiers.IOptions) options: IOptions
|
||||
) {
|
||||
super(randomGenerator, options);
|
||||
|
||||
this.identifierNameGenerator = identifierNameGeneratorFactory(options);
|
||||
this.identifierNamesGenerator = identifierNamesGeneratorFactory(options);
|
||||
this.arrayUtils = arrayUtils;
|
||||
}
|
||||
|
||||
@@ -45,8 +45,8 @@ export class StringArrayStorage extends ArrayStorage <string> {
|
||||
public initialize (): void {
|
||||
super.initialize();
|
||||
|
||||
const stringArrayName: string = this.identifierNameGenerator.generate(4);
|
||||
const stringArrayCallsWrapperName: string = this.identifierNameGenerator.generate(4);
|
||||
const stringArrayName: string = this.identifierNamesGenerator.generate(4);
|
||||
const stringArrayCallsWrapperName: string = this.identifierNamesGenerator.generate(4);
|
||||
|
||||
this.storageId = `${stringArrayName}|${stringArrayCallsWrapperName}`;
|
||||
}
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
import { IIdentifierNameGenerator } from '../../../interfaces/generators/identifier-name-generators/IIdentifierNameGenerator';
|
||||
import { IOptions } from '../../../interfaces/options/IOptions';
|
||||
|
||||
export type TIdentifierNameGeneratorFactory = (options: IOptions) => IIdentifierNameGenerator;
|
||||
@@ -0,0 +1,4 @@
|
||||
import { IIdentifierNamesGenerator } from '../../../interfaces/generators/identifier-names-generators/IIdentifierNamesGenerator';
|
||||
import { IOptions } from '../../../interfaces/options/IOptions';
|
||||
|
||||
export type TIdentifierNamesGeneratorFactory = (options: IOptions) => IIdentifierNamesGenerator;
|
||||
Reference in New Issue
Block a user