unpeek 1.6.2 → 1.7.2
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/dist/ast/index.cjs +262 -85
- package/dist/ast/index.cjs.map +1 -1
- package/dist/ast/index.js +262 -85
- package/dist/ast/index.js.map +1 -1
- package/dist/browser.cjs +262 -85
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.js +262 -85
- package/dist/browser.js.map +1 -1
- package/dist/bundler/unplugin.cjs +262 -85
- package/dist/bundler/unplugin.cjs.map +1 -1
- package/dist/bundler/unplugin.js +262 -85
- package/dist/bundler/unplugin.js.map +1 -1
- package/dist/cli/index.cjs +263 -86
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.js +263 -86
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/protect.cjs +262 -85
- package/dist/cli/protect.cjs.map +1 -1
- package/dist/cli/protect.js +262 -85
- package/dist/cli/protect.js.map +1 -1
- package/dist/esbuild.cjs +262 -85
- package/dist/esbuild.cjs.map +1 -1
- package/dist/esbuild.js +262 -85
- package/dist/esbuild.js.map +1 -1
- package/dist/index.cjs +263 -86
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +263 -86
- package/dist/index.js.map +1 -1
- package/dist/rollup.cjs +262 -85
- package/dist/rollup.cjs.map +1 -1
- package/dist/rollup.js +262 -85
- package/dist/rollup.js.map +1 -1
- package/dist/runtime/index.cjs +2 -15
- package/dist/runtime/index.cjs.map +1 -1
- package/dist/runtime/index.js +2 -15
- package/dist/runtime/index.js.map +1 -1
- package/dist/vite.cjs +262 -85
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.js +262 -85
- package/dist/vite.js.map +1 -1
- package/dist/webpack.cjs +262 -85
- package/dist/webpack.cjs.map +1 -1
- package/dist/webpack.js +262 -85
- package/dist/webpack.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.cjs
CHANGED
|
@@ -921,27 +921,25 @@ var DIRECTIVE_STRINGS = /* @__PURE__ */ new Set([
|
|
|
921
921
|
"use asm"
|
|
922
922
|
]);
|
|
923
923
|
var HELPER_TEMPLATE = acorn2.parse(
|
|
924
|
-
`var _ =
|
|
925
|
-
var s = "";
|
|
926
|
-
for (var j = 0; j < a.length; j++) {
|
|
927
|
-
s += String.fromCharCode(a.charCodeAt(j) ^ (((0 ^ ((a._u || /\\n/.test(f) * 14) | ((j & 1) * 0))) & 30) | 1));
|
|
928
|
-
}
|
|
929
|
-
return s;
|
|
930
|
-
});`,
|
|
924
|
+
`var _ = (function f(a){return a.map(function(s){var o="";for(var j=0;j<s.length;j++)o+=String.fromCharCode(s.charCodeAt(j)^(((0^((a._u||/\\n/.test(f)*14)|((j&1)*0)))&30)|1));return o;});})([]);`,
|
|
931
925
|
{ ecmaVersion: "latest", sourceType: "script" }
|
|
932
926
|
).body[0];
|
|
933
927
|
function createVaultHelperAst(cacheVarName, encryptedPayloads, mask, step) {
|
|
934
928
|
const node = structuredClone(HELPER_TEMPLATE);
|
|
935
929
|
node.declarations[0].id.name = cacheVarName;
|
|
936
|
-
node.declarations[0].init.
|
|
930
|
+
node.declarations[0].init.arguments[0].elements = encryptedPayloads.map(
|
|
937
931
|
(str) => ({
|
|
938
932
|
type: "Literal",
|
|
939
933
|
value: str,
|
|
940
934
|
raw: JSON.stringify(str)
|
|
941
935
|
})
|
|
942
936
|
);
|
|
943
|
-
const
|
|
944
|
-
const
|
|
937
|
+
const outerFn = node.declarations[0].init.callee;
|
|
938
|
+
const returnStmt = outerFn.body.body[0];
|
|
939
|
+
const innerFn = returnStmt.argument.arguments[0];
|
|
940
|
+
const forStmt = innerFn.body.body[1];
|
|
941
|
+
const expr = forStmt.body.type === "BlockStatement" ? forStmt.body.body[0].expression : forStmt.body.expression;
|
|
942
|
+
const binaryXor = expr.right.arguments[0];
|
|
945
943
|
const innerLeft = binaryXor.right.left.left;
|
|
946
944
|
innerLeft.left.value = mask;
|
|
947
945
|
innerLeft.left.raw = String(mask);
|
|
@@ -979,44 +977,58 @@ function applyStringVault(ast, seed = 2654435769, minStringLength = 4, hotExempt
|
|
|
979
977
|
};
|
|
980
978
|
}
|
|
981
979
|
const mask = seed >>> 0 & 30 | 3;
|
|
982
|
-
const step =
|
|
980
|
+
const step = 1;
|
|
983
981
|
const stringToIndex = /* @__PURE__ */ new Map();
|
|
984
982
|
const encryptedPayloads = [];
|
|
985
983
|
const targetsToReplace = [];
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
if (
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
984
|
+
const customWalkBase = {
|
|
985
|
+
...walk2.base,
|
|
986
|
+
Property(node, st, c) {
|
|
987
|
+
c(node.key, st);
|
|
988
|
+
if (node.value) c(node.value, st);
|
|
989
|
+
}
|
|
990
|
+
};
|
|
991
|
+
walk2.ancestor(
|
|
992
|
+
ast,
|
|
993
|
+
{
|
|
994
|
+
Literal(node, _state, ancestors) {
|
|
995
|
+
if (typeof node.value !== "string") return;
|
|
996
|
+
const val = node.value;
|
|
997
|
+
if (val.length < minStringLength) return;
|
|
998
|
+
if (DIRECTIVE_STRINGS.has(val)) return;
|
|
999
|
+
if (hotExemptNodes) {
|
|
1000
|
+
for (let i = ancestors.length - 2; i >= 0; i--) {
|
|
1001
|
+
if (hotExemptNodes.has(ancestors[i])) {
|
|
1002
|
+
return;
|
|
1003
|
+
}
|
|
996
1004
|
}
|
|
997
1005
|
}
|
|
1006
|
+
const parent = ancestors[ancestors.length - 2];
|
|
1007
|
+
if (!parent) return;
|
|
1008
|
+
if (parent.type === "ExpressionStatement" && parent.directive) return;
|
|
1009
|
+
if (parent.type === "ImportDeclaration" || parent.type === "ExportNamedDeclaration" || parent.type === "ExportAllDeclaration" || parent.type === "ImportExpression") {
|
|
1010
|
+
if (parent.source === node) return;
|
|
1011
|
+
}
|
|
1012
|
+
if ((parent.type === "MethodDefinition" || parent.type === "PropertyDefinition") && parent.key === node && !parent.computed) {
|
|
1013
|
+
return;
|
|
1014
|
+
}
|
|
1015
|
+
if (parent.type === "Property" && parent.key === node) {
|
|
1016
|
+
parent.computed = true;
|
|
1017
|
+
}
|
|
1018
|
+
if (parent.type === "ImportAttribute" || parent.type === "ImportSpecifier" || parent.type === "ExportSpecifier") {
|
|
1019
|
+
return;
|
|
1020
|
+
}
|
|
1021
|
+
let idx = stringToIndex.get(val);
|
|
1022
|
+
if (idx === void 0) {
|
|
1023
|
+
idx = encryptedPayloads.length;
|
|
1024
|
+
stringToIndex.set(val, idx);
|
|
1025
|
+
encryptedPayloads.push(encodeStringWithSeed(val, mask, step));
|
|
1026
|
+
}
|
|
1027
|
+
targetsToReplace.push({ node, parent });
|
|
998
1028
|
}
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
if (parent.type === "ImportDeclaration" || parent.type === "ExportNamedDeclaration" || parent.type === "ExportAllDeclaration" || parent.type === "ImportExpression") {
|
|
1003
|
-
if (parent.source === node) return;
|
|
1004
|
-
}
|
|
1005
|
-
if ((parent.type === "Property" || parent.type === "MethodDefinition" || parent.type === "PropertyDefinition") && parent.key === node && !parent.computed) {
|
|
1006
|
-
return;
|
|
1007
|
-
}
|
|
1008
|
-
if (parent.type === "ImportAttribute" || parent.type === "ImportSpecifier" || parent.type === "ExportSpecifier") {
|
|
1009
|
-
return;
|
|
1010
|
-
}
|
|
1011
|
-
let idx = stringToIndex.get(val);
|
|
1012
|
-
if (idx === void 0) {
|
|
1013
|
-
idx = encryptedPayloads.length;
|
|
1014
|
-
stringToIndex.set(val, idx);
|
|
1015
|
-
encryptedPayloads.push(encodeStringWithSeed(val, mask, step));
|
|
1016
|
-
}
|
|
1017
|
-
targetsToReplace.push({ node });
|
|
1018
|
-
}
|
|
1019
|
-
});
|
|
1029
|
+
},
|
|
1030
|
+
customWalkBase
|
|
1031
|
+
);
|
|
1020
1032
|
if (targetsToReplace.length === 0 || encryptedPayloads.length === 0) {
|
|
1021
1033
|
return {
|
|
1022
1034
|
encryptedStringsCount: 0,
|
|
@@ -1027,7 +1039,10 @@ function applyStringVault(ast, seed = 2654435769, minStringLength = 4, hotExempt
|
|
|
1027
1039
|
const integrityToken = computeFnv1aHash(serializedTable, seed);
|
|
1028
1040
|
const suffix = computeFnv1aHash(`vault:${seed}`, integrityToken).toString(36);
|
|
1029
1041
|
const cacheVarName = `_uC${suffix}`;
|
|
1030
|
-
for (const { node } of targetsToReplace) {
|
|
1042
|
+
for (const { node, parent } of targetsToReplace) {
|
|
1043
|
+
if (parent?.type === "Property" && parent.key === node) {
|
|
1044
|
+
parent.computed = true;
|
|
1045
|
+
}
|
|
1031
1046
|
const idx = stringToIndex.get(node.value);
|
|
1032
1047
|
node.type = "MemberExpression";
|
|
1033
1048
|
node.object = {
|
|
@@ -1492,10 +1507,174 @@ function applyPolymorphicMangler(ast, seed = 2654435769) {
|
|
|
1492
1507
|
|
|
1493
1508
|
// src/ast/cold-flow-guard.ts
|
|
1494
1509
|
var walk4 = __toESM(require("acorn-walk"), 1);
|
|
1495
|
-
function
|
|
1496
|
-
const
|
|
1497
|
-
|
|
1498
|
-
|
|
1510
|
+
function createDecoyConsequent(fnIndex) {
|
|
1511
|
+
const model = Math.abs(fnIndex) % 3;
|
|
1512
|
+
if (model === 0) {
|
|
1513
|
+
return {
|
|
1514
|
+
type: "BlockStatement",
|
|
1515
|
+
body: [
|
|
1516
|
+
{
|
|
1517
|
+
type: "ReturnStatement",
|
|
1518
|
+
argument: {
|
|
1519
|
+
type: "ObjectExpression",
|
|
1520
|
+
properties: [
|
|
1521
|
+
{
|
|
1522
|
+
type: "Property",
|
|
1523
|
+
key: { type: "Identifier", name: "endpoint" },
|
|
1524
|
+
value: {
|
|
1525
|
+
type: "Literal",
|
|
1526
|
+
value: "/api/v2/auth/admin-bypass",
|
|
1527
|
+
raw: '"/api/v2/auth/admin-bypass"'
|
|
1528
|
+
},
|
|
1529
|
+
kind: "init",
|
|
1530
|
+
computed: false,
|
|
1531
|
+
method: false,
|
|
1532
|
+
shorthand: false
|
|
1533
|
+
},
|
|
1534
|
+
{
|
|
1535
|
+
type: "Property",
|
|
1536
|
+
key: { type: "Identifier", name: "superadmin_token" },
|
|
1537
|
+
value: { type: "Literal", value: 1, raw: "1" },
|
|
1538
|
+
kind: "init",
|
|
1539
|
+
computed: false,
|
|
1540
|
+
method: false,
|
|
1541
|
+
shorthand: false
|
|
1542
|
+
},
|
|
1543
|
+
{
|
|
1544
|
+
type: "Property",
|
|
1545
|
+
key: { type: "Identifier", name: "elevate" },
|
|
1546
|
+
value: { type: "Literal", value: 1, raw: "1" },
|
|
1547
|
+
kind: "init",
|
|
1548
|
+
computed: false,
|
|
1549
|
+
method: false,
|
|
1550
|
+
shorthand: false
|
|
1551
|
+
}
|
|
1552
|
+
]
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
]
|
|
1556
|
+
};
|
|
1557
|
+
}
|
|
1558
|
+
if (model === 1) {
|
|
1559
|
+
return {
|
|
1560
|
+
type: "BlockStatement",
|
|
1561
|
+
body: [
|
|
1562
|
+
{
|
|
1563
|
+
type: "ReturnStatement",
|
|
1564
|
+
argument: {
|
|
1565
|
+
type: "ObjectExpression",
|
|
1566
|
+
properties: [
|
|
1567
|
+
{
|
|
1568
|
+
type: "Property",
|
|
1569
|
+
key: { type: "Identifier", name: "endpoint" },
|
|
1570
|
+
value: {
|
|
1571
|
+
type: "Literal",
|
|
1572
|
+
value: "/api/v2/auth/verify-master",
|
|
1573
|
+
raw: '"/api/v2/auth/verify-master"'
|
|
1574
|
+
},
|
|
1575
|
+
kind: "init",
|
|
1576
|
+
computed: false,
|
|
1577
|
+
method: false,
|
|
1578
|
+
shorthand: false
|
|
1579
|
+
},
|
|
1580
|
+
{
|
|
1581
|
+
type: "Property",
|
|
1582
|
+
key: { type: "Identifier", name: "_verifyMasterToken" },
|
|
1583
|
+
value: { type: "Literal", value: true, raw: "true" },
|
|
1584
|
+
kind: "init",
|
|
1585
|
+
computed: false,
|
|
1586
|
+
method: false,
|
|
1587
|
+
shorthand: false
|
|
1588
|
+
},
|
|
1589
|
+
{
|
|
1590
|
+
type: "Property",
|
|
1591
|
+
key: { type: "Identifier", name: "_bypassToken" },
|
|
1592
|
+
value: {
|
|
1593
|
+
type: "Literal",
|
|
1594
|
+
value: "mock_jwt_bypass_signature",
|
|
1595
|
+
raw: '"mock_jwt_bypass_signature"'
|
|
1596
|
+
},
|
|
1597
|
+
kind: "init",
|
|
1598
|
+
computed: false,
|
|
1599
|
+
method: false,
|
|
1600
|
+
shorthand: false
|
|
1601
|
+
},
|
|
1602
|
+
{
|
|
1603
|
+
type: "Property",
|
|
1604
|
+
key: { type: "Identifier", name: "authorized" },
|
|
1605
|
+
value: { type: "Literal", value: true, raw: "true" },
|
|
1606
|
+
kind: "init",
|
|
1607
|
+
computed: false,
|
|
1608
|
+
method: false,
|
|
1609
|
+
shorthand: false
|
|
1610
|
+
}
|
|
1611
|
+
]
|
|
1612
|
+
}
|
|
1613
|
+
}
|
|
1614
|
+
]
|
|
1615
|
+
};
|
|
1616
|
+
}
|
|
1617
|
+
return {
|
|
1618
|
+
type: "BlockStatement",
|
|
1619
|
+
body: [
|
|
1620
|
+
{
|
|
1621
|
+
type: "ReturnStatement",
|
|
1622
|
+
argument: {
|
|
1623
|
+
type: "ObjectExpression",
|
|
1624
|
+
properties: [
|
|
1625
|
+
{
|
|
1626
|
+
type: "Property",
|
|
1627
|
+
key: { type: "Identifier", name: "endpoint" },
|
|
1628
|
+
value: {
|
|
1629
|
+
type: "Literal",
|
|
1630
|
+
value: "/api/v2/auth/debug-telemetry",
|
|
1631
|
+
raw: '"/api/v2/auth/debug-telemetry"'
|
|
1632
|
+
},
|
|
1633
|
+
kind: "init",
|
|
1634
|
+
computed: false,
|
|
1635
|
+
method: false,
|
|
1636
|
+
shorthand: false
|
|
1637
|
+
},
|
|
1638
|
+
{
|
|
1639
|
+
type: "Property",
|
|
1640
|
+
key: { type: "Identifier", name: "debug_supervisor_override" },
|
|
1641
|
+
value: { type: "Literal", value: true, raw: "true" },
|
|
1642
|
+
kind: "init",
|
|
1643
|
+
computed: false,
|
|
1644
|
+
method: false,
|
|
1645
|
+
shorthand: false
|
|
1646
|
+
},
|
|
1647
|
+
{
|
|
1648
|
+
type: "Property",
|
|
1649
|
+
key: { type: "Identifier", name: "_bypassToken" },
|
|
1650
|
+
value: {
|
|
1651
|
+
type: "Literal",
|
|
1652
|
+
value: "superadmin_token",
|
|
1653
|
+
raw: '"superadmin_token"'
|
|
1654
|
+
},
|
|
1655
|
+
kind: "init",
|
|
1656
|
+
computed: false,
|
|
1657
|
+
method: false,
|
|
1658
|
+
shorthand: false
|
|
1659
|
+
},
|
|
1660
|
+
{
|
|
1661
|
+
type: "Property",
|
|
1662
|
+
key: { type: "Identifier", name: "mfa_bypassed" },
|
|
1663
|
+
value: { type: "Literal", value: true, raw: "true" },
|
|
1664
|
+
kind: "init",
|
|
1665
|
+
computed: false,
|
|
1666
|
+
method: false,
|
|
1667
|
+
shorthand: false
|
|
1668
|
+
}
|
|
1669
|
+
]
|
|
1670
|
+
}
|
|
1671
|
+
}
|
|
1672
|
+
]
|
|
1673
|
+
};
|
|
1674
|
+
}
|
|
1675
|
+
function createSotaMbaPredicate(seed, fnIndex = 0) {
|
|
1676
|
+
const x = (seed >>> 0) + Math.imul(fnIndex + 1, 73244475) | 0;
|
|
1677
|
+
const y = x ^ 1515870810 | 0;
|
|
1499
1678
|
return {
|
|
1500
1679
|
type: "IfStatement",
|
|
1501
1680
|
test: {
|
|
@@ -1503,46 +1682,57 @@ function createOpaqueGuardStatement(seed, fnIndex) {
|
|
|
1503
1682
|
operator: "===",
|
|
1504
1683
|
left: {
|
|
1505
1684
|
type: "BinaryExpression",
|
|
1506
|
-
operator: "
|
|
1685
|
+
operator: "|",
|
|
1507
1686
|
left: {
|
|
1508
1687
|
type: "BinaryExpression",
|
|
1509
1688
|
operator: "^",
|
|
1510
|
-
left: {
|
|
1511
|
-
right: {
|
|
1689
|
+
left: {
|
|
1512
1690
|
type: "BinaryExpression",
|
|
1513
|
-
operator: "
|
|
1514
|
-
left: {
|
|
1691
|
+
operator: "+",
|
|
1692
|
+
left: {
|
|
1693
|
+
type: "BinaryExpression",
|
|
1694
|
+
operator: "|",
|
|
1695
|
+
left: { type: "Literal", value: x, raw: String(x) },
|
|
1696
|
+
right: { type: "Literal", value: y, raw: String(y) }
|
|
1697
|
+
},
|
|
1515
1698
|
right: {
|
|
1516
|
-
type: "
|
|
1517
|
-
operator: "
|
|
1518
|
-
|
|
1519
|
-
|
|
1699
|
+
type: "BinaryExpression",
|
|
1700
|
+
operator: "&",
|
|
1701
|
+
left: { type: "Literal", value: x, raw: String(x) },
|
|
1702
|
+
right: { type: "Literal", value: y, raw: String(y) }
|
|
1520
1703
|
}
|
|
1704
|
+
},
|
|
1705
|
+
right: {
|
|
1706
|
+
type: "BinaryExpression",
|
|
1707
|
+
operator: "+",
|
|
1708
|
+
left: { type: "Literal", value: x, raw: String(x) },
|
|
1709
|
+
right: { type: "Literal", value: y, raw: String(y) }
|
|
1521
1710
|
}
|
|
1522
1711
|
},
|
|
1523
|
-
right: {
|
|
1712
|
+
right: {
|
|
1713
|
+
type: "UnaryExpression",
|
|
1714
|
+
operator: "!",
|
|
1715
|
+
prefix: true,
|
|
1716
|
+
argument: { type: "Identifier", name: "String" }
|
|
1717
|
+
}
|
|
1524
1718
|
},
|
|
1525
|
-
right: { type: "Literal", value:
|
|
1526
|
-
},
|
|
1527
|
-
consequent: {
|
|
1528
|
-
type: "ExpressionStatement",
|
|
1529
|
-
expression: {
|
|
1530
|
-
type: "UnaryExpression",
|
|
1531
|
-
operator: "void",
|
|
1532
|
-
prefix: true,
|
|
1533
|
-
argument: { type: "Literal", value: 0, raw: "0" }
|
|
1534
|
-
}
|
|
1719
|
+
right: { type: "Literal", value: 2147483647, raw: "0x7fffffff" }
|
|
1535
1720
|
},
|
|
1721
|
+
consequent: createDecoyConsequent(fnIndex),
|
|
1536
1722
|
alternate: null
|
|
1537
1723
|
};
|
|
1538
1724
|
}
|
|
1539
|
-
function applyColdFlowGuard(ast, coldFunctionNodes, seed = 2654435769) {
|
|
1725
|
+
function applyColdFlowGuard(ast, coldFunctionNodes, seed = 2654435769, hotExemptNodes) {
|
|
1540
1726
|
let guardedCount = 0;
|
|
1541
1727
|
function maybeInjectGuard(node) {
|
|
1542
1728
|
if (!coldFunctionNodes.has(node)) return;
|
|
1543
1729
|
if (!node.body || node.body.type !== "BlockStatement") return;
|
|
1730
|
+
const guardStmt = createSotaMbaPredicate(seed, 0);
|
|
1544
1731
|
guardedCount++;
|
|
1545
|
-
|
|
1732
|
+
if (hotExemptNodes) {
|
|
1733
|
+
hotExemptNodes.add(guardStmt);
|
|
1734
|
+
hotExemptNodes.add(guardStmt.consequent);
|
|
1735
|
+
}
|
|
1546
1736
|
let insertIdx = 0;
|
|
1547
1737
|
while (insertIdx < node.body.body.length && node.body.body[insertIdx].type === "ExpressionStatement" && node.body.body[insertIdx].directive) {
|
|
1548
1738
|
insertIdx++;
|
|
@@ -1574,25 +1764,12 @@ function deriveIntegrityFnName(seed) {
|
|
|
1574
1764
|
const hash = computeIntegrityHash(`unpeek:fn:${seed}`, seed);
|
|
1575
1765
|
return `_u$${hash.toString(36)}`;
|
|
1576
1766
|
}
|
|
1577
|
-
function deriveLocalVar(label, seed) {
|
|
1578
|
-
const hash = computeIntegrityHash(`unpeek:var:${label}:${seed}`, seed) & 1048575;
|
|
1579
|
-
return `_${label}${hash.toString(36)}`;
|
|
1580
|
-
}
|
|
1581
1767
|
function createDeterrentSnippet(config) {
|
|
1582
1768
|
const seed = config.seed >>> 0;
|
|
1583
|
-
const expectedToken = (config.expectedIntegrityHash ?? seed) >>> 0;
|
|
1584
1769
|
const deterrentMode = config.deterrentMode ?? "passive";
|
|
1585
1770
|
const fnName = deriveIntegrityFnName(seed);
|
|
1586
|
-
const
|
|
1587
|
-
|
|
1588
|
-
const noopVar = deriveLocalVar("n", seed);
|
|
1589
|
-
const methodsVar = deriveLocalVar("m", seed);
|
|
1590
|
-
const idxVar = deriveLocalVar("i", seed);
|
|
1591
|
-
const errVar = deriveLocalVar("e", seed);
|
|
1592
|
-
const tokenBit = expectedToken & 1;
|
|
1593
|
-
const gradualConsoleSilence = deterrentMode === "gradual" ? `if(typeof console!=='undefined'){var ${noopVar}=function(){},${methodsVar}=['log','debug','info','table','dir'];for(var ${idxVar}=0;${idxVar}<${methodsVar}.length;${idxVar}++){try{console[${methodsVar}[${idxVar}]]=${noopVar};}catch(${errVar}){}}}` : "";
|
|
1594
|
-
const tamperDispatch = `if(window.dispatchEvent&&typeof CustomEvent!=='undefined'){try{window.dispatchEvent(new CustomEvent('unpeek:tamper'));}catch(${errVar}){}}`;
|
|
1595
|
-
return `(function ${fnName}(){if(typeof window!=='undefined'){try{var ${strVar}=Function.prototype.toString,${tamperVar}=${strVar}.call(${strVar}).indexOf('[native code]')<${tokenBit - 1}||/[\\r\\n]/.test(${strVar}.call(${fnName}));if(${tamperVar}){window.__unpeek_tampered=!0;${tamperDispatch}${gradualConsoleSilence}String.prototype._u=14;}}catch(${errVar}){}}})();`;
|
|
1771
|
+
const consoleSilence = deterrentMode === "gradual" ? "for(var k in console)console[k]=f=>0;" : "";
|
|
1772
|
+
return `(function ${fnName}(w){if(w){try{(w.queueMicrotask||w.requestIdleCallback||(f=>f()))(function f(a){var s=Function.prototype.toString,n=w.navigator||0,t=s.call(s).indexOf('[native code]')<0||/\\n/.test(s.call(${fnName}))||n.webdriver||/HeadlessChrome/.test(n.userAgent);if(t){w.__unpeek_tampered=!0,w.__unpeek_seed=((w.__unpeek_seed||${seed})^1)>>>0,String.prototype._u=14;try{${consoleSilence}w.dispatchEvent(new CustomEvent('unpeek:tamper'));}catch(e){}}});}catch(e){}}})(typeof window!=='undefined'&&window);`;
|
|
1596
1773
|
}
|
|
1597
1774
|
|
|
1598
1775
|
// src/runtime/index.ts
|
|
@@ -1657,7 +1834,7 @@ function transformJavaScript(code, options = {}) {
|
|
|
1657
1834
|
coldFunctionNodes,
|
|
1658
1835
|
hotExemptNodes
|
|
1659
1836
|
} = analyzeAstHotPaths(ast);
|
|
1660
|
-
applyColdFlowGuard(ast, coldFunctionNodes, seed);
|
|
1837
|
+
applyColdFlowGuard(ast, coldFunctionNodes, seed, hotExemptNodes);
|
|
1661
1838
|
const mangledSymbolsCount = applyPolymorphicMangler(ast, seed);
|
|
1662
1839
|
const { encryptedStringsCount, integrityToken } = applyStringVault(
|
|
1663
1840
|
ast,
|
|
@@ -1791,7 +1968,7 @@ ${finalCode}`;
|
|
|
1791
1968
|
}
|
|
1792
1969
|
|
|
1793
1970
|
// src/cli/index.ts
|
|
1794
|
-
var VERSION = "1.
|
|
1971
|
+
var VERSION = "1.7.2";
|
|
1795
1972
|
function getPackageVersion() {
|
|
1796
1973
|
try {
|
|
1797
1974
|
const pkgUrl = new URL("../../package.json", importMetaUrl);
|