|
@@ -2,6 +2,7 @@ import { assert } from 'chai';
|
|
|
|
|
|
import { IdentifierNamesGenerator } from '../../../../../src/enums/generators/identifier-names-generators/IdentifierNamesGenerator';
|
|
|
import { StringArrayEncoding } from '../../../../../src/enums/node-transformers/string-array-transformers/StringArrayEncoding';
|
|
|
+import { StringArrayIndexesType } from '../../../../../src/enums/node-transformers/string-array-transformers/StringArrayIndexesType';
|
|
|
import { StringArrayWrappersType } from '../../../../../src/enums/node-transformers/string-array-transformers/StringArrayWrappersType';
|
|
|
|
|
|
import { NO_ADDITIONAL_NODES_PRESET } from '../../../../../src/options/presets/NoCustomNodes';
|
|
@@ -17,7 +18,7 @@ describe('StringArrayTransformer', function () {
|
|
|
|
|
|
describe('Variant #1: default behaviour', () => {
|
|
|
const stringArrayRegExp: RegExp = /^var _0x([a-f0-9]){4} *= *\['test'\];/;
|
|
|
- const stringArrayCallRegExp: RegExp = /var test *= *_0x([a-f0-9]){4}\('0x0'\);/;
|
|
|
+ const stringArrayCallRegExp: RegExp = /var test *= *_0x([a-f0-9]){4}\(0x0\);/;
|
|
|
|
|
|
let obfuscatedCode: string;
|
|
|
|
|
@@ -64,11 +65,118 @@ describe('StringArrayTransformer', function () {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- describe('Variant #3: `stringArrayIndexShift` option is enabled', () => {
|
|
|
+ describe('Variant #3: `stringArrayIndexesType` option', () => {
|
|
|
+ describe('Variant #1: `hexadecimal-number` type', () => {
|
|
|
+ const stringArrayCallRegExp: RegExp = /var test *= *_0x([a-f0-9]){4}\(0x0\);/;
|
|
|
+
|
|
|
+ let obfuscatedCode: string;
|
|
|
+
|
|
|
+ before(() => {
|
|
|
+ const code: string = readFileAsString(__dirname + '/fixtures/simple-input.js');
|
|
|
+
|
|
|
+ obfuscatedCode = JavaScriptObfuscator.obfuscate(
|
|
|
+ code,
|
|
|
+ {
|
|
|
+ ...NO_ADDITIONAL_NODES_PRESET,
|
|
|
+ stringArray: true,
|
|
|
+ stringArrayThreshold: 1,
|
|
|
+ stringArrayIndexesType: [
|
|
|
+ StringArrayIndexesType.HexadecimalNumber
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ ).getObfuscatedCode();
|
|
|
+ });
|
|
|
+
|
|
|
+ it('match #1: should transform string array index with the passed index type', () => {
|
|
|
+ assert.match(obfuscatedCode, stringArrayCallRegExp);
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ describe('Variant #2: `hexadecimal-numeric-string` type', () => {
|
|
|
+ const stringArrayCallRegExp: RegExp = /var test *= *_0x([a-f0-9]){4}\('0x0'\);/;
|
|
|
+
|
|
|
+ let obfuscatedCode: string;
|
|
|
+
|
|
|
+ before(() => {
|
|
|
+ const code: string = readFileAsString(__dirname + '/fixtures/simple-input.js');
|
|
|
+
|
|
|
+ obfuscatedCode = JavaScriptObfuscator.obfuscate(
|
|
|
+ code,
|
|
|
+ {
|
|
|
+ ...NO_ADDITIONAL_NODES_PRESET,
|
|
|
+ stringArray: true,
|
|
|
+ stringArrayThreshold: 1,
|
|
|
+ stringArrayIndexesType: [
|
|
|
+ StringArrayIndexesType.HexadecimalNumericString
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ ).getObfuscatedCode();
|
|
|
+ });
|
|
|
+
|
|
|
+ it('match #1: should transform string array index with the passed index type', () => {
|
|
|
+ assert.match(obfuscatedCode, stringArrayCallRegExp);
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ describe('Variant #3: multiple types', () => {
|
|
|
+ const samplesCount: number = 500;
|
|
|
+ const expectedMatchesChance: number = 0.5;
|
|
|
+ const expectedMatchesDelta: number = 0.15;
|
|
|
+
|
|
|
+ const hexadecimalNumberIndexTypeRegExp: RegExp = /var test *= *_0x([a-f0-9]){4}\(0x0\);/;
|
|
|
+ const hexadecimalNumericStringIndexTypeRegExp: RegExp = /var test *= *_0x([a-f0-9]){4}\('0x0'\);/;
|
|
|
+
|
|
|
+ let hexadecimalNumberIndexTypeMatchesCount: number = 0;
|
|
|
+ let hexadecimalNumericStringIndexTypeMatchesCount: number = 0;
|
|
|
+
|
|
|
+ let hexadecimalNumberIndexTypeMatchesChance: number = 0;
|
|
|
+ let hexadecimalNumericStringIndexTypeMatchesChance: number = 0;
|
|
|
+
|
|
|
+ before(() => {
|
|
|
+ const code: string = readFileAsString(__dirname + '/fixtures/simple-input.js');
|
|
|
+
|
|
|
+ for (let i = 0; i < samplesCount; i++) {
|
|
|
+ const obfuscatedCode = JavaScriptObfuscator.obfuscate(
|
|
|
+ code,
|
|
|
+ {
|
|
|
+ ...NO_ADDITIONAL_NODES_PRESET,
|
|
|
+ stringArray: true,
|
|
|
+ stringArrayThreshold: 1,
|
|
|
+ stringArrayIndexesType: [
|
|
|
+ StringArrayIndexesType.HexadecimalNumber,
|
|
|
+ StringArrayIndexesType.HexadecimalNumericString
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ ).getObfuscatedCode();
|
|
|
+
|
|
|
+ if (obfuscatedCode.match(hexadecimalNumberIndexTypeRegExp)) {
|
|
|
+ hexadecimalNumberIndexTypeMatchesCount += 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (obfuscatedCode.match(hexadecimalNumericStringIndexTypeRegExp)) {
|
|
|
+ hexadecimalNumericStringIndexTypeMatchesCount += 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ hexadecimalNumberIndexTypeMatchesChance = hexadecimalNumberIndexTypeMatchesCount / samplesCount;
|
|
|
+ hexadecimalNumericStringIndexTypeMatchesChance = hexadecimalNumericStringIndexTypeMatchesCount / samplesCount;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should transform string array indexes with a `hexadecimal-number` type', () => {
|
|
|
+ assert.closeTo(hexadecimalNumberIndexTypeMatchesChance, expectedMatchesChance, expectedMatchesDelta);
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should transform string array indexes with a `hexadecimal-numeric-string` type', () => {
|
|
|
+ assert.closeTo(hexadecimalNumericStringIndexTypeMatchesChance, expectedMatchesChance, expectedMatchesDelta);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ describe('Variant #4: `stringArrayIndexShift` option is enabled', () => {
|
|
|
const stringArrayIndexShiftRegExp: RegExp = /_0x(?:[a-f0-9]){4,6} *= *_0x(?:[a-f0-9]){4,6} *- *(0x[a-z0-9]{1,3});/;
|
|
|
- const stringArrayCallRegExp1: RegExp = /var _0x(?:[a-f0-9]){4,6} *= *_0x(?:[a-f0-9]){4}\('(0x[a-z0-9]{1,3})'\) *\+ *0x1;/;
|
|
|
- const stringArrayCallRegExp2: RegExp = /var _0x(?:[a-f0-9]){4,6} *= *_0x(?:[a-f0-9]){4}\('(0x[a-z0-9]{1,3})'\) *\+ *0x2;/;
|
|
|
- const stringArrayCallRegExp3: RegExp = /var _0x(?:[a-f0-9]){4,6} *= *_0x(?:[a-f0-9]){4}\('(0x[a-z0-9]{1,3})'\) *\+ *0x3;/;
|
|
|
+ const stringArrayCallRegExp1: RegExp = /var _0x(?:[a-f0-9]){4,6} *= *_0x(?:[a-f0-9]){4}\((0x[a-z0-9]{1,3})\) *\+ *0x1;/;
|
|
|
+ const stringArrayCallRegExp2: RegExp = /var _0x(?:[a-f0-9]){4,6} *= *_0x(?:[a-f0-9]){4}\((0x[a-z0-9]{1,3})\) *\+ *0x2;/;
|
|
|
+ const stringArrayCallRegExp3: RegExp = /var _0x(?:[a-f0-9]){4,6} *= *_0x(?:[a-f0-9]){4}\((0x[a-z0-9]{1,3})\) *\+ *0x3;/;
|
|
|
|
|
|
const expectedEvaluationResult: string = 'foo1bar2baz3';
|
|
|
|
|
@@ -258,9 +366,9 @@ describe('StringArrayTransformer', function () {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- describe('Variant #4: same literal node values', () => {
|
|
|
+ describe('Variant #5: same literal node values', () => {
|
|
|
const stringArrayRegExp: RegExp = /^var _0x([a-f0-9]){4} *= *\['test'\];/;
|
|
|
- const stringArrayCallRegExp: RegExp = /var test *= *_0x([a-f0-9]){4}\('0x0'\);/;
|
|
|
+ const stringArrayCallRegExp: RegExp = /var test *= *_0x([a-f0-9]){4}\(0x0\);/;
|
|
|
|
|
|
let obfuscatedCode: string;
|
|
|
|
|
@@ -286,7 +394,7 @@ describe('StringArrayTransformer', function () {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- describe('Variant #5: short literal node value', () => {
|
|
|
+ describe('Variant #6: short literal node value', () => {
|
|
|
const regExp: RegExp = /var test *= *'te';/;
|
|
|
|
|
|
let obfuscatedCode: string;
|
|
@@ -309,9 +417,9 @@ describe('StringArrayTransformer', function () {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- describe('Variant #6: base64 encoding', () => {
|
|
|
+ describe('Variant #7: base64 encoding', () => {
|
|
|
const stringArrayRegExp: RegExp = new RegExp(`^var _0x([a-f0-9]){4} *= *\\['${swapLettersCase('dGVzdA==')}'];`);
|
|
|
- const stringArrayCallRegExp: RegExp = /var test *= *_0x([a-f0-9]){4}\('0x0'\);/;
|
|
|
+ const stringArrayCallRegExp: RegExp = /var test *= *_0x([a-f0-9]){4}\(0x0\);/;
|
|
|
|
|
|
let obfuscatedCode: string;
|
|
|
|
|
@@ -338,9 +446,9 @@ describe('StringArrayTransformer', function () {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- describe('Variant #7: rc4 encoding', () => {
|
|
|
+ describe('Variant #8: rc4 encoding', () => {
|
|
|
describe('Variant #1: single string literal', () => {
|
|
|
- const regExp: RegExp = /var test *= *_0x([a-f0-9]){4}\('0x0', *'.{4}'\);/;
|
|
|
+ const regExp: RegExp = /var test *= *_0x([a-f0-9]){4}\(0x0, *'.{4}'\);/;
|
|
|
|
|
|
let obfuscatedCode: string;
|
|
|
|
|
@@ -364,8 +472,8 @@ describe('StringArrayTransformer', function () {
|
|
|
});
|
|
|
|
|
|
describe('Variant #2: multiple string literals', () => {
|
|
|
- const variableRegExp1: RegExp = /var test *= *_0x(?:[a-f0-9]){4}\('0x0', *'(.{4})'\);/;
|
|
|
- const variableRegExp2: RegExp = /var test *= *_0x(?:[a-f0-9]){4}\('0x1', *'(.{4})'\);/;
|
|
|
+ const variableRegExp1: RegExp = /var test *= *_0x(?:[a-f0-9]){4}\(0x0, *'(.{4})'\);/;
|
|
|
+ const variableRegExp2: RegExp = /var test *= *_0x(?:[a-f0-9]){4}\(0x1, *'(.{4})'\);/;
|
|
|
|
|
|
let encodedLiteralValue1: string;
|
|
|
let encodedLiteralValue2: string;
|
|
@@ -404,7 +512,7 @@ describe('StringArrayTransformer', function () {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- describe('Variant #8: none and base64 encoding', () => {
|
|
|
+ describe('Variant #9: none and base64 encoding', () => {
|
|
|
describe('Variant #1: string array values', () => {
|
|
|
const samplesCount: number = 300;
|
|
|
const expectedMatchesChance: number = 0.5;
|
|
@@ -460,14 +568,14 @@ describe('StringArrayTransformer', function () {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- describe('Variant #9: none and rc4 encoding', () => {
|
|
|
+ describe('Variant #10: none and rc4 encoding', () => {
|
|
|
describe('Variant #1: string array calls wrapper call', () => {
|
|
|
const samplesCount: number = 300;
|
|
|
const expectedMatchesChance: number = 0.5;
|
|
|
const expectedMatchesDelta: number = 0.15;
|
|
|
|
|
|
- const noneEncodingRegExp: RegExp = /var test *= *_0x([a-f0-9]){4}\('0x0'\);/;
|
|
|
- const rc4EncodingRegExp: RegExp = /var test *= *_0x([a-f0-9]){4}\('0x0', *'.{4}'\);/;
|
|
|
+ const noneEncodingRegExp: RegExp = /var test *= *_0x([a-f0-9]){4}\(0x0\);/;
|
|
|
+ const rc4EncodingRegExp: RegExp = /var test *= *_0x([a-f0-9]){4}\(0x0, *'.{4}'\);/;
|
|
|
|
|
|
let noneEncodingMatchesCount: number = 0;
|
|
|
let rc4EncodingMatchesCount: number = 0;
|
|
@@ -516,14 +624,14 @@ describe('StringArrayTransformer', function () {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- describe('Variant #10: base64 and rc4 encoding', () => {
|
|
|
+ describe('Variant #11: base64 and rc4 encoding', () => {
|
|
|
describe('Variant #1: single string literal', () => {
|
|
|
const samplesCount: number = 300;
|
|
|
const expectedMatchesChance: number = 0.5;
|
|
|
const expectedMatchesDelta: number = 0.15;
|
|
|
|
|
|
- const base64EncodingRegExp: RegExp = /var test *= *_0x([a-f0-9]){4}\('0x0'\);/;
|
|
|
- const rc4EncodingRegExp: RegExp = /var test *= *_0x([a-f0-9]){4}\('0x0', *'.{4}'\);/;
|
|
|
+ const base64EncodingRegExp: RegExp = /var test *= *_0x([a-f0-9]){4}\(0x0\);/;
|
|
|
+ const rc4EncodingRegExp: RegExp = /var test *= *_0x([a-f0-9]){4}\(0x0, *'.{4}'\);/;
|
|
|
|
|
|
let base64EncodingMatchesCount: number = 0;
|
|
|
let rc4EncodingMatchesCount: number = 0;
|
|
@@ -572,12 +680,12 @@ describe('StringArrayTransformer', function () {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- describe('Variant #11: `stringArrayThreshold` option value', () => {
|
|
|
+ describe('Variant #12: `stringArrayThreshold` option value', () => {
|
|
|
const samples: number = 1000;
|
|
|
const stringArrayThreshold: number = 0.5;
|
|
|
const delta: number = 0.1;
|
|
|
|
|
|
- const regExp1: RegExp = /var test *= *_0x([a-f0-9]){4}\('0x0'\);/g;
|
|
|
+ const regExp1: RegExp = /var test *= *_0x([a-f0-9]){4}\(0x0\);/g;
|
|
|
const regExp2: RegExp = /var test *= *'test';/g;
|
|
|
|
|
|
let stringArrayProbability: number,
|
|
@@ -615,8 +723,8 @@ describe('StringArrayTransformer', function () {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- describe('Variant #12: string array calls wrapper name', () => {
|
|
|
- const regExp: RegExp = /console\[b\('0x0'\)]\('a'\);/;
|
|
|
+ describe('Variant #13: string array calls wrapper name', () => {
|
|
|
+ const regExp: RegExp = /console\[b\(0x0\)]\('a'\);/;
|
|
|
|
|
|
let obfuscatedCode: string;
|
|
|
|
|
@@ -639,11 +747,11 @@ describe('StringArrayTransformer', function () {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- describe('Variant #13: `reservedStrings` option is enabled', () => {
|
|
|
+ describe('Variant #14: `reservedStrings` option is enabled', () => {
|
|
|
describe('Variant #1: base `reservedStrings` values', () => {
|
|
|
describe('Variant #1: single reserved string value', () => {
|
|
|
const stringLiteralRegExp1: RegExp = /const foo *= *'foo';/;
|
|
|
- const stringLiteralRegExp2: RegExp = /const bar *= *_0x([a-f0-9]){4}\('0x0'\);/;
|
|
|
+ const stringLiteralRegExp2: RegExp = /const bar *= *_0x([a-f0-9]){4}\(0x0\);/;
|
|
|
|
|
|
let obfuscatedCode: string;
|
|
|
|
|
@@ -702,7 +810,7 @@ describe('StringArrayTransformer', function () {
|
|
|
|
|
|
describe('Variant #2: RegExp `reservedStrings` values', () => {
|
|
|
describe('Variant #1: single reserved string value', () => {
|
|
|
- const stringLiteralRegExp1: RegExp = /const foo *= *_0x([a-f0-9]){4}\('0x0'\);/;
|
|
|
+ const stringLiteralRegExp1: RegExp = /const foo *= *_0x([a-f0-9]){4}\(0x0\);/;
|
|
|
const stringLiteralRegExp2: RegExp = /const bar *= *'bar';/;
|
|
|
|
|
|
let obfuscatedCode: string;
|
|
@@ -761,11 +869,11 @@ describe('StringArrayTransformer', function () {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- describe('Variant #14: `forceTransformStrings` option is enabled', () => {
|
|
|
+ describe('Variant #15: `forceTransformStrings` option is enabled', () => {
|
|
|
describe('Variant #1: base `forceTransformStrings` values', () => {
|
|
|
describe('Variant #1: single force transform string value', () => {
|
|
|
const stringLiteralRegExp1: RegExp = /const foo *= *'foo';/;
|
|
|
- const stringLiteralRegExp2: RegExp = /const bar *= *_0x([a-f0-9]){4}\('0x0'\);/;
|
|
|
+ const stringLiteralRegExp2: RegExp = /const bar *= *_0x([a-f0-9]){4}\(0x0\);/;
|
|
|
|
|
|
let obfuscatedCode: string;
|
|
|
|
|
@@ -793,8 +901,8 @@ describe('StringArrayTransformer', function () {
|
|
|
});
|
|
|
|
|
|
describe('Variant #2: two force transform string values', () => {
|
|
|
- const stringLiteralRegExp1: RegExp = /const foo *= *_0x([a-f0-9]){4}\('0x0'\);/;
|
|
|
- const stringLiteralRegExp2: RegExp = /const bar *= *_0x([a-f0-9]){4}\('0x1'\);/;
|
|
|
+ const stringLiteralRegExp1: RegExp = /const foo *= *_0x([a-f0-9]){4}\(0x0\);/;
|
|
|
+ const stringLiteralRegExp2: RegExp = /const bar *= *_0x([a-f0-9]){4}\(0x1\);/;
|
|
|
|
|
|
let obfuscatedCode: string;
|
|
|
|
|
@@ -825,7 +933,7 @@ describe('StringArrayTransformer', function () {
|
|
|
describe('Variant #2: RegExp `forceTransformStrings` values', () => {
|
|
|
describe('Variant #1: single force transform string value', () => {
|
|
|
const stringLiteralRegExp1: RegExp = /const foo *= *'foo'/;
|
|
|
- const stringLiteralRegExp2: RegExp = /const bar *= *_0x([a-f0-9]){4}\('0x0'\);/;
|
|
|
+ const stringLiteralRegExp2: RegExp = /const bar *= *_0x([a-f0-9]){4}\(0x0\);/;
|
|
|
|
|
|
let obfuscatedCode: string;
|
|
|
|
|
@@ -853,8 +961,8 @@ describe('StringArrayTransformer', function () {
|
|
|
});
|
|
|
|
|
|
describe('Variant #2: two force transform string values', () => {
|
|
|
- const stringLiteralRegExp1: RegExp = /const foo *= *_0x([a-f0-9]){4}\('0x0'\);/;
|
|
|
- const stringLiteralRegExp2: RegExp = /const bar *= *_0x([a-f0-9]){4}\('0x1'\);/;
|
|
|
+ const stringLiteralRegExp1: RegExp = /const foo *= *_0x([a-f0-9]){4}\(0x0\);/;
|
|
|
+ const stringLiteralRegExp2: RegExp = /const bar *= *_0x([a-f0-9]){4}\(0x1\);/;
|
|
|
|
|
|
let obfuscatedCode: string;
|
|
|
|
|
@@ -916,7 +1024,7 @@ describe('StringArrayTransformer', function () {
|
|
|
describe('Variant #4: Priority over `reservedStrings` option', () => {
|
|
|
describe('Variant #1: base case', () => {
|
|
|
const stringLiteralRegExp1: RegExp = /const foo *= *'foo';/;
|
|
|
- const stringLiteralRegExp2: RegExp = /const bar *= *_0x([a-f0-9]){4}\('0x0'\);/;
|
|
|
+ const stringLiteralRegExp2: RegExp = /const bar *= *_0x([a-f0-9]){4}\(0x0\);/;
|
|
|
|
|
|
let obfuscatedCode: string;
|
|
|
|
|
@@ -949,7 +1057,7 @@ describe('StringArrayTransformer', function () {
|
|
|
describe('Variant #1: base case', () => {
|
|
|
const stringLiteralRegExp1: RegExp = /const foo *= *'foo';/;
|
|
|
const stringLiteralRegExp2: RegExp = /const bar *= *'bar';/;
|
|
|
- const stringLiteralRegExp3: RegExp = /const baz *= *_0x([a-f0-9]){4}\('0x0'\);/;
|
|
|
+ const stringLiteralRegExp3: RegExp = /const baz *= *_0x([a-f0-9]){4}\(0x0\);/;
|
|
|
|
|
|
let obfuscatedCode: string;
|
|
|
|
|
@@ -982,10 +1090,10 @@ describe('StringArrayTransformer', function () {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- describe('Variant #15: object expression key literal', () => {
|
|
|
+ describe('Variant #16: object expression key literal', () => {
|
|
|
describe('Variant #1: base key literal', () => {
|
|
|
const stringArrayRegExp: RegExp = /^var _0x([a-f0-9]){4} *= *\['bar'];/;
|
|
|
- const objectExpressionRegExp: RegExp = /var test *= *{'foo' *: *_0x([a-f0-9]){4}\('0x0'\)};/;
|
|
|
+ const objectExpressionRegExp: RegExp = /var test *= *{'foo' *: *_0x([a-f0-9]){4}\(0x0\)};/;
|
|
|
|
|
|
let obfuscatedCode: string;
|
|
|
|
|
@@ -1013,7 +1121,7 @@ describe('StringArrayTransformer', function () {
|
|
|
|
|
|
describe('Variant #2: computed key literal', () => {
|
|
|
const stringArrayRegExp: RegExp = /^var _0x([a-f0-9]){4} *= *\['foo', *'bar'];/;
|
|
|
- const objectExpressionRegExp: RegExp = /var test *= *{\[_0x([a-f0-9]){4}\('0x0'\)] *: *_0x([a-f0-9]){4}\('0x1'\)};/;
|
|
|
+ const objectExpressionRegExp: RegExp = /var test *= *{\[_0x([a-f0-9]){4}\(0x0\)] *: *_0x([a-f0-9]){4}\(0x1\)};/;
|
|
|
|
|
|
let obfuscatedCode: string;
|
|
|
|
|
@@ -1040,7 +1148,7 @@ describe('StringArrayTransformer', function () {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- describe('Variant #16: import declaration source literal', () => {
|
|
|
+ describe('Variant #17: import declaration source literal', () => {
|
|
|
const importDeclarationRegExp: RegExp = /import *{ *bar *} *from *'foo';/;
|
|
|
|
|
|
let obfuscatedCode: string;
|
|
@@ -1063,7 +1171,7 @@ describe('StringArrayTransformer', function () {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- describe('Variant #17: export all declaration source literal', () => {
|
|
|
+ describe('Variant #18: export all declaration source literal', () => {
|
|
|
const exportAllDeclarationRegExp: RegExp = /export *\* *from *'foo';/;
|
|
|
|
|
|
let obfuscatedCode: string;
|
|
@@ -1086,7 +1194,7 @@ describe('StringArrayTransformer', function () {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- describe('Variant #18: export named declaration source literal', () => {
|
|
|
+ describe('Variant #19: export named declaration source literal', () => {
|
|
|
const exportNamedDeclarationRegExp: RegExp = /export *{ *bar *} *from *'foo';/;
|
|
|
|
|
|
let obfuscatedCode: string;
|