@jshookmcp/jshook 0.2.9 → 0.3.0
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/README.md +2 -2
- package/README.zh.md +2 -2
- package/dist/{AntiCheatDetector-BNk-EoBt.mjs → AntiCheatDetector-CqGDXmfc.mjs} +159 -53
- package/dist/{CodeInjector-Cq8q01kp.mjs → CodeInjector-BdjRfNx7.mjs} +5 -5
- package/dist/{ConsoleMonitor-CPVQW1Y-.mjs → ConsoleMonitor-DykL3IAw.mjs} +85 -17
- package/dist/{DetailedDataManager-BQQcxh64.mjs → DetailedDataManager-HT49OrvF.mjs} +1 -1
- package/dist/{ExtensionManager-CWYgw0YW.mjs → ExtensionManager-BDMsY2Dz.mjs} +15 -8
- package/dist/{HardwareBreakpoint-B9gZCdFP.mjs → HardwareBreakpoint-Cc2AFq1Y.mjs} +3 -3
- package/dist/{HeapAnalyzer-BLDH0dCv.mjs → HeapAnalyzer-DruMgsgj.mjs} +20 -20
- package/dist/{HookGeneratorBuilders.core.generators.storage-CtcdK78Q.mjs → HookGeneratorBuilders.core.generators.storage-CTbB4Lcx.mjs} +1 -74
- package/dist/{InstrumentationSession-CvPC7Jwy.mjs → InstrumentationSession-DLH0vd-z.mjs} +2 -2
- package/dist/{MemoryController-CbVdCIJF.mjs → MemoryController-CMtviNW_.mjs} +3 -3
- package/dist/{MemoryScanSession-BsDZbLYm.mjs → MemoryScanSession-ITgb_NMi.mjs} +2 -2
- package/dist/{MemoryScanner-Bcpml6II.mjs → MemoryScanner-CiL7Z3ey.mjs} +12 -9
- package/dist/{NativeMemoryManager.impl-dZtA1ZGn.mjs → NativeMemoryManager.impl-D9Lkovvn.mjs} +13 -10
- package/dist/{NativeMemoryManager.utils-B-FjA2mJ.mjs → NativeMemoryManager.utils-BBlAixF5.mjs} +1 -1
- package/dist/{PEAnalyzer-D1lzJ_VG.mjs → PEAnalyzer-DMQ44gen.mjs} +15 -15
- package/dist/{PageController-Bqm2kZ_X.mjs → PageController-BPJNqqBN.mjs} +18 -4
- package/dist/{PointerChainEngine-BOhyVsjx.mjs → PointerChainEngine-K7wN8Z-w.mjs} +10 -7
- package/dist/ProcessRegistry-zGg12QbE.mjs +74 -0
- package/dist/{ResponseBuilder-D3iFYx2N.mjs → ResponseBuilder-CJXWmWNw.mjs} +10 -10
- package/dist/{ScriptManager-aHHq0X7U.mjs → ScriptManager-ZuWD-0Jg.mjs} +195 -192
- package/dist/{Speedhack-CqdIFlQl.mjs → Speedhack-D-z0umeT.mjs} +2 -2
- package/dist/{StructureAnalyzer-DhFaPvRO.mjs → StructureAnalyzer-Cav5AVSL.mjs} +9 -6
- package/dist/{ToolCatalog-C0JGZoOm.mjs → ToolCatalog-5OJdMiF0.mjs} +81 -81
- package/dist/{ToolProbe-oC7aPrkv.mjs → ToolProbe-DbCFGyrg.mjs} +1 -1
- package/dist/{ToolRegistry-BjaF4oNz.mjs → ToolRegistry-B9krbTtI.mjs} +51 -2
- package/dist/{ToolRouter.policy-BWV67ZK-.mjs → ToolRouter.policy-BGDAGyeH.mjs} +60 -20
- package/dist/TraceRecorder-B41Z5XBj.mjs +1286 -0
- package/dist/{Win32API-CePkipZY.mjs → Win32API-C2kjj0ze.mjs} +18 -12
- package/dist/{Win32Debug-BvKs-gxc.mjs → Win32Debug-CKrGOTpo.mjs} +2 -2
- package/dist/{WorkflowEngine-CuvkZtWu.mjs → WorkflowEngine-DJ6M4opp.mjs} +226 -255
- package/dist/analysis-BHeJW2Nb.mjs +1234 -0
- package/dist/{antidebug-CqDTB_uk.mjs → antidebug-BRKeyt27.mjs} +3 -3
- package/dist/{artifactRetention-CFEprwPw.mjs → artifactRetention-CPXkUJXp.mjs} +13 -6
- package/dist/{artifacts-Bk2-_uPq.mjs → artifacts-DkfosXH3.mjs} +1 -1
- package/dist/authorization-schema-DRqyJMSk.mjs +31 -0
- package/dist/{binary-instrument-CXfpx6fT.mjs → binary-instrument--V3MAhJ4.mjs} +19 -27
- package/dist/bind-helpers-ClV34xdn.mjs +42 -0
- package/dist/{boringssl-inspector-BH2D3VKc.mjs → boringssl-inspector-Bo_LOLaS.mjs} +1 -1
- package/dist/{browser-BpOr5PEx.mjs → browser-Dx3_S2cG.mjs} +324 -37
- package/dist/capabilities-CcHlvWgK.mjs +33 -0
- package/dist/{constants-B0OANIBL.mjs → constants-CDZLOoVv.mjs} +18 -3
- package/dist/{coordination-qUbyF8KU.mjs → coordination-DgItD9DL.mjs} +2 -2
- package/dist/{debugger-gnKxRSN0.mjs → debugger-RS3RSAqs.mjs} +30 -13
- package/dist/definitions-BEoYofW5.mjs +47 -0
- package/dist/{definitions-bAhHQJq9.mjs → definitions-BRaefg3u.mjs} +11 -5
- package/dist/{definitions-DVGfrn7y.mjs → definitions-BbkvZkiv.mjs} +2 -2
- package/dist/definitions-BtWSHJ3o.mjs +17 -0
- package/dist/{definitions-BMfYXoNC.mjs → definitions-C1gCHO0i.mjs} +1 -1
- package/dist/{definitions-C1UvM5Iy.mjs → definitions-CDOg_b-l.mjs} +14 -2
- package/dist/definitions-CVPD9hzZ.mjs +54 -0
- package/dist/{definitions-Cke7zEb8.mjs → definitions-Cea8Lgl7.mjs} +1 -1
- package/dist/definitions-DAgIyjxM.mjs +10 -0
- package/dist/{definitions-B4rAvHNZ.mjs → definitions-DJA27nsL.mjs} +12 -9
- package/dist/{definitions-ClJLzsJQ.mjs → definitions-DKPFU3LW.mjs} +1 -1
- package/dist/{definitions-D3VsGcvz.mjs → definitions-DPRpZQ96.mjs} +7 -7
- package/dist/{definitions-B18eyf0B.mjs → definitions-DUE5gmdn.mjs} +1 -1
- package/dist/definitions-DYVjOtxa.mjs +26 -0
- package/dist/{definitions-BB_4jnmy.mjs → definitions-DcYLVLCo.mjs} +1 -1
- package/dist/{definitions-Beid2EB3.mjs → definitions-Pp5LI2H4.mjs} +1 -1
- package/dist/definitions-j9KdHVNR.mjs +14 -0
- package/dist/definitions-uzkjBwa7.mjs +258 -0
- package/dist/{definitions-Cq-zroAU.mjs → definitions-va-AnLuQ.mjs} +4 -4
- package/dist/{encoding-Bvz5jLRv.mjs → encoding-DJeqHmpd.mjs} +18 -4
- package/dist/{evidence-graph-bridge-C_fv9PuC.mjs → evidence-graph-bridge-DcYizFk2.mjs} +1 -0
- package/dist/{factory-DxlGh9Xf.mjs → factory-C90tBff6.mjs} +6 -6
- package/dist/flat-target-session-Dgax2Cy3.mjs +29 -0
- package/dist/{graphql-DYWzJ29s.mjs → graphql-CoHrhweh.mjs} +205 -34
- package/dist/{handlers-C67ktuRN.mjs → handlers-4jmR0nMs.mjs} +220 -32
- package/dist/{handlers-DlCJN4Td.mjs → handlers-BAHPxcch.mjs} +122 -90
- package/dist/{handlers-9sAbfIg-.mjs → handlers-BOs9b907.mjs} +849 -801
- package/dist/{handlers-DxGIq15_2.mjs → handlers-BWXEy6ef.mjs} +16 -16
- package/dist/{handlers-tB9Mp9ZK.mjs → handlers-Bndn6QvE.mjs} +31 -4
- package/dist/{handlers-CTsDAO6p.mjs → handlers-BqC4bD4s.mjs} +1 -1
- package/dist/{handlers-C87g8oCe.mjs → handlers-BtYq60bM2.mjs} +1 -1
- package/dist/{handlers-DeLOCd5m.mjs → handlers-BzgcB4iv.mjs} +17 -17
- package/dist/{handlers-Cgyg6c0U.mjs → handlers-CRyRWj2b.mjs} +237 -23
- package/dist/{handlers-U6L4xhuF.mjs → handlers-CVv2H1uq.mjs} +24 -17
- package/dist/{handlers-tiy7EIBp.mjs → handlers-Dl5a7JS4.mjs} +3 -3
- package/dist/{handlers-D6j6yka7.mjs → handlers-Dx2d7jt7.mjs} +1893 -1480
- package/dist/{handlers-Bl8zkwz1.mjs → handlers-Dz9PYsCa.mjs} +95 -6
- package/dist/handlers-HujRKC3b.mjs +661 -0
- package/dist/{handlers.impl-DS0d9fUw.mjs → handlers.impl-XWXkQfyi.mjs} +70 -24
- package/dist/{hooks-CzCWByww.mjs → hooks-B1B8NRHL.mjs} +3 -3
- package/dist/index.mjs +154 -144
- package/dist/{maintenance-P7ePRXQC.mjs → maintenance-PRMkLVRW.mjs} +35 -30
- package/dist/manifest-67Bok-Si.mjs +58 -0
- package/dist/{manifest-B3QVVeBS.mjs → manifest-6lNTMZAB2.mjs} +33 -28
- package/dist/manifest-B2duEHiH.mjs +90 -0
- package/dist/manifest-B6EY9Vm8.mjs +57 -0
- package/dist/{manifest-gZ4s_UtG.mjs → manifest-B6nKSbyY.mjs} +32 -33
- package/dist/{manifest-2ToTpjv8.mjs → manifest-BL8AQNPF.mjs} +31 -31
- package/dist/{manifest-DzwvxPJX.mjs → manifest-BSZvJJmV.mjs} +23 -14
- package/dist/{manifest-Sc_0JQ13.mjs → manifest-BU7qzUyX.mjs} +23 -23
- package/dist/{manifest-CT7zZBV1.mjs → manifest-Bl62e8WK.mjs} +24 -23
- package/dist/manifest-Bo5cXjdt.mjs +82 -0
- package/dist/manifest-BpS4gtUK.mjs +1347 -0
- package/dist/manifest-Bv65_e2W.mjs +101 -0
- package/dist/manifest-BytNIF4Z.mjs +117 -0
- package/dist/{manifest-BqrQ4Tpj.mjs → manifest-C-xtsjS3.mjs} +23 -23
- package/dist/{manifest-NXctwWQq.mjs → manifest-CDYl7OhA.mjs} +36 -38
- package/dist/manifest-CRZ3xmkD.mjs +61 -0
- package/dist/manifest-CoW6u4Tp.mjs +132 -0
- package/dist/manifest-Cq5zN_8A.mjs +50 -0
- package/dist/{manifest-CAhOuvSl.mjs → manifest-D7YZM_2e.mjs} +75 -85
- package/dist/{manifest-DCyjf4n2.mjs → manifest-DE_VrAeQ.mjs} +27 -7
- package/dist/manifest-DGsXSCpT.mjs +39 -0
- package/dist/{manifest-BB2J8IMJ.mjs → manifest-DJ2vfEuW.mjs} +48 -41
- package/dist/{manifest-3g71z6Bg.mjs → manifest-DPXDYhEu.mjs} +26 -25
- package/dist/manifest-Dd4fQb0a.mjs +322 -0
- package/dist/{manifest-CXsRWjjI.mjs → manifest-Deq6opGg.mjs} +95 -96
- package/dist/{manifest-C9RT5nk32.mjs → manifest-DfJTafJK.mjs} +14 -11
- package/dist/manifest-DgOdgN_j.mjs +50 -0
- package/dist/{manifest-BmtZzQiQ2.mjs → manifest-DlbMW4v4.mjs} +17 -15
- package/dist/{manifest-DrbmZcFl2.mjs → manifest-DmVfbH0w.mjs} +212 -91
- package/dist/manifest-Dog6Ddjr.mjs +109 -0
- package/dist/manifest-DvgU5FWb.mjs +58 -0
- package/dist/manifest-HsfDBs7j.mjs +50 -0
- package/dist/manifest-I8oQHvCG.mjs +186 -0
- package/dist/manifest-NvH_a-av.mjs +786 -0
- package/dist/{manifest-Dh8WBmEW.mjs → manifest-cEJU1v0Z.mjs} +24 -24
- package/dist/manifest-wOl5XLB12.mjs +112 -0
- package/dist/{modules-C184v-S9.mjs → modules-tZozf0LQ.mjs} +130 -860
- package/dist/{mojo-ipc-B_H61Afw.mjs → mojo-ipc-DXNEXEqb.mjs} +141 -26
- package/dist/{network-671Cw6hV.mjs → network-CPVvwvFg.mjs} +1329 -823
- package/dist/{outputPaths-B1uGmrWZ.mjs → outputPaths-um7lCRY3.mjs} +4 -8
- package/dist/{platform-WmNn8Sxb.mjs → platform-CYeFoTWp.mjs} +101 -10
- package/dist/{process-QcbIy5Zq.mjs → process-BTbgcVc6.mjs} +251 -346
- package/dist/{proxy-DqNs0bAd.mjs → proxy-r8YN6nP1.mjs} +30 -8
- package/dist/{registry-D-6e18lB.mjs → registry-Bl8ZQW61.mjs} +3 -3
- package/dist/{response-BQVP-xUn.mjs → response-CWhh2aLo.mjs} +7 -1
- package/dist/{shared-state-board-DV-dpHFJ.mjs → shared-state-board-BoZnSoj-.mjs} +2 -2
- package/dist/{sourcemap-Dq8ez8vS.mjs → sourcemap-BIDHUVXy.mjs} +350 -66
- package/dist/{streaming-BUQ0VJsg.mjs → streaming-Dal6utPp.mjs} +13 -13
- package/dist/{tool-builder-DCbIC5Eo.mjs → tool-builder-BHJp32mV.mjs} +1 -1
- package/dist/{transform-CiYJfNX0.mjs → transform-DRVgGG90.mjs} +18 -14
- package/dist/wasm-BYx5UOeG.mjs +1044 -0
- package/dist/webcrack-Be0_FccV.mjs +747 -0
- package/dist/{workflow-f3xJOcjx.mjs → workflow-BpuKEtvn.mjs} +8 -8
- package/package.json +76 -43
- package/dist/TraceRecorder-DgxyVbdQ.mjs +0 -519
- package/dist/analysis-CL9uACt9.mjs +0 -463
- package/dist/bind-helpers-xFfRF-qm.mjs +0 -22
- package/dist/definitions-6M-eejaT.mjs +0 -53
- package/dist/definitions-B3QdlrHv.mjs +0 -34
- package/dist/definitions-CXEI7QC72.mjs +0 -216
- package/dist/definitions-C_4r7Fo-2.mjs +0 -14
- package/dist/definitions-CkFDALoa.mjs +0 -26
- package/dist/definitions-Cy3Sl6gV.mjs +0 -34
- package/dist/definitions-LKpC3-nL.mjs +0 -9
- package/dist/handlers-DdFzXLvF.mjs +0 -446
- package/dist/manifest-82baTv4U.mjs +0 -45
- package/dist/manifest-BKbgbSiY.mjs +0 -60
- package/dist/manifest-Bcf-TJzH.mjs +0 -848
- package/dist/manifest-Bnd7kqEY.mjs +0 -55
- package/dist/manifest-BqQX6OQC2.mjs +0 -65
- package/dist/manifest-Br4RPFt5.mjs +0 -370
- package/dist/manifest-C5qDjysN.mjs +0 -107
- package/dist/manifest-CBYWCUBJ.mjs +0 -51
- package/dist/manifest-CFADCRa1.mjs +0 -37
- package/dist/manifest-CQVhavRF.mjs +0 -114
- package/dist/manifest-CV12bcrF.mjs +0 -121
- package/dist/manifest-CZLUCfG02.mjs +0 -95
- package/dist/manifest-D6phHKFd.mjs +0 -131
- package/dist/manifest-DHsnKgP6.mjs +0 -60
- package/dist/manifest-Df_dliIe.mjs +0 -55
- package/dist/manifest-DhKRAT8_.mjs +0 -92
- package/dist/manifest-DlpTj4ic2.mjs +0 -193
- package/dist/manifest-DuwHjUa5.mjs +0 -70
- package/dist/manifest-qSleDqdO.mjs +0 -1023
- package/dist/wasm-DQTnHDs4.mjs +0 -531
- /package/dist/{CacheAdapters-CDe5WPSV.mjs → CacheAdapters-jJFy20G-.mjs} +0 -0
- /package/dist/{DarwinAPI-BNPxu0RH.mjs → DarwinAPI-ETyy0xyo.mjs} +0 -0
- /package/dist/{EventBus-DgPmwpeu.mjs → EventBus-DFKvADm3.mjs} +0 -0
- /package/dist/{EvidenceGraphBridge-SFesNera.mjs → EvidenceGraphBridge-318Oi0Lf.mjs} +0 -0
- /package/dist/{FingerprintManager-gzWtkKuf.mjs → FingerprintManager-BN4UQWnX.mjs} +0 -0
- /package/dist/{PrerequisiteError-Dl33Svkz.mjs → PrerequisiteError-TuyZIs6n.mjs} +0 -0
- /package/dist/{ReverseEvidenceGraph-Dlsk94LC.mjs → ReverseEvidenceGraph-C02-gXOh.mjs} +0 -0
- /package/dist/{StealthVerifier-Bo4T3bz8.mjs → StealthVerifier-BWmPgQsv.mjs} +0 -0
- /package/dist/{VersionDetector-CwVLVdDM.mjs → VersionDetector-K3V4vGsw.mjs} +0 -0
- /package/dist/{betterSqlite3-0pqusHHH.mjs → betterSqlite3-DLSBZodi.mjs} +0 -0
- /package/dist/{concurrency-Bt0yv1kJ.mjs → concurrency-Drev_Vz9.mjs} +0 -0
- /package/dist/{formatAddress-DVkj9kpI.mjs → formatAddress-nnMvEohD.mjs} +0 -0
- /package/dist/{parse-args-BlRjqlkL.mjs → parse-args-B4cY5Vx5.mjs} +0 -0
- /package/dist/{ssrf-policy-ZaUfvhq7.mjs → ssrf-policy-Dsqd-DTX.mjs} +0 -0
- /package/dist/{types-CPhOReNX.mjs → types-DDBWs9UP.mjs} +0 -0
|
@@ -1,463 +0,0 @@
|
|
|
1
|
-
import { t as logger } from "./logger-Dh_xb7_2.mjs";
|
|
2
|
-
import { d as ANALYSIS_MAX_SAFE_RESPONSE_BYTES, f as ANALYSIS_MAX_SUMMARY_FILES, u as ANALYSIS_MAX_SAFE_COLLECTED_BYTES } from "./constants-B0OANIBL.mjs";
|
|
3
|
-
import { i as serializeError, n as asJsonResponse, r as asTextResponse, t as asErrorResponse } from "./response-BQVP-xUn.mjs";
|
|
4
|
-
import { s as runWebcrack } from "./modules-C184v-S9.mjs";
|
|
5
|
-
import { a as argString, i as argObject, n as argEnum, r as argNumber, s as argStringRequired, t as argBool } from "./parse-args-BlRjqlkL.mjs";
|
|
6
|
-
import { s as evaluateWithTimeout } from "./PageController-Bqm2kZ_X.mjs";
|
|
7
|
-
import "./definitions-C1UvM5Iy.mjs";
|
|
8
|
-
//#region src/server/domains/analysis/handlers.web-tools.ts
|
|
9
|
-
const MAX_WEBPACK_MODULES = 100;
|
|
10
|
-
async function runWebpackEnumerate(collector, args) {
|
|
11
|
-
const searchKeyword = argString(args, "searchKeyword", "");
|
|
12
|
-
const forceRequireAll = argBool(args, "forceRequireAll", !!searchKeyword);
|
|
13
|
-
const maxResults = Math.min(argNumber(args, "maxResults", 20), MAX_WEBPACK_MODULES);
|
|
14
|
-
try {
|
|
15
|
-
const result = await evaluateWithTimeout(await collector.getActivePage(), async (opts) => {
|
|
16
|
-
const w = window;
|
|
17
|
-
let requireFn = null;
|
|
18
|
-
if (typeof w["__webpack_require__"] === "function") requireFn = w["__webpack_require__"];
|
|
19
|
-
const chunkKeys = Object.keys(w).filter((k) => k.startsWith("webpackChunk") || k.startsWith("webpackJsonp"));
|
|
20
|
-
const moduleIdSet = /* @__PURE__ */ new Set();
|
|
21
|
-
for (const key of chunkKeys) {
|
|
22
|
-
const arr = w[key];
|
|
23
|
-
if (!Array.isArray(arr)) continue;
|
|
24
|
-
const arrWithM = arr;
|
|
25
|
-
if (arrWithM.m && typeof arrWithM.m === "object") for (const id of Object.keys(arrWithM.m)) moduleIdSet.add(id);
|
|
26
|
-
for (const chunk of arr) if (Array.isArray(chunk) && chunk[1] && typeof chunk[1] === "object") for (const id of Object.keys(chunk[1])) moduleIdSet.add(id);
|
|
27
|
-
}
|
|
28
|
-
if (typeof w["__webpack_modules__"] === "object" && w["__webpack_modules__"]) for (const id of Object.keys(w["__webpack_modules__"])) moduleIdSet.add(id);
|
|
29
|
-
if (!requireFn) for (const key of chunkKeys) {
|
|
30
|
-
const arr = w[key];
|
|
31
|
-
if (arr?.m && typeof arr.m === "object") {
|
|
32
|
-
const mods = arr.m;
|
|
33
|
-
requireFn = (id) => {
|
|
34
|
-
try {
|
|
35
|
-
const fn = mods[id];
|
|
36
|
-
return typeof fn === "function" ? fn() : fn;
|
|
37
|
-
} catch {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
break;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
const allIds = Array.from(moduleIdSet);
|
|
45
|
-
if (!opts.forceRequireAll || !requireFn) return {
|
|
46
|
-
total: allIds.length,
|
|
47
|
-
requireFound: !!requireFn,
|
|
48
|
-
chunkKeys,
|
|
49
|
-
moduleIds: allIds.slice(0, 200),
|
|
50
|
-
matches: []
|
|
51
|
-
};
|
|
52
|
-
const fn = requireFn;
|
|
53
|
-
const matches = [];
|
|
54
|
-
for (const id of allIds) {
|
|
55
|
-
if (matches.length >= opts.maxResults) break;
|
|
56
|
-
try {
|
|
57
|
-
const mod = fn(id);
|
|
58
|
-
if (mod === void 0 || mod === null) continue;
|
|
59
|
-
let str;
|
|
60
|
-
try {
|
|
61
|
-
str = JSON.stringify(mod);
|
|
62
|
-
} catch {
|
|
63
|
-
str = String(mod);
|
|
64
|
-
}
|
|
65
|
-
if (!opts.searchKeyword || str.toLowerCase().includes(opts.searchKeyword.toLowerCase())) matches.push({
|
|
66
|
-
id,
|
|
67
|
-
preview: str.slice(0, 600)
|
|
68
|
-
});
|
|
69
|
-
} catch {}
|
|
70
|
-
}
|
|
71
|
-
return {
|
|
72
|
-
total: allIds.length,
|
|
73
|
-
requireFound: true,
|
|
74
|
-
chunkKeys,
|
|
75
|
-
moduleIds: allIds.slice(0, 200),
|
|
76
|
-
matches
|
|
77
|
-
};
|
|
78
|
-
}, {
|
|
79
|
-
searchKeyword,
|
|
80
|
-
forceRequireAll,
|
|
81
|
-
maxResults
|
|
82
|
-
});
|
|
83
|
-
logger.info(`webpack_enumerate: found ${result.total} modules, ${result.matches.length} matches`);
|
|
84
|
-
return asJsonResponse(result);
|
|
85
|
-
} catch (error) {
|
|
86
|
-
return asErrorResponse(error);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
//#endregion
|
|
90
|
-
//#region src/server/domains/analysis/handlers.impl.ts
|
|
91
|
-
const SMART_MODES = new Set([
|
|
92
|
-
"summary",
|
|
93
|
-
"priority",
|
|
94
|
-
"incremental",
|
|
95
|
-
"full"
|
|
96
|
-
]);
|
|
97
|
-
const FOCUS_MODES = new Set([
|
|
98
|
-
"structure",
|
|
99
|
-
"business",
|
|
100
|
-
"security",
|
|
101
|
-
"all"
|
|
102
|
-
]);
|
|
103
|
-
const HOOK_TYPES = new Set([
|
|
104
|
-
"function",
|
|
105
|
-
"xhr",
|
|
106
|
-
"fetch",
|
|
107
|
-
"websocket",
|
|
108
|
-
"localstorage",
|
|
109
|
-
"cookie"
|
|
110
|
-
]);
|
|
111
|
-
const HOOK_ACTIONS = new Set([
|
|
112
|
-
"log",
|
|
113
|
-
"block",
|
|
114
|
-
"modify"
|
|
115
|
-
]);
|
|
116
|
-
var CoreAnalysisHandlers = class {
|
|
117
|
-
collector;
|
|
118
|
-
scriptManager;
|
|
119
|
-
deobfuscator;
|
|
120
|
-
advancedDeobfuscator;
|
|
121
|
-
obfuscationDetector;
|
|
122
|
-
analyzer;
|
|
123
|
-
cryptoDetector;
|
|
124
|
-
hookManager;
|
|
125
|
-
constructor(deps) {
|
|
126
|
-
this.collector = deps.collector;
|
|
127
|
-
this.scriptManager = deps.scriptManager;
|
|
128
|
-
this.deobfuscator = deps.deobfuscator;
|
|
129
|
-
this.advancedDeobfuscator = deps.advancedDeobfuscator;
|
|
130
|
-
this.obfuscationDetector = deps.obfuscationDetector;
|
|
131
|
-
this.analyzer = deps.analyzer;
|
|
132
|
-
this.cryptoDetector = deps.cryptoDetector;
|
|
133
|
-
this.hookManager = deps.hookManager;
|
|
134
|
-
}
|
|
135
|
-
requireCodeArg(args, toolName) {
|
|
136
|
-
const code = args.code;
|
|
137
|
-
if (typeof code !== "string" || code.trim().length === 0) {
|
|
138
|
-
logger.warn(`${toolName} called without valid code argument`);
|
|
139
|
-
return null;
|
|
140
|
-
}
|
|
141
|
-
return code;
|
|
142
|
-
}
|
|
143
|
-
extractWebcrackArgs(args) {
|
|
144
|
-
const extracted = {};
|
|
145
|
-
const unpack = argBool(args, "unpack");
|
|
146
|
-
const unminify = argBool(args, "unminify");
|
|
147
|
-
const jsx = argBool(args, "jsx");
|
|
148
|
-
const mangle = argBool(args, "mangle");
|
|
149
|
-
const forceOutput = argBool(args, "forceOutput");
|
|
150
|
-
const includeModuleCode = argBool(args, "includeModuleCode");
|
|
151
|
-
const outputDir = argString(args, "outputDir");
|
|
152
|
-
const maxBundleModules = argNumber(args, "maxBundleModules");
|
|
153
|
-
if (unpack !== void 0) extracted.unpack = unpack;
|
|
154
|
-
if (unminify !== void 0) extracted.unminify = unminify;
|
|
155
|
-
if (jsx !== void 0) extracted.jsx = jsx;
|
|
156
|
-
if (mangle !== void 0) extracted.mangle = mangle;
|
|
157
|
-
if (forceOutput !== void 0) extracted.forceOutput = forceOutput;
|
|
158
|
-
if (includeModuleCode !== void 0) extracted.includeModuleCode = includeModuleCode;
|
|
159
|
-
if (outputDir?.trim()) extracted.outputDir = outputDir;
|
|
160
|
-
if (maxBundleModules !== void 0) extracted.maxBundleModules = maxBundleModules;
|
|
161
|
-
if (Array.isArray(args.mappings)) extracted.mappings = args.mappings.filter((item) => typeof item === "object" && item !== null && typeof item.path === "string" && typeof item.pattern === "string");
|
|
162
|
-
return extracted;
|
|
163
|
-
}
|
|
164
|
-
async handleCollectCode(args) {
|
|
165
|
-
const returnSummaryOnly = argBool(args, "returnSummaryOnly", false);
|
|
166
|
-
let smartMode = argEnum(args, "smartMode", SMART_MODES);
|
|
167
|
-
const maxSummaryFiles = ANALYSIS_MAX_SUMMARY_FILES;
|
|
168
|
-
const summarizeFiles = (files) => files.slice(0, maxSummaryFiles).map((file) => ({
|
|
169
|
-
url: file.url,
|
|
170
|
-
type: file.type,
|
|
171
|
-
size: file.size,
|
|
172
|
-
sizeKB: (file.size / 1024).toFixed(2),
|
|
173
|
-
truncated: file.metadata?.truncated || false,
|
|
174
|
-
preview: `${file.content.substring(0, 200)}...`
|
|
175
|
-
}));
|
|
176
|
-
if (!smartMode) smartMode = returnSummaryOnly ? "summary" : "summary";
|
|
177
|
-
const result = await this.collector.collect({
|
|
178
|
-
url: argStringRequired(args, "url"),
|
|
179
|
-
includeInline: argBool(args, "includeInline"),
|
|
180
|
-
includeExternal: argBool(args, "includeExternal"),
|
|
181
|
-
includeDynamic: argBool(args, "includeDynamic"),
|
|
182
|
-
smartMode,
|
|
183
|
-
compress: argBool(args, "compress"),
|
|
184
|
-
maxTotalSize: argNumber(args, "maxTotalSize"),
|
|
185
|
-
maxFileSize: args.maxFileSize ? argNumber(args, "maxFileSize", 0) * 1024 : void 0,
|
|
186
|
-
priorities: args.priorities
|
|
187
|
-
});
|
|
188
|
-
if (returnSummaryOnly) return asJsonResponse({
|
|
189
|
-
mode: "summary",
|
|
190
|
-
totalSize: result.totalSize,
|
|
191
|
-
totalSizeKB: (result.totalSize / 1024).toFixed(2),
|
|
192
|
-
filesCount: result.files.length,
|
|
193
|
-
summarizedFiles: Math.min(result.files.length, maxSummaryFiles),
|
|
194
|
-
omittedFiles: Math.max(0, result.files.length - maxSummaryFiles),
|
|
195
|
-
collectTime: result.collectTime,
|
|
196
|
-
summary: summarizeFiles(result.files),
|
|
197
|
-
hint: "Use get_script_source for specific files."
|
|
198
|
-
});
|
|
199
|
-
const maxSafeCollectedSize = ANALYSIS_MAX_SAFE_COLLECTED_BYTES;
|
|
200
|
-
const maxSafeResponseSize = ANALYSIS_MAX_SAFE_RESPONSE_BYTES;
|
|
201
|
-
const estimatedResponseSize = Buffer.byteLength(JSON.stringify(result), "utf8");
|
|
202
|
-
if (result.totalSize > maxSafeCollectedSize || estimatedResponseSize > maxSafeResponseSize) {
|
|
203
|
-
logger.warn(`Collected code is too large (collected=${(result.totalSize / 1024).toFixed(2)}KB, response=${(estimatedResponseSize / 1024).toFixed(2)}KB), returning summary mode.`);
|
|
204
|
-
return asJsonResponse({
|
|
205
|
-
warning: "Code size exceeds safe response threshold; summary returned.",
|
|
206
|
-
totalSize: result.totalSize,
|
|
207
|
-
totalSizeKB: (result.totalSize / 1024).toFixed(2),
|
|
208
|
-
estimatedResponseSize,
|
|
209
|
-
estimatedResponseSizeKB: (estimatedResponseSize / 1024).toFixed(2),
|
|
210
|
-
filesCount: result.files.length,
|
|
211
|
-
summarizedFiles: Math.min(result.files.length, maxSummaryFiles),
|
|
212
|
-
omittedFiles: Math.max(0, result.files.length - maxSummaryFiles),
|
|
213
|
-
collectTime: result.collectTime,
|
|
214
|
-
summary: summarizeFiles(result.files),
|
|
215
|
-
recommendations: [
|
|
216
|
-
"Use get_script_source for targeted files.",
|
|
217
|
-
"Use more specific priority filters.",
|
|
218
|
-
"Use smartMode=summary for initial reconnaissance."
|
|
219
|
-
]
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
return asJsonResponse(result);
|
|
223
|
-
}
|
|
224
|
-
async handleSearchInScripts(args) {
|
|
225
|
-
await this.scriptManager.init();
|
|
226
|
-
const keyword = argString(args, "keyword");
|
|
227
|
-
if (!keyword) return asJsonResponse({
|
|
228
|
-
success: false,
|
|
229
|
-
error: "keyword is required"
|
|
230
|
-
});
|
|
231
|
-
const maxMatches = argNumber(args, "maxMatches", 100);
|
|
232
|
-
const returnSummary = argBool(args, "returnSummary", false);
|
|
233
|
-
const maxContextSize = argNumber(args, "maxContextSize", 5e4);
|
|
234
|
-
const result = await this.scriptManager.searchInScripts(keyword, {
|
|
235
|
-
isRegex: argBool(args, "isRegex"),
|
|
236
|
-
caseSensitive: argBool(args, "caseSensitive"),
|
|
237
|
-
contextLines: argNumber(args, "contextLines"),
|
|
238
|
-
maxMatches
|
|
239
|
-
});
|
|
240
|
-
const resultSize = JSON.stringify(result).length;
|
|
241
|
-
if (returnSummary || resultSize > maxContextSize) {
|
|
242
|
-
const matches = result.matches ?? [];
|
|
243
|
-
return asJsonResponse({
|
|
244
|
-
success: true,
|
|
245
|
-
keyword: args.keyword,
|
|
246
|
-
totalMatches: matches.length,
|
|
247
|
-
resultSize,
|
|
248
|
-
resultSizeKB: (resultSize / 1024).toFixed(2),
|
|
249
|
-
truncated: resultSize > maxContextSize,
|
|
250
|
-
reason: resultSize > maxContextSize ? `Result too large (${(resultSize / 1024).toFixed(2)}KB > ${(maxContextSize / 1024).toFixed(2)}KB)` : "Summary mode enabled",
|
|
251
|
-
matchesSummary: matches.slice(0, 10).map((match) => ({
|
|
252
|
-
scriptId: match.scriptId,
|
|
253
|
-
url: match.url,
|
|
254
|
-
line: match.line,
|
|
255
|
-
preview: `${(match.context ?? "").substring(0, 100)}...`
|
|
256
|
-
})),
|
|
257
|
-
recommendations: [
|
|
258
|
-
"Use more specific keywords.",
|
|
259
|
-
`Reduce maxMatches (current: ${maxMatches}).`,
|
|
260
|
-
"Use get_script_source for targeted file retrieval."
|
|
261
|
-
]
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
return asJsonResponse(result);
|
|
265
|
-
}
|
|
266
|
-
async handleExtractFunctionTree(args) {
|
|
267
|
-
const scriptId = argString(args, "scriptId");
|
|
268
|
-
const functionName = argString(args, "functionName");
|
|
269
|
-
if (!scriptId) return asJsonResponse({
|
|
270
|
-
success: false,
|
|
271
|
-
error: "scriptId is required",
|
|
272
|
-
hint: "Use get_all_scripts() to list available scripts and their scriptIds"
|
|
273
|
-
});
|
|
274
|
-
if (!functionName) return asJsonResponse({
|
|
275
|
-
success: false,
|
|
276
|
-
error: "functionName is required",
|
|
277
|
-
hint: "Specify the name of the function to extract"
|
|
278
|
-
});
|
|
279
|
-
await this.scriptManager.init();
|
|
280
|
-
const scripts = await this.scriptManager.getAllScripts();
|
|
281
|
-
if (!scripts.some((s) => String(s.scriptId) === String(scriptId))) {
|
|
282
|
-
const availableScripts = scripts.slice(0, 10).map((s) => ({
|
|
283
|
-
scriptId: s.scriptId,
|
|
284
|
-
url: s.url?.substring(0, 80)
|
|
285
|
-
}));
|
|
286
|
-
return asJsonResponse({
|
|
287
|
-
success: false,
|
|
288
|
-
error: `Script not found: ${scriptId}`,
|
|
289
|
-
hint: "The specified scriptId does not exist. Use get_all_scripts() to list available scripts.",
|
|
290
|
-
availableScripts: availableScripts.length > 0 ? availableScripts : "No scripts loaded. Navigate to a page first.",
|
|
291
|
-
totalScripts: scripts.length
|
|
292
|
-
});
|
|
293
|
-
}
|
|
294
|
-
try {
|
|
295
|
-
return asJsonResponse({
|
|
296
|
-
success: true,
|
|
297
|
-
...await this.scriptManager.extractFunctionTree(scriptId, functionName, {
|
|
298
|
-
maxDepth: argNumber(args, "maxDepth"),
|
|
299
|
-
maxSize: argNumber(args, "maxSize"),
|
|
300
|
-
includeComments: argBool(args, "includeComments")
|
|
301
|
-
})
|
|
302
|
-
});
|
|
303
|
-
} catch (error) {
|
|
304
|
-
return asJsonResponse({
|
|
305
|
-
success: false,
|
|
306
|
-
error: error instanceof Error ? error.message : String(error),
|
|
307
|
-
hint: "Make sure the function name exists in the specified script"
|
|
308
|
-
});
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
async handleDeobfuscate(args) {
|
|
312
|
-
const code = this.requireCodeArg(args, "deobfuscate");
|
|
313
|
-
if (!code) return asJsonResponse({
|
|
314
|
-
success: false,
|
|
315
|
-
error: "code is required and must be a non-empty string"
|
|
316
|
-
});
|
|
317
|
-
if (argEnum(args, "engine", new Set(["auto", "webcrack"]), "auto") === "webcrack") return asJsonResponse(await this.advancedDeobfuscator.deobfuscate({
|
|
318
|
-
code,
|
|
319
|
-
...this.extractWebcrackArgs(args),
|
|
320
|
-
...typeof args.detectOnly === "boolean" ? { detectOnly: args.detectOnly } : {},
|
|
321
|
-
...typeof args.aggressiveVM === "boolean" ? { aggressiveVM: args.aggressiveVM } : {},
|
|
322
|
-
...typeof args.useASTOptimization === "boolean" ? { useASTOptimization: args.useASTOptimization } : {},
|
|
323
|
-
...typeof args.timeout === "number" ? { timeout: args.timeout } : {}
|
|
324
|
-
}));
|
|
325
|
-
const result = await this.deobfuscator.deobfuscate({
|
|
326
|
-
code,
|
|
327
|
-
aggressive: argBool(args, "aggressive"),
|
|
328
|
-
...this.extractWebcrackArgs(args)
|
|
329
|
-
});
|
|
330
|
-
if (result && typeof result === "object" && "success" in result && result.success === false && !("error" in result)) return asJsonResponse({
|
|
331
|
-
...result,
|
|
332
|
-
error: result.reason || "deobfuscation failed"
|
|
333
|
-
});
|
|
334
|
-
return asJsonResponse(result);
|
|
335
|
-
}
|
|
336
|
-
async handleUnderstandCode(args) {
|
|
337
|
-
const code = this.requireCodeArg(args, "understand_code");
|
|
338
|
-
if (!code) return asJsonResponse({
|
|
339
|
-
success: false,
|
|
340
|
-
error: "code is required and must be a non-empty string"
|
|
341
|
-
});
|
|
342
|
-
return asJsonResponse(await this.analyzer.understand({
|
|
343
|
-
code,
|
|
344
|
-
context: argObject(args, "context"),
|
|
345
|
-
focus: argEnum(args, "focus", FOCUS_MODES, "all")
|
|
346
|
-
}));
|
|
347
|
-
}
|
|
348
|
-
async handleDetectCrypto(args) {
|
|
349
|
-
const code = this.requireCodeArg(args, "detect_crypto");
|
|
350
|
-
if (!code) return asJsonResponse({
|
|
351
|
-
success: false,
|
|
352
|
-
error: "code is required and must be a non-empty string"
|
|
353
|
-
});
|
|
354
|
-
return asJsonResponse(await this.cryptoDetector.detect({ code }));
|
|
355
|
-
}
|
|
356
|
-
async handleManageHooks(args) {
|
|
357
|
-
const action = argStringRequired(args, "action");
|
|
358
|
-
switch (action) {
|
|
359
|
-
case "create": return asJsonResponse(await this.hookManager.createHook({
|
|
360
|
-
target: argStringRequired(args, "target"),
|
|
361
|
-
type: argEnum(args, "type", HOOK_TYPES) ?? "function",
|
|
362
|
-
action: argEnum(args, "hookAction", HOOK_ACTIONS, "log"),
|
|
363
|
-
customCode: argString(args, "customCode")
|
|
364
|
-
}));
|
|
365
|
-
case "list": return asJsonResponse({ hooks: this.hookManager.getAllHooks() });
|
|
366
|
-
case "records": return asJsonResponse({ records: this.hookManager.getHookRecords(argStringRequired(args, "hookId")) });
|
|
367
|
-
case "clear":
|
|
368
|
-
this.hookManager.clearHookRecords(argString(args, "hookId"));
|
|
369
|
-
return asJsonResponse({
|
|
370
|
-
success: true,
|
|
371
|
-
message: "Hook records cleared"
|
|
372
|
-
});
|
|
373
|
-
default: return asJsonResponse({
|
|
374
|
-
success: false,
|
|
375
|
-
message: `Unknown hook action: ${action}. Valid actions: create, list, records, clear`
|
|
376
|
-
});
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
async handleDetectObfuscation(args) {
|
|
380
|
-
const code = this.requireCodeArg(args, "detect_obfuscation");
|
|
381
|
-
if (!code) return asJsonResponse({
|
|
382
|
-
success: false,
|
|
383
|
-
error: "code is required and must be a non-empty string"
|
|
384
|
-
});
|
|
385
|
-
const generateReport = argBool(args, "generateReport", true);
|
|
386
|
-
const result = this.obfuscationDetector.detect(code);
|
|
387
|
-
if (!generateReport) return asJsonResponse(result);
|
|
388
|
-
const report = this.obfuscationDetector.generateReport(result);
|
|
389
|
-
return asTextResponse(`${JSON.stringify(result, null, 2)}\n\n${report}`);
|
|
390
|
-
}
|
|
391
|
-
async handleWebcrackUnpack(args) {
|
|
392
|
-
const code = this.requireCodeArg(args, "webcrack_unpack");
|
|
393
|
-
if (!code) return asJsonResponse({
|
|
394
|
-
success: false,
|
|
395
|
-
error: "code is required and must be a non-empty string"
|
|
396
|
-
});
|
|
397
|
-
const result = await runWebcrack(code, {
|
|
398
|
-
unpack: argBool(args, "unpack", true),
|
|
399
|
-
unminify: argBool(args, "unminify", true),
|
|
400
|
-
jsx: argBool(args, "jsx", true),
|
|
401
|
-
mangle: argBool(args, "mangle", false),
|
|
402
|
-
...this.extractWebcrackArgs(args)
|
|
403
|
-
});
|
|
404
|
-
if (!result.applied) return asJsonResponse({
|
|
405
|
-
success: false,
|
|
406
|
-
error: result.reason || "webcrack execution failed",
|
|
407
|
-
optionsUsed: result.optionsUsed,
|
|
408
|
-
engine: "webcrack"
|
|
409
|
-
});
|
|
410
|
-
return asJsonResponse({
|
|
411
|
-
success: true,
|
|
412
|
-
code: result.code,
|
|
413
|
-
bundle: result.bundle,
|
|
414
|
-
savedTo: result.savedTo,
|
|
415
|
-
savedArtifacts: result.savedArtifacts,
|
|
416
|
-
optionsUsed: result.optionsUsed,
|
|
417
|
-
engine: "webcrack"
|
|
418
|
-
});
|
|
419
|
-
}
|
|
420
|
-
async handleWebpackEnumerate(args) {
|
|
421
|
-
return runWebpackEnumerate(this.collector, args);
|
|
422
|
-
}
|
|
423
|
-
async handleClearCollectedData() {
|
|
424
|
-
try {
|
|
425
|
-
await this.collector.clearAllData();
|
|
426
|
-
this.scriptManager.clear();
|
|
427
|
-
return asJsonResponse({
|
|
428
|
-
success: true,
|
|
429
|
-
message: "All collected data cleared.",
|
|
430
|
-
cleared: {
|
|
431
|
-
fileCache: true,
|
|
432
|
-
compressionCache: true,
|
|
433
|
-
collectedUrls: true,
|
|
434
|
-
scriptManager: true
|
|
435
|
-
}
|
|
436
|
-
});
|
|
437
|
-
} catch (error) {
|
|
438
|
-
logger.error("Failed to clear collected data:", error);
|
|
439
|
-
return asJsonResponse(serializeError(error));
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
async handleGetCollectionStats() {
|
|
443
|
-
try {
|
|
444
|
-
const stats = await this.collector.getAllStats();
|
|
445
|
-
return asJsonResponse({
|
|
446
|
-
success: true,
|
|
447
|
-
stats,
|
|
448
|
-
summary: {
|
|
449
|
-
totalCachedFiles: stats.cache.memoryEntries + stats.cache.diskEntries,
|
|
450
|
-
totalCacheSize: `${(stats.cache.totalSize / 1024).toFixed(2)} KB`,
|
|
451
|
-
compressionRatio: `${stats.compression.averageRatio.toFixed(1)}%`,
|
|
452
|
-
cacheHitRate: stats.compression.cacheHits > 0 ? `${(stats.compression.cacheHits / (stats.compression.cacheHits + stats.compression.cacheMisses) * 100).toFixed(1)}%` : "0%",
|
|
453
|
-
collectedUrls: stats.collector.collectedUrls
|
|
454
|
-
}
|
|
455
|
-
});
|
|
456
|
-
} catch (error) {
|
|
457
|
-
logger.error("Failed to get collection stats:", error);
|
|
458
|
-
return asJsonResponse(serializeError(error));
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
};
|
|
462
|
-
//#endregion
|
|
463
|
-
export { CoreAnalysisHandlers };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
//#region src/server/registry/bind-helpers.ts
|
|
2
|
-
/**
|
|
3
|
-
* Retrieve a dependency by key with a runtime guard.
|
|
4
|
-
* The caller specifies the expected type via the generic parameter.
|
|
5
|
-
*/
|
|
6
|
-
function getDep(deps, key) {
|
|
7
|
-
const value = deps[key];
|
|
8
|
-
if (!value) throw new Error(`[registry] Missing dependency: "${key}". Is the domain enabled?`);
|
|
9
|
-
return value;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Create a `bind` function that extracts the handler from `deps[depKey]`
|
|
13
|
-
* and delegates to `invoke(handler, args)`.
|
|
14
|
-
*
|
|
15
|
-
* This preserves full type safety within each manifest while the global
|
|
16
|
-
* deps container stays dynamically keyed.
|
|
17
|
-
*/
|
|
18
|
-
function bindByDepKey(depKey, invoke) {
|
|
19
|
-
return (deps) => (args) => invoke(getDep(deps, depKey), args);
|
|
20
|
-
}
|
|
21
|
-
//#endregion
|
|
22
|
-
export { getDep as n, bindByDepKey as t };
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { t as tool } from "./tool-builder-DCbIC5Eo.mjs";
|
|
2
|
-
//#region src/server/domains/platform/definitions.ts
|
|
3
|
-
const platformTools = [
|
|
4
|
-
tool("miniapp_pkg_scan", (t) => t.desc("扫描本地小程序缓存目录,列出所有 小程序包文件。默认扫描常见 Windows 路径。").string("searchPath", "可选。指定扫描根目录;不提供时使用默认路径(MiniApp/Cache 与 MiniApp/Plugin)。")),
|
|
5
|
-
tool("miniapp_pkg_unpack", (t) => t.desc("解包 小程序包文件。优先调用外部 外部解包工具,失败时自动降级为纯 Node.js 解析。").string("inputPath", "必填。小程序包文件路径。").string("outputDir", "可选。输出目录;不提供时自动生成 artifacts 临时目录。").required("inputPath")),
|
|
6
|
-
tool("miniapp_pkg_analyze", (t) => t.desc("分析解包后的小程序结构,提取 pages/subPackages/components/jsFiles/totalSize/appId。").string("unpackedDir", "必填。已解包目录路径。").required("unpackedDir")),
|
|
7
|
-
tool("asar_extract", (t) => t.desc("提取 Electron app.asar(纯 Node.js 实现,不依赖 @electron/asar)。支持仅列文件模式。").string("inputPath", "必填。asar 文件路径。").string("outputDir", "可选。提取目录;不提供时自动生成 artifacts 临时目录。").boolean("listOnly", "可选。默认 false;true 时仅列出文件清单,不执行提取。", { default: false }).required("inputPath")),
|
|
8
|
-
tool("electron_inspect_app", (t) => t.desc("分析 Electron 应用结构(.exe 或 app 目录):package.json、main、preload、dependencies、devToo...").string("appPath", "Path to Electron app (.exe or app directory)").required("appPath")),
|
|
9
|
-
tool("electron_scan_userdata", (t) => t.desc("扫描指定目录中的所有 JSON 文件,返回 raw 内容。适用于 Electron 应用的用户数据目录(Windows: %APPDATA%, macOS...").string("dirPath", "Directory path to scan for JSON files").number("maxFiles", "可选。最多读取的 JSON 文件数量。默认 20。", {
|
|
10
|
-
default: 20,
|
|
11
|
-
minimum: 1,
|
|
12
|
-
maximum: 1e4
|
|
13
|
-
}).number("maxFileSizeKB", "可选。单个文件大小上限(KB)。超限文件跳过。默认 1024。", {
|
|
14
|
-
default: 1024,
|
|
15
|
-
minimum: 1,
|
|
16
|
-
maximum: 102400
|
|
17
|
-
}).required("dirPath").query()),
|
|
18
|
-
tool("asar_search", (t) => t.desc("在 ASAR 归档内执行正则搜索。Agent 提供 pattern,工具返回匹配文件路径和行内容。").string("inputPath", "必填。ASAR 文件路径。").string("pattern", "必填。正则表达式字符串。").string("fileGlob", "可选。文件扩展名过滤。默认 *.js。", { default: "*.js" }).number("maxResults", "可选。最大返回匹配数。默认 100。", {
|
|
19
|
-
default: 100,
|
|
20
|
-
minimum: 1,
|
|
21
|
-
maximum: 1e4
|
|
22
|
-
}).required("inputPath", "pattern").query()),
|
|
23
|
-
tool("electron_check_fuses", (t) => t.desc("检测 Electron 可执行文件中的 fuse 配置状态(ASAR 完整性校验、RunAsNode 等)。").string("exePath", "必填。Electron .exe 文件路径。").required("exePath").query()),
|
|
24
|
-
tool("electron_patch_fuses", (t) => t.desc("Patch Electron binary fuses to enable/disable debug capabilities.").string("exePath", "Electron .exe file path").enum("profile", ["debug", "custom"], "Patch profile. \"debug\" enables debug-related fuses. \"custom\" requires a fuses object.", { default: "debug" }).object("fuses", {}, "For profile=\"custom\". Map of fuse names to ENABLE/DISABLE. E.g. {\"RunAsNode\": \"ENABLE\"}.").boolean("createBackup", "Create a .exe.bak backup before patching.", { default: true }).required("exePath").destructive()),
|
|
25
|
-
tool("v8_bytecode_decompile", (t) => t.desc("Decompile V8 bytecode (.jsc / bytenode) files. Uses view8 Python package for ...").string("filePath", "Path to .jsc bytecode file").required("filePath").query()),
|
|
26
|
-
tool("electron_launch_debug", (t) => t.desc("Launch Electron app with dual CDP debugging: --inspect for main process (Node...").string("exePath", "Electron .exe file path").number("mainPort", "Main process inspect port.", {
|
|
27
|
-
default: 9229,
|
|
28
|
-
minimum: 1,
|
|
29
|
-
maximum: 65535
|
|
30
|
-
}).number("rendererPort", "Renderer remote debugging port.", {
|
|
31
|
-
default: 9222,
|
|
32
|
-
minimum: 1,
|
|
33
|
-
maximum: 65535
|
|
34
|
-
}).array("args", { type: "string" }, "Extra command-line arguments.").boolean("skipFuseCheck", "Skip fuse status check.", { default: false }).number("waitMs", "Milliseconds to wait for CDP ports.", {
|
|
35
|
-
default: 8e3,
|
|
36
|
-
minimum: 1e3,
|
|
37
|
-
maximum: 12e4
|
|
38
|
-
}).requiredOpenWorld("exePath")),
|
|
39
|
-
tool("electron_debug_status", (t) => t.desc("Check status of dual-CDP debug sessions launched by electron_launch_debug.").string("sessionId", "Optional. Check specific session. Omit to list all.").query()),
|
|
40
|
-
tool("electron_ipc_sniff", (t) => t.desc("Sniff Electron IPC messages by injecting hooks into ipcRenderer via CDP.").enum("action", [
|
|
41
|
-
"start",
|
|
42
|
-
"dump",
|
|
43
|
-
"stop",
|
|
44
|
-
"list",
|
|
45
|
-
"guide"
|
|
46
|
-
], "Action to perform.", { default: "guide" }).number("port", "Renderer CDP port (--remote-debugging-port).", {
|
|
47
|
-
default: 9222,
|
|
48
|
-
minimum: 1,
|
|
49
|
-
maximum: 65535
|
|
50
|
-
}).string("sessionId", "Session ID for dump/stop.").boolean("clear", "Clear captured messages after dump.", { default: true }).openWorld())
|
|
51
|
-
];
|
|
52
|
-
//#endregion
|
|
53
|
-
export { platformTools as t };
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { t as tool } from "./tool-builder-DCbIC5Eo.mjs";
|
|
2
|
-
//#region src/server/domains/shared-state-board/definitions.ts
|
|
3
|
-
const sharedStateBoardTools = [
|
|
4
|
-
tool("state_board", (t) => t.desc(`Unified shared state board for cross-agent key-value coordination.
|
|
5
|
-
|
|
6
|
-
Actions:
|
|
7
|
-
- set: Store a value (requires key, value)
|
|
8
|
-
- get: Retrieve a value (requires key)
|
|
9
|
-
- delete: Remove a value (requires key)
|
|
10
|
-
- list: List all entries (optional namespace filter)
|
|
11
|
-
- history: Get change log for a key (requires key)
|
|
12
|
-
- clear: Remove entries (optional namespace/keyPattern filter)`).enum("action", [
|
|
13
|
-
"set",
|
|
14
|
-
"get",
|
|
15
|
-
"delete",
|
|
16
|
-
"list",
|
|
17
|
-
"history",
|
|
18
|
-
"clear"
|
|
19
|
-
], "Operation to perform").string("key", "Key name (required for set/get/delete/history)").prop("value", {
|
|
20
|
-
type: "object",
|
|
21
|
-
description: "Value to store — any JSON-serializable type (action=set)"
|
|
22
|
-
}).string("namespace", "Namespace for key isolation (default: \"default\")").number("ttlSeconds", "TTL in seconds — value expires after this duration (action=set)").boolean("includeValues", "Include current values in list response (action=list)", { default: false }).number("limit", "Maximum history entries to return (action=history)", { default: 50 }).string("keyPattern", "Key pattern filter with * wildcard (action=clear)").required("action")),
|
|
23
|
-
tool("state_board_watch", (t) => t.desc("Watch a key or pattern for changes. This is a POLL-based watch — call state_board_watch with action=poll and the returned watchId to check for changes. No server-side push; the caller must poll periodically.").enum("action", [
|
|
24
|
-
"start",
|
|
25
|
-
"poll",
|
|
26
|
-
"stop"
|
|
27
|
-
], "Watch operation: start watching, poll for changes, or stop watching").string("key", "The key or pattern to watch (action=start)").string("namespace", "Optional namespace (default: \"default\")").number("pollIntervalMs", "Polling interval in ms (action=start, default: 1000)").string("watchId", "Watch ID to stop (action=stop)").required("action")),
|
|
28
|
-
tool("state_board_io", (t) => t.desc("Export or import state board entries.").enum("action", ["export", "import"], "IO operation").string("namespace", "Optional namespace filter for export / target namespace for import (default: all/\"default\")").string("keyPattern", "Optional key pattern filter for export (supports * wildcard)").prop("data", {
|
|
29
|
-
type: "object",
|
|
30
|
-
description: "Object with keys and values to import (action=import)"
|
|
31
|
-
}).boolean("overwrite", "Overwrite existing keys on import (default: false)").required("action"))
|
|
32
|
-
];
|
|
33
|
-
//#endregion
|
|
34
|
-
export { sharedStateBoardTools as t };
|