@afterpack/protection-map 0.2.1 → 0.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/package.json +1 -1
- package/template.html +6 -35
package/package.json
CHANGED
package/template.html
CHANGED
|
@@ -1024,7 +1024,6 @@ details[open] > .details-summary::before { transform: rotate(90deg); }
|
|
|
1024
1024
|
.chain-delta { flex: 0 0 auto; margin-left: auto; padding-left: 6px; color: var(--text-muted); font-family: var(--font-mono); font-size: 10px; white-space: nowrap; }
|
|
1025
1025
|
.chain-caption { font-size: 11px; line-height: 1.4; color: var(--text-muted); margin-top: 2px; }
|
|
1026
1026
|
.chain-caption [data-tip] { cursor: help; }
|
|
1027
|
-
.chain-credit { color: var(--text-secondary); font-weight: 600; white-space: nowrap; }
|
|
1028
1027
|
.chain-more { margin-top: 6px; font-size: 10.5px; color: var(--text-muted); font-style: italic; padding-left: 22px; }
|
|
1029
1028
|
.chip {
|
|
1030
1029
|
font-family: var(--font-mono);
|
|
@@ -1386,7 +1385,6 @@ async function afterpackInflateBase64Gzip(b64) {
|
|
|
1386
1385
|
readMap: "/docs/protection-map#how-to-read-it",
|
|
1387
1386
|
mapLives: "/docs/protection-map#where-your-map-lives",
|
|
1388
1387
|
classes: "/docs/reversal-classes#the-classes",
|
|
1389
|
-
attackers: "/docs/threat-model#attacker-classes",
|
|
1390
1388
|
secret: "/docs/threat-model#protecting-a-secret",
|
|
1391
1389
|
antiTamper: "/docs/threat-model#anti-tamper",
|
|
1392
1390
|
directives: "/docs/directives#writing-one",
|
|
@@ -1467,16 +1465,13 @@ async function afterpackInflateBase64Gzip(b64) {
|
|
|
1467
1465
|
};
|
|
1468
1466
|
|
|
1469
1467
|
var INSP_COPY = {
|
|
1470
|
-
complexity: "How complex this code is after protection, on the same scale as --complexity.
|
|
1468
|
+
complexity: "How complex this code is after protection, on the same scale as --complexity.",
|
|
1471
1469
|
noComplexity: "This map doesn't record the complexity each part of your code reached, only the build's target.",
|
|
1472
1470
|
target: "The complexity this build aimed for, set by --complexity or your preset.",
|
|
1473
|
-
resists: "Estimated chance that at least one transform here survives free automated deobfuscation tools, combined from each transform's measured rate.",
|
|
1474
1471
|
addedSize: "Roughly how many bytes protection added here.",
|
|
1475
1472
|
decoders: "Small decoders that run here to rebuild strings or values.",
|
|
1476
1473
|
leakInside: "Readable text sits inside this code. The complexity shown is for the code around it, not the text.",
|
|
1477
1474
|
transforms: "Each transform applied to this code, oldest first.",
|
|
1478
|
-
transformsRates: "A transform with no rate has no measured resistance on its own.",
|
|
1479
|
-
credit: "Measured on test builds: how much of this transform's work the best free deobfuscation tool could not undo.",
|
|
1480
1475
|
detailsOff: "Step details were left out to keep this map small. Set protectionMap.detailed to true to include them.",
|
|
1481
1476
|
noPosition: "The map can't point to where this sits in your source.",
|
|
1482
1477
|
preservedLowered: "Syntax was rewritten, but names and values stay readable.",
|
|
@@ -2963,16 +2958,6 @@ async function afterpackInflateBase64Gzip(b64) {
|
|
|
2963
2958
|
});
|
|
2964
2959
|
return { hasLane: CX_LANE, avg: n ? sum / n : null, count: n };
|
|
2965
2960
|
})();
|
|
2966
|
-
var SCORES_ARE_RATES = (function () {
|
|
2967
|
-
var v = /^(\d+)\.(\d+)\.(\d+)/.exec(String(engineOf(FILES[0] || null).version || ""));
|
|
2968
|
-
if (v && (Number(v[1]) > 0 || Number(v[2]) > 1 || (Number(v[2]) === 1 && Number(v[3]) >= 1))) return true;
|
|
2969
|
-
return FILES.some(function (f) {
|
|
2970
|
-
return f.regions.some(function (r) {
|
|
2971
|
-
return (r.raw.lineage || []).some(function (s) { return typeof s.credit === "number" && s.credit > 0; });
|
|
2972
|
-
});
|
|
2973
|
-
});
|
|
2974
|
-
})();
|
|
2975
|
-
function scorePct(score) { return score >= 100 ? "99%+" : Math.round(score) + "%"; }
|
|
2976
2961
|
|
|
2977
2962
|
function fileMeterHtml(file, indent, ignored) {
|
|
2978
2963
|
var c = file.coverage;
|
|
@@ -3053,8 +3038,7 @@ async function afterpackInflateBase64Gzip(b64) {
|
|
|
3053
3038
|
if (BUILD_CX.hasLane && BUILD_CX.avg != null) {
|
|
3054
3039
|
el.innerHTML = cxDotHtml(complexityBand(BUILD_CX.avg)) + 'Complexity <span class="tag-em">' + escapeHtml(fmtCx(BUILD_CX.avg)) + "</span>" +
|
|
3055
3040
|
(t != null ? " · target " + escapeHtml(fmtCx(t)) : "");
|
|
3056
|
-
tip = "Average complexity of your code in this build" + (t != null ? ", next to the target set by --complexity or your preset" : "") +
|
|
3057
|
-
". Higher means harder to reverse.";
|
|
3041
|
+
tip = "Average complexity of your code in this build" + (t != null ? ", next to the target set by --complexity or your preset" : "") + ".";
|
|
3058
3042
|
} else if (t != null) {
|
|
3059
3043
|
el.innerHTML = 'Complexity target <span class="tag-em">' + escapeHtml(fmtCx(t)) + "</span>" +
|
|
3060
3044
|
(preset ? " · " + escapeHtml(String(preset)) : "");
|
|
@@ -3129,7 +3113,7 @@ async function afterpackInflateBase64Gzip(b64) {
|
|
|
3129
3113
|
document.getElementById("cx-legend").innerHTML = rows.join("");
|
|
3130
3114
|
var t = buildTarget();
|
|
3131
3115
|
var note = BUILD_CX.hasLane
|
|
3132
|
-
? "Hotter means more complex
|
|
3116
|
+
? "Hotter means more complex. Red is the most complex, not a problem." +
|
|
3133
3117
|
(BUILD_CX.avg != null ? " This build: average " + fmtCx(BUILD_CX.avg) + (t != null ? ", target " + fmtCx(t) : "") + "." : "")
|
|
3134
3118
|
: "This map doesn't record complexity per token, so all protected code shares one color." +
|
|
3135
3119
|
(t != null ? " This build targeted " + fmtCx(t) + "." : "");
|
|
@@ -3223,29 +3207,19 @@ async function afterpackInflateBase64Gzip(b64) {
|
|
|
3223
3207
|
if (g) {
|
|
3224
3208
|
g.count++;
|
|
3225
3209
|
g.sizeDeltaEst += step.sizeDeltaEst || 0;
|
|
3226
|
-
if (g.credit == null && step.credit != null) g.credit = step.credit;
|
|
3227
3210
|
} else {
|
|
3228
|
-
g = byName[key] = { transform: key, category: step.category, phase: step.phase, count: 1, sizeDeltaEst: step.sizeDeltaEst || 0
|
|
3211
|
+
g = byName[key] = { transform: key, category: step.category, phase: step.phase, count: 1, sizeDeltaEst: step.sizeDeltaEst || 0 };
|
|
3229
3212
|
groups.push(g);
|
|
3230
3213
|
}
|
|
3231
3214
|
});
|
|
3232
3215
|
return groups;
|
|
3233
3216
|
}
|
|
3234
3217
|
|
|
3235
|
-
function creditPct(permille) {
|
|
3236
|
-
if (typeof permille !== "number" || isNaN(permille) || permille <= 0) return null;
|
|
3237
|
-
var p = permille / 10;
|
|
3238
|
-
return (p >= 10 ? Math.round(p) : Math.round(p * 10) / 10) + "%";
|
|
3239
|
-
}
|
|
3240
3218
|
function breakCamel(name) { return escapeHtml(name).replace(/([a-z0-9])([A-Z])/g, "$1<wbr>$2"); }
|
|
3241
3219
|
|
|
3242
3220
|
var CHAIN_VISIBLE_CAP = 6;
|
|
3243
3221
|
function chainStepHtml(g) {
|
|
3244
3222
|
var cat = categoryMeta(g);
|
|
3245
|
-
var credit = creditPct(g.credit);
|
|
3246
|
-
var caption = [];
|
|
3247
|
-
if (cat) caption.push("<span" + (cat.tip ? tipAttrs(cat.tip, cat.doc) : "") + ">" + escapeHtml(cat.label) + "</span>");
|
|
3248
|
-
if (credit) caption.push('<span class="chain-credit"' + tipAttrs(INSP_COPY.credit, "attackers") + ">resists deobfuscators " + credit + "</span>");
|
|
3249
3223
|
return '<div class="chain-step">' +
|
|
3250
3224
|
'<div class="chain-rail"><span class="chain-dot"></span><span class="chain-line"></span></div>' +
|
|
3251
3225
|
'<div class="chain-body">' +
|
|
@@ -3254,7 +3228,7 @@ async function afterpackInflateBase64Gzip(b64) {
|
|
|
3254
3228
|
(g.count > 1 ? '<span class="chain-count"' + tipAttrs("Applied " + g.count + " times.") + ">×" + g.count + "</span>" : "") +
|
|
3255
3229
|
(g.sizeDeltaEst ? '<span class="chain-delta">' + escapeHtml((g.sizeDeltaEst > 0 ? "+" : "") + fmtNum(g.sizeDeltaEst) + " B") + "</span>" : "") +
|
|
3256
3230
|
"</div>" +
|
|
3257
|
-
(
|
|
3231
|
+
(cat ? '<div class="chain-caption"><span' + (cat.tip ? tipAttrs(cat.tip, cat.doc) : "") + ">" + escapeHtml(cat.label) + "</span></div>" : "") +
|
|
3258
3232
|
"</div>" +
|
|
3259
3233
|
"</div>";
|
|
3260
3234
|
}
|
|
@@ -3283,8 +3257,7 @@ async function afterpackInflateBase64Gzip(b64) {
|
|
|
3283
3257
|
if (!region) return "";
|
|
3284
3258
|
var label = transformsLabel(region);
|
|
3285
3259
|
if (label == null) return "";
|
|
3286
|
-
|
|
3287
|
-
return '<details class="insp-chain"><summary class="details-summary"' + tipAttrs(tip, "cfgTransforms") +
|
|
3260
|
+
return '<details class="insp-chain"><summary class="details-summary"' + tipAttrs(INSP_COPY.transforms, "cfgTransforms") +
|
|
3288
3261
|
'>Transforms <span class="chip">' + escapeHtml(label) + "</span></summary>" + renderChainBody(region) + "</details>";
|
|
3289
3262
|
}
|
|
3290
3263
|
|
|
@@ -3384,8 +3357,6 @@ async function afterpackInflateBase64Gzip(b64) {
|
|
|
3384
3357
|
cxTip: complexityTip(region),
|
|
3385
3358
|
facts: [
|
|
3386
3359
|
cx == null ? missingComplexityFact() : null,
|
|
3387
|
-
SCORES_ARE_RATES && typeof r.score === "number" && r.score > 0
|
|
3388
|
-
? { k: "Resists deobfuscators", v: scorePct(r.score), tip: INSP_COPY.resists, doc: "attackers" } : null,
|
|
3389
3360
|
typeof r.sizeDeltaEst === "number" && r.sizeDeltaEst !== 0
|
|
3390
3361
|
? { k: "Added size", v: (r.sizeDeltaEst > 0 ? "+" : "") + fmtNum(r.sizeDeltaEst) + " B", tip: INSP_COPY.addedSize, doc: "sizeBudget" } : null,
|
|
3391
3362
|
perf.decodeOps > 0 ? { k: "Runtime decoders", v: perf.decodeOps, tip: INSP_COPY.decoders, doc: "perf" } : null
|