javascript-obfuscator 3.1.0 → 3.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/README.md +90 -6
- package/dist/index.browser.js +1 -1
- package/dist/index.browser.js.LICENSE.txt +1 -1
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cli.js +1 -1
- package/dist/index.cli.js.LICENSE.txt +1 -1
- package/dist/index.cli.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.LICENSE.txt +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +13 -12
- package/typings/src/constants/ReservedIdentifierNames.d.ts +1 -0
- package/typings/src/container/ServiceIdentifiers.d.ts +2 -1
- package/typings/src/custom-nodes/control-flow-flattening-nodes/{StringLiteralNode.d.ts → LiteralNode.d.ts} +4 -3
- package/typings/src/custom-nodes/control-flow-flattening-nodes/control-flow-storage-nodes/ControlFlowStorageNode.d.ts +2 -2
- package/typings/src/enums/custom-nodes/ControlFlowCustomNode.d.ts +2 -2
- package/typings/src/enums/node-transformers/NodeTransformer.d.ts +1 -0
- package/typings/src/enums/node-transformers/control-flow-transformers/control-flow-replacers/ControlFlowReplacer.d.ts +1 -0
- package/typings/src/enums/storages/ControlFlowStorage.d.ts +4 -0
- package/typings/src/generators/identifier-names-generators/AbstractIdentifierNamesGenerator.d.ts +3 -2
- package/typings/src/generators/identifier-names-generators/DictionaryIdentifierNamesGenerator.d.ts +1 -0
- package/typings/src/generators/identifier-names-generators/HexadecimalIdentifierNamesGenerator.d.ts +1 -0
- package/typings/src/generators/identifier-names-generators/MangledIdentifierNamesGenerator.d.ts +9 -2
- package/typings/src/generators/identifier-names-generators/MangledShuffledIdentifierNamesGenerator.d.ts +2 -2
- package/typings/src/interfaces/generators/identifier-names-generators/IIdentifierNamesGenerator.d.ts +1 -0
- package/typings/src/interfaces/node-transformers/control-flow-transformers/IControlFlowReplacer.d.ts +3 -2
- package/typings/src/interfaces/node-transformers/simplifying-transformers/IIteratedStatementsSimplifyData.d.ts +1 -0
- package/typings/src/interfaces/options/IOptions.d.ts +2 -0
- package/typings/src/interfaces/storages/IWeakMapStorage.d.ts +9 -0
- package/typings/src/interfaces/storages/control-flow-transformers/IControlFlowStorage.d.ts +4 -0
- package/typings/src/interfaces/storages/string-array-transformers/IStringArrayScopeCallsWrappersDataStorage.d.ts +2 -2
- package/typings/src/interfaces/utils/ISetUtils.d.ts +3 -0
- package/typings/src/node/NodeGuards.d.ts +1 -1
- package/typings/src/node/NodeLiteralUtils.d.ts +2 -0
- package/typings/src/node-transformers/control-flow-transformers/FunctionControlFlowTransformer.d.ts +22 -13
- package/typings/src/node-transformers/control-flow-transformers/StringArrayControlFlowTransformer.d.ts +26 -0
- package/typings/src/node-transformers/control-flow-transformers/control-flow-replacers/AbstractControlFlowReplacer.d.ts +8 -5
- package/typings/src/node-transformers/control-flow-transformers/control-flow-replacers/BinaryExpressionControlFlowReplacer.d.ts +4 -3
- package/typings/src/node-transformers/control-flow-transformers/control-flow-replacers/CallExpressionControlFlowReplacer.d.ts +4 -3
- package/typings/src/node-transformers/control-flow-transformers/control-flow-replacers/ExpressionWithOperatorControlFlowReplacer.d.ts +2 -1
- package/typings/src/node-transformers/control-flow-transformers/control-flow-replacers/LogicalExpressionControlFlowReplacer.d.ts +4 -3
- package/typings/src/node-transformers/control-flow-transformers/control-flow-replacers/StringArrayCallControlFlowReplacer.d.ts +14 -0
- package/typings/src/node-transformers/control-flow-transformers/control-flow-replacers/StringLiteralControlFlowReplacer.d.ts +5 -4
- package/typings/src/node-transformers/dead-code-injection-transformers/DeadCodeInjectionTransformer.d.ts +0 -2
- package/typings/src/options/Options.d.ts +2 -0
- package/typings/src/options/normalizer-rules/StringArrayCallsTransformThresholdRule.d.ts +2 -0
- package/typings/src/storages/WeakMapStorage.d.ts +17 -0
- package/typings/src/storages/control-flow-transformers/FunctionControlFlowStorage.d.ts +11 -0
- package/typings/src/storages/control-flow-transformers/StringControlFlowStorage.d.ts +8 -0
- package/typings/src/storages/string-array-transformers/StringArrayScopeCallsWrappersDataStorage.d.ts +2 -2
- package/typings/src/types/container/node-transformers/TControlFlowStorageFactory.d.ts +2 -2
- package/typings/src/types/container/node-transformers/TControlFlowStorageFactoryCreator.d.ts +3 -0
- package/typings/src/types/node/TNumberLiteralNode.d.ts +4 -0
- package/typings/src/utils/SetUtils.d.ts +7 -0
- package/typings/src/storages/custom-nodes/ControlFlowStorage.d.ts +0 -7
- package/typings/src/types/storages/TControlFlowStorage.d.ts +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
Change Log
|
|
2
2
|
|
|
3
|
+
v3.2.3
|
|
4
|
+
---
|
|
5
|
+
* Fixed missing transformation of string array calls in some cases
|
|
6
|
+
* Fixed generation of reserved identifier names like `Map` or `Set` for `mangled` and `mangled-shuffled` identifier names generators
|
|
7
|
+
|
|
8
|
+
v3.2.2
|
|
9
|
+
---
|
|
10
|
+
* Fixed https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1039
|
|
11
|
+
|
|
12
|
+
v3.2.1
|
|
13
|
+
---
|
|
14
|
+
* Updated copyright
|
|
15
|
+
|
|
16
|
+
v3.2.0
|
|
17
|
+
---
|
|
18
|
+
* **New options**: `stringArrayCallsTransform` and `stringArrayCallsTransformThreshold`
|
|
19
|
+
* Fixed https://github.com/javascript-obfuscator/javascript-obfuscator/pull/1046
|
|
20
|
+
|
|
3
21
|
v3.1.0
|
|
4
22
|
---
|
|
5
23
|
* Added support of `es2022` features: class static block
|
package/README.md
CHANGED
|
@@ -379,10 +379,12 @@ Following options are available for the JS Obfuscator:
|
|
|
379
379
|
splitStrings: false,
|
|
380
380
|
splitStringsChunkLength: 10,
|
|
381
381
|
stringArray: true,
|
|
382
|
+
stringArrayCallsTransform: true,
|
|
383
|
+
stringArrayCallsTransformThreshold: 0.5,
|
|
384
|
+
stringArrayEncoding: [],
|
|
382
385
|
stringArrayIndexesType: [
|
|
383
386
|
'hexadecimal-number'
|
|
384
387
|
],
|
|
385
|
-
stringArrayEncoding: [],
|
|
386
388
|
stringArrayIndexShift: true,
|
|
387
389
|
stringArrayRotate: true,
|
|
388
390
|
stringArrayShuffle: true,
|
|
@@ -441,8 +443,10 @@ Following options are available for the JS Obfuscator:
|
|
|
441
443
|
--split-strings <boolean>
|
|
442
444
|
--split-strings-chunk-length <number>
|
|
443
445
|
--string-array <boolean>
|
|
444
|
-
--string-array-
|
|
446
|
+
--string-array-calls-transform <boolean>
|
|
447
|
+
--string-array-calls-transform-threshold <number>
|
|
445
448
|
--string-array-encoding '<list>' (comma separated) [none, base64, rc4]
|
|
449
|
+
--string-array-indexes-type '<list>' (comma separated) [hexadecimal-number, hexadecimal-numeric-string]
|
|
446
450
|
--string-array-index-shift <boolean>
|
|
447
451
|
--string-array-rotate <boolean>
|
|
448
452
|
--string-array-shuffle <boolean>
|
|
@@ -1097,6 +1101,80 @@ Type: `boolean` Default: `true`
|
|
|
1097
1101
|
|
|
1098
1102
|
Removes string literals and place them in a special array. For instance, the string `"Hello World"` in `var m = "Hello World";` will be replaced with something like `var m = _0x12c456[0x1];`
|
|
1099
1103
|
|
|
1104
|
+
### `stringArrayCallsTransform`
|
|
1105
|
+
Type: `boolean` Default: `false`
|
|
1106
|
+
|
|
1107
|
+
##### :warning: [`stringArray`](#stringarray) option must be enabled
|
|
1108
|
+
|
|
1109
|
+
Enables the transformation of calls to the [`stringArray`](#stringarray). All arguments of these calls may be extracted to a different object depending on [`stringArrayCallsTransformThreshold`](#stringarraycallstransformthreshold) value.
|
|
1110
|
+
So it makes it even harder to automatically find calls to the string array.
|
|
1111
|
+
|
|
1112
|
+
Example:
|
|
1113
|
+
```
|
|
1114
|
+
function foo() {
|
|
1115
|
+
var k = {
|
|
1116
|
+
c: 0x2f2,
|
|
1117
|
+
d: '0x396',
|
|
1118
|
+
e: '0x397',
|
|
1119
|
+
f: '0x39a',
|
|
1120
|
+
g: '0x39d',
|
|
1121
|
+
h: 0x398,
|
|
1122
|
+
l: 0x394,
|
|
1123
|
+
m: '0x39b',
|
|
1124
|
+
n: '0x39f',
|
|
1125
|
+
o: 0x395,
|
|
1126
|
+
p: 0x395,
|
|
1127
|
+
q: 0x399,
|
|
1128
|
+
r: '0x399'
|
|
1129
|
+
};
|
|
1130
|
+
var c = i(k.d, k.e);
|
|
1131
|
+
var d = i(k.f, k.g);
|
|
1132
|
+
var e = i(k.h, k.l);
|
|
1133
|
+
var f = i(k.m, k.n);
|
|
1134
|
+
function i(c, d) {
|
|
1135
|
+
return b(c - k.c, d);
|
|
1136
|
+
}
|
|
1137
|
+
var g = i(k.o, k.p);
|
|
1138
|
+
var h = i(k.q, k.r);
|
|
1139
|
+
}
|
|
1140
|
+
function j(c, d) {
|
|
1141
|
+
var l = { c: 0x14b };
|
|
1142
|
+
return b(c - -l.c, d);
|
|
1143
|
+
}
|
|
1144
|
+
console[j(-'0xa6', -'0xa6')](foo());
|
|
1145
|
+
function b(c, d) {
|
|
1146
|
+
var e = a();
|
|
1147
|
+
b = function (f, g) {
|
|
1148
|
+
f = f - 0xa3;
|
|
1149
|
+
var h = e[f];
|
|
1150
|
+
return h;
|
|
1151
|
+
};
|
|
1152
|
+
return b(c, d);
|
|
1153
|
+
}
|
|
1154
|
+
function a() {
|
|
1155
|
+
var m = [
|
|
1156
|
+
'string5',
|
|
1157
|
+
'string1',
|
|
1158
|
+
'log',
|
|
1159
|
+
'string3',
|
|
1160
|
+
'string6',
|
|
1161
|
+
'string2',
|
|
1162
|
+
'string4'
|
|
1163
|
+
];
|
|
1164
|
+
a = function () {
|
|
1165
|
+
return m;
|
|
1166
|
+
};
|
|
1167
|
+
return a();
|
|
1168
|
+
}
|
|
1169
|
+
```
|
|
1170
|
+
|
|
1171
|
+
### `stringArrayCallsTransformThreshold`
|
|
1172
|
+
Type: `number` Default: `0.5`
|
|
1173
|
+
|
|
1174
|
+
##### :warning: [`stringArray`](#stringarray) and [`stringArrayCallsTransformThreshold`](#stringarraycallstransformthreshold) options must be enabled
|
|
1175
|
+
|
|
1176
|
+
You can use this setting to adjust the probability (from 0 to 1) that calls to the string array will be transformed.
|
|
1177
|
+
|
|
1100
1178
|
### `stringArrayEncoding`
|
|
1101
1179
|
Type: `string[]` Default: `[]`
|
|
1102
1180
|
|
|
@@ -1419,7 +1497,7 @@ Unicode escape sequence increases code size greatly and strings easily can be re
|
|
|
1419
1497
|
## Preset Options
|
|
1420
1498
|
### High obfuscation, low performance
|
|
1421
1499
|
|
|
1422
|
-
|
|
1500
|
+
The performance will be much slower than without obfuscation
|
|
1423
1501
|
|
|
1424
1502
|
```javascript
|
|
1425
1503
|
{
|
|
@@ -1440,6 +1518,7 @@ Performance will 50-100% slower than without obfuscation
|
|
|
1440
1518
|
splitStrings: true,
|
|
1441
1519
|
splitStringsChunkLength: 5,
|
|
1442
1520
|
stringArray: true,
|
|
1521
|
+
stringArrayCallsTransform: true,
|
|
1443
1522
|
stringArrayEncoding: ['rc4'],
|
|
1444
1523
|
stringArrayIndexShift: true,
|
|
1445
1524
|
stringArrayRotate: true,
|
|
@@ -1456,7 +1535,7 @@ Performance will 50-100% slower than without obfuscation
|
|
|
1456
1535
|
|
|
1457
1536
|
### Medium obfuscation, optimal performance
|
|
1458
1537
|
|
|
1459
|
-
|
|
1538
|
+
The performance will be slower than without obfuscation
|
|
1460
1539
|
|
|
1461
1540
|
```javascript
|
|
1462
1541
|
{
|
|
@@ -1477,6 +1556,8 @@ Performance will 30-35% slower than without obfuscation
|
|
|
1477
1556
|
splitStrings: true,
|
|
1478
1557
|
splitStringsChunkLength: 10,
|
|
1479
1558
|
stringArray: true,
|
|
1559
|
+
stringArrayCallsTransform: true,
|
|
1560
|
+
stringArrayCallsTransformThreshold: 0.75,
|
|
1480
1561
|
stringArrayEncoding: ['base64'],
|
|
1481
1562
|
stringArrayIndexShift: true,
|
|
1482
1563
|
stringArrayRotate: true,
|
|
@@ -1493,7 +1574,7 @@ Performance will 30-35% slower than without obfuscation
|
|
|
1493
1574
|
|
|
1494
1575
|
### Low obfuscation, High performance
|
|
1495
1576
|
|
|
1496
|
-
|
|
1577
|
+
The performance will be at a relatively normal level
|
|
1497
1578
|
|
|
1498
1579
|
```javascript
|
|
1499
1580
|
{
|
|
@@ -1511,6 +1592,7 @@ Performance will slightly slower than without obfuscation
|
|
|
1511
1592
|
simplify: true,
|
|
1512
1593
|
splitStrings: false,
|
|
1513
1594
|
stringArray: true,
|
|
1595
|
+
stringArrayCallsTransform: false,
|
|
1514
1596
|
stringArrayEncoding: [],
|
|
1515
1597
|
stringArrayIndexShift: true,
|
|
1516
1598
|
stringArrayRotate: true,
|
|
@@ -1542,6 +1624,8 @@ Performance will slightly slower than without obfuscation
|
|
|
1542
1624
|
simplify: true,
|
|
1543
1625
|
splitStrings: false,
|
|
1544
1626
|
stringArray: true,
|
|
1627
|
+
stringArrayCallsTransform: false,
|
|
1628
|
+
stringArrayCallsTransformThreshold: 0.5,
|
|
1545
1629
|
stringArrayEncoding: [],
|
|
1546
1630
|
stringArrayIndexShift: true,
|
|
1547
1631
|
stringArrayRotate: true,
|
|
@@ -1646,7 +1730,7 @@ Become a sponsor and get your logo on our README on Github with a link to your s
|
|
|
1646
1730
|
## License
|
|
1647
1731
|
[](https://app.fossa.io/projects/git%2Bgithub.com%2Fjavascript-obfuscator%2Fjavascript-obfuscator?ref=badge_large)
|
|
1648
1732
|
|
|
1649
|
-
Copyright (C) 2016-
|
|
1733
|
+
Copyright (C) 2016-2022 [Timofey Kachalov](http://github.com/sanex3339).
|
|
1650
1734
|
|
|
1651
1735
|
Redistribution and use in source and binary forms, with or without
|
|
1652
1736
|
modification, are permitted provided that the following conditions are met:
|