@jshookmcp/jshook 0.2.7 → 0.2.9

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.
Files changed (157) hide show
  1. package/README.md +36 -5
  2. package/README.zh.md +36 -5
  3. package/dist/{AntiCheatDetector-S8VRj-dD.mjs → AntiCheatDetector-BNk-EoBt.mjs} +3 -3
  4. package/dist/{CodeInjector-4Z3ngPoX.mjs → CodeInjector-Cq8q01kp.mjs} +5 -5
  5. package/dist/ConsoleMonitor-CPVQW1Y-.mjs +2201 -0
  6. package/dist/{DarwinAPI-B8hg_yhz.mjs → DarwinAPI-BNPxu0RH.mjs} +1 -1
  7. package/dist/DetailedDataManager-BQQcxh64.mjs +217 -0
  8. package/dist/EventBus-DgPmwpeu.mjs +141 -0
  9. package/dist/EvidenceGraphBridge-SFesNera.mjs +153 -0
  10. package/dist/{ExtensionManager-CZ6IveoV.mjs → ExtensionManager-CWYgw0YW.mjs} +13 -6
  11. package/dist/{FingerprintManager-BVxFJL2-.mjs → FingerprintManager-gzWtkKuf.mjs} +1 -1
  12. package/dist/{HardwareBreakpoint-DK1yjWkV.mjs → HardwareBreakpoint-B9gZCdFP.mjs} +3 -3
  13. package/dist/{HeapAnalyzer-CEbo10xU.mjs → HeapAnalyzer-BLDH0dCv.mjs} +4 -4
  14. package/dist/HookGeneratorBuilders.core.generators.storage-CtcdK78Q.mjs +639 -0
  15. package/dist/InstrumentationSession-CvPC7Jwy.mjs +244 -0
  16. package/dist/{MemoryController-DdtnBdD4.mjs → MemoryController-CbVdCIJF.mjs} +3 -3
  17. package/dist/{MemoryScanSession-RMixN3bX.mjs → MemoryScanSession-BsDZbLYm.mjs} +81 -78
  18. package/dist/{MemoryScanner-QjK4ld0B.mjs → MemoryScanner-Bcpml6II.mjs} +44 -18
  19. package/dist/{NativeMemoryManager.impl-CB6gJ0NM.mjs → NativeMemoryManager.impl-dZtA1ZGn.mjs} +14 -53
  20. package/dist/{NativeMemoryManager.utils-BML4q1ry.mjs → NativeMemoryManager.utils-B-FjA2mJ.mjs} +1 -1
  21. package/dist/{PEAnalyzer-CK0xe0Fs.mjs → PEAnalyzer-D1lzJ_VG.mjs} +2 -2
  22. package/dist/PageController-Bqm2kZ_X.mjs +417 -0
  23. package/dist/{PointerChainEngine-Cd73qu5b.mjs → PointerChainEngine-BOhyVsjx.mjs} +4 -4
  24. package/dist/PrerequisiteError-Dl33Svkz.mjs +20 -0
  25. package/dist/ResponseBuilder-D3iFYx2N.mjs +143 -0
  26. package/dist/ReverseEvidenceGraph-Dlsk94LC.mjs +269 -0
  27. package/dist/ScriptManager-aHHq0X7U.mjs +3000 -0
  28. package/dist/{Speedhack-CeF0XmEz.mjs → Speedhack-CqdIFlQl.mjs} +2 -2
  29. package/dist/{StructureAnalyzer-D4GkMduU.mjs → StructureAnalyzer-DhFaPvRO.mjs} +3 -3
  30. package/dist/ToolCatalog-C0JGZoOm.mjs +582 -0
  31. package/dist/ToolError-jh9whhMd.mjs +15 -0
  32. package/dist/ToolProbe-oC7aPrkv.mjs +45 -0
  33. package/dist/ToolRegistry-BjaF4oNz.mjs +131 -0
  34. package/dist/ToolRouter.policy-BWV67ZK-.mjs +304 -0
  35. package/dist/TraceRecorder-DgxyVbdQ.mjs +519 -0
  36. package/dist/{Win32API-Bc0QnQsN.mjs → Win32API-CePkipZY.mjs} +1 -1
  37. package/dist/{Win32Debug-DUHt9XUn.mjs → Win32Debug-BvKs-gxc.mjs} +2 -2
  38. package/dist/WorkflowEngine-CuvkZtWu.mjs +598 -0
  39. package/dist/analysis-CL9uACt9.mjs +463 -0
  40. package/dist/antidebug-CqDTB_uk.mjs +1081 -0
  41. package/dist/artifactRetention-CFEprwPw.mjs +591 -0
  42. package/dist/artifacts-Bk2-_uPq.mjs +59 -0
  43. package/dist/betterSqlite3-0pqusHHH.mjs +74 -0
  44. package/dist/binary-instrument-CXfpx6fT.mjs +979 -0
  45. package/dist/bind-helpers-xFfRF-qm.mjs +22 -0
  46. package/dist/boringssl-inspector-BH2D3VKc.mjs +180 -0
  47. package/dist/browser-BpOr5PEx.mjs +4082 -0
  48. package/dist/concurrency-Bt0yv1kJ.mjs +41 -0
  49. package/dist/{constants-CCvsN80K.mjs → constants-B0OANIBL.mjs} +88 -46
  50. package/dist/coordination-qUbyF8KU.mjs +259 -0
  51. package/dist/debugger-gnKxRSN0.mjs +1271 -0
  52. package/dist/definitions-6M-eejaT.mjs +53 -0
  53. package/dist/definitions-B18eyf0B.mjs +18 -0
  54. package/dist/definitions-B3QdlrHv.mjs +34 -0
  55. package/dist/definitions-B4rAvHNZ.mjs +63 -0
  56. package/dist/definitions-BB_4jnmy.mjs +37 -0
  57. package/dist/definitions-BMfYXoNC.mjs +43 -0
  58. package/dist/definitions-Beid2EB3.mjs +27 -0
  59. package/dist/definitions-C1UvM5Iy.mjs +126 -0
  60. package/dist/definitions-CXEI7QC72.mjs +216 -0
  61. package/dist/definitions-C_4r7Fo-2.mjs +14 -0
  62. package/dist/definitions-CkFDALoa.mjs +26 -0
  63. package/dist/definitions-Cke7zEb8.mjs +94 -0
  64. package/dist/definitions-ClJLzsJQ.mjs +25 -0
  65. package/dist/definitions-Cq-zroAU.mjs +28 -0
  66. package/dist/definitions-Cy3Sl6gV.mjs +34 -0
  67. package/dist/definitions-D3VsGcvz.mjs +47 -0
  68. package/dist/definitions-DVGfrn7y.mjs +96 -0
  69. package/dist/definitions-LKpC3-nL.mjs +9 -0
  70. package/dist/definitions-bAhHQJq9.mjs +359 -0
  71. package/dist/encoding-Bvz5jLRv.mjs +1065 -0
  72. package/dist/evidence-graph-bridge-C_fv9PuC.mjs +135 -0
  73. package/dist/{factory-CibqTNC8.mjs → factory-DxlGh9Xf.mjs} +37 -52
  74. package/dist/graphql-DYWzJ29s.mjs +1026 -0
  75. package/dist/handlers-9sAbfIg-.mjs +2552 -0
  76. package/dist/handlers-Bl8zkwz1.mjs +2716 -0
  77. package/dist/handlers-C67ktuRN.mjs +710 -0
  78. package/dist/handlers-C87g8oCe.mjs +276 -0
  79. package/dist/handlers-CTsDAO6p.mjs +681 -0
  80. package/dist/handlers-Cgyg6c0U.mjs +645 -0
  81. package/dist/handlers-D6j6yka7.mjs +2124 -0
  82. package/dist/handlers-DdFzXLvF.mjs +446 -0
  83. package/dist/handlers-DeLOCd5m.mjs +799 -0
  84. package/dist/handlers-DlCJN4Td.mjs +757 -0
  85. package/dist/handlers-DxGIq15_2.mjs +917 -0
  86. package/dist/handlers-U6L4xhuF.mjs +585 -0
  87. package/dist/handlers-tB9Mp9ZK.mjs +84 -0
  88. package/dist/handlers-tiy7EIBp.mjs +572 -0
  89. package/dist/handlers.impl-DS0d9fUw.mjs +761 -0
  90. package/dist/hooks-CzCWByww.mjs +898 -0
  91. package/dist/index.mjs +384 -155
  92. package/dist/{logger-BmWzC2lM.mjs → logger-Dh_xb7_2.mjs} +14 -6
  93. package/dist/maintenance-P7ePRXQC.mjs +830 -0
  94. package/dist/manifest-2ToTpjv8.mjs +106 -0
  95. package/dist/manifest-3g71z6Bg.mjs +79 -0
  96. package/dist/manifest-82baTv4U.mjs +45 -0
  97. package/dist/manifest-B3QVVeBS.mjs +82 -0
  98. package/dist/manifest-BB2J8IMJ.mjs +149 -0
  99. package/dist/manifest-BKbgbSiY.mjs +60 -0
  100. package/dist/manifest-Bcf-TJzH.mjs +848 -0
  101. package/dist/manifest-BmtZzQiQ2.mjs +45 -0
  102. package/dist/manifest-Bnd7kqEY.mjs +55 -0
  103. package/dist/manifest-BqQX6OQC2.mjs +65 -0
  104. package/dist/manifest-BqrQ4Tpj.mjs +81 -0
  105. package/dist/manifest-Br4RPFt5.mjs +370 -0
  106. package/dist/manifest-C5qDjysN.mjs +107 -0
  107. package/dist/manifest-C9RT5nk32.mjs +34 -0
  108. package/dist/manifest-CAhOuvSl.mjs +204 -0
  109. package/dist/manifest-CBYWCUBJ.mjs +51 -0
  110. package/dist/manifest-CFADCRa1.mjs +37 -0
  111. package/dist/manifest-CQVhavRF.mjs +114 -0
  112. package/dist/manifest-CT7zZBV1.mjs +48 -0
  113. package/dist/manifest-CV12bcrF.mjs +121 -0
  114. package/dist/manifest-CXsRWjjI.mjs +224 -0
  115. package/dist/manifest-CZLUCfG02.mjs +95 -0
  116. package/dist/manifest-D6phHKFd.mjs +131 -0
  117. package/dist/manifest-DCyjf4n2.mjs +294 -0
  118. package/dist/manifest-DHsnKgP6.mjs +60 -0
  119. package/dist/manifest-Df_dliIe.mjs +55 -0
  120. package/dist/manifest-Dh8WBmEW.mjs +129 -0
  121. package/dist/manifest-DhKRAT8_.mjs +92 -0
  122. package/dist/manifest-DlpTj4ic2.mjs +193 -0
  123. package/dist/manifest-DrbmZcFl2.mjs +253 -0
  124. package/dist/manifest-DuwHjUa5.mjs +70 -0
  125. package/dist/manifest-DzwvxPJX.mjs +38 -0
  126. package/dist/manifest-NXctwWQq.mjs +68 -0
  127. package/dist/manifest-Sc_0JQ13.mjs +418 -0
  128. package/dist/manifest-gZ4s_UtG.mjs +96 -0
  129. package/dist/manifest-qSleDqdO.mjs +1023 -0
  130. package/dist/modules-C184v-S9.mjs +11365 -0
  131. package/dist/mojo-ipc-B_H61Afw.mjs +525 -0
  132. package/dist/network-671Cw6hV.mjs +3346 -0
  133. package/dist/{artifacts-BbdOMET5.mjs → outputPaths-B1uGmrWZ.mjs} +219 -212
  134. package/dist/parse-args-BlRjqlkL.mjs +39 -0
  135. package/dist/platform-WmNn8Sxb.mjs +2070 -0
  136. package/dist/process-QcbIy5Zq.mjs +1401 -0
  137. package/dist/proxy-DqNs0bAd.mjs +170 -0
  138. package/dist/registry-D-6e18lB.mjs +34 -0
  139. package/dist/response-BQVP-xUn.mjs +28 -0
  140. package/dist/server/plugin-api.mjs +2 -2
  141. package/dist/shared-state-board-DV-dpHFJ.mjs +586 -0
  142. package/dist/sourcemap-Dq8ez8vS.mjs +650 -0
  143. package/dist/ssrf-policy-ZaUfvhq7.mjs +166 -0
  144. package/dist/streaming-BUQ0VJsg.mjs +725 -0
  145. package/dist/tool-builder-DCbIC5Eo.mjs +186 -0
  146. package/dist/transform-CiYJfNX0.mjs +1007 -0
  147. package/dist/types-Bx92KJfT.mjs +4 -0
  148. package/dist/wasm-DQTnHDs4.mjs +531 -0
  149. package/dist/workflow-f3xJOcjx.mjs +725 -0
  150. package/package.json +48 -78
  151. package/dist/ExtensionManager-DqUSOamB.mjs +0 -2
  152. package/dist/ToolCatalog-CnwmMIw3.mjs +0 -61483
  153. package/dist/{CacheAdapters-CzFNpD9a.mjs → CacheAdapters-CDe5WPSV.mjs} +0 -0
  154. package/dist/{StealthVerifier-BzBCFiwx.mjs → StealthVerifier-Bo4T3bz8.mjs} +0 -0
  155. package/dist/{VersionDetector-CNXcvD46.mjs → VersionDetector-CwVLVdDM.mjs} +0 -0
  156. package/dist/{formatAddress-ChCSIRWT.mjs → formatAddress-DVkj9kpI.mjs} +0 -0
  157. package/dist/{types-BBjOqye-.mjs → types-CPhOReNX.mjs} +1 -1
@@ -0,0 +1,22 @@
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 };
@@ -0,0 +1,180 @@
1
+ import { t as __exportAll } from "./chunk-CjcI7cDX.mjs";
2
+ import { a as getTlsKeyLogDir } from "./outputPaths-B1uGmrWZ.mjs";
3
+ import { createDecipheriv, randomUUID } from "node:crypto";
4
+ import { existsSync, readFileSync } from "node:fs";
5
+ import { dirname, resolve } from "node:path";
6
+ import { mkdir, writeFile } from "node:fs/promises";
7
+ //#region src/modules/boringssl-inspector/TLSKeyLogExtractor.ts
8
+ const DEFAULT_KEYLOG_PREFIX = "jshook-boringssl";
9
+ function normalizeHex(value) {
10
+ return value.replace(/\s+/g, "").toUpperCase();
11
+ }
12
+ function isHex(value) {
13
+ return value.length > 0 && value.length % 2 === 0 && /^[0-9A-F]+$/i.test(value);
14
+ }
15
+ function parseOptionalTimestamp(token) {
16
+ if (!token) return;
17
+ const parsed = new Date(token);
18
+ if (Number.isNaN(parsed.valueOf())) return;
19
+ return parsed.toISOString();
20
+ }
21
+ function defaultKeyLogPath() {
22
+ return resolve(getTlsKeyLogDir(), `${DEFAULT_KEYLOG_PREFIX}-${randomUUID()}.log`);
23
+ }
24
+ function parseEntriesFromContent(content) {
25
+ const entries = [];
26
+ for (const rawLine of content.split(/\r?\n/)) {
27
+ const line = rawLine.trim();
28
+ if (line.length === 0 || line.startsWith("#")) continue;
29
+ const parts = line.split(/\s+/);
30
+ const label = parts[0];
31
+ const clientRandom = parts[1];
32
+ const secret = parts[2];
33
+ const timestamp = parseOptionalTimestamp(parts[3]);
34
+ if (!label || !clientRandom || !secret) continue;
35
+ const normalizedClientRandom = normalizeHex(clientRandom);
36
+ const normalizedSecret = normalizeHex(secret);
37
+ if (!isHex(normalizedClientRandom) || !isHex(normalizedSecret)) continue;
38
+ const entry = {
39
+ label,
40
+ clientRandom: normalizedClientRandom,
41
+ secret: normalizedSecret
42
+ };
43
+ if (timestamp) entry.timestamp = timestamp;
44
+ entries.push(entry);
45
+ }
46
+ return entries;
47
+ }
48
+ var TLSKeyLogExtractor = class {
49
+ keyLogPath;
50
+ cachedEntries = [];
51
+ secretByClientRandom = /* @__PURE__ */ new Map();
52
+ constructor(keyLogPath) {
53
+ this.keyLogPath = resolve(keyLogPath ?? defaultKeyLogPath());
54
+ }
55
+ async enableKeyLog() {
56
+ await mkdir(dirname(this.keyLogPath), { recursive: true });
57
+ await writeFile(this.keyLogPath, "", { flag: "a" });
58
+ process.env.SSLKEYLOGFILE = this.keyLogPath;
59
+ return this.keyLogPath;
60
+ }
61
+ async disableKeyLog() {
62
+ if (process.env.SSLKEYLOGFILE === this.keyLogPath) {
63
+ delete process.env.SSLKEYLOGFILE;
64
+ return;
65
+ }
66
+ delete process.env.SSLKEYLOGFILE;
67
+ }
68
+ getKeyLogFilePath() {
69
+ return this.keyLogPath;
70
+ }
71
+ parseKeyLog(path) {
72
+ const targetPath = resolve(path ?? this.keyLogPath);
73
+ if (!existsSync(targetPath)) {
74
+ this.cachedEntries = [];
75
+ this.secretByClientRandom.clear();
76
+ return [];
77
+ }
78
+ const entries = parseEntriesFromContent(readFileSync(targetPath, "utf8"));
79
+ this.cachedEntries = entries;
80
+ this.secretByClientRandom.clear();
81
+ for (const entry of entries) this.secretByClientRandom.set(entry.clientRandom, entry.secret);
82
+ return entries;
83
+ }
84
+ decryptPayload(encryptedHex, secrets) {
85
+ const normalizedPayload = normalizeHex(encryptedHex);
86
+ if (!isHex(normalizedPayload) || secrets.length === 0) return null;
87
+ if (!secrets.some((entry) => entry.secret.length > 0)) return null;
88
+ try {
89
+ return Buffer.from(normalizedPayload, "hex");
90
+ } catch {
91
+ return null;
92
+ }
93
+ }
94
+ summarizeKeyLog(path) {
95
+ const entries = this.parseKeyLog(path);
96
+ const entriesByLabel = {};
97
+ const timestamps = [];
98
+ for (const entry of entries) {
99
+ entriesByLabel[entry.label] = (entriesByLabel[entry.label] ?? 0) + 1;
100
+ if (entry.timestamp) timestamps.push(entry.timestamp);
101
+ }
102
+ timestamps.sort((left, right) => left.localeCompare(right));
103
+ const summary = {
104
+ totalEntries: entries.length,
105
+ entriesByLabel
106
+ };
107
+ if (timestamps.length > 0) {
108
+ const firstSeen = timestamps[0];
109
+ const lastSeen = timestamps[timestamps.length - 1];
110
+ if (firstSeen) summary.firstSeen = firstSeen;
111
+ if (lastSeen) summary.lastSeen = lastSeen;
112
+ }
113
+ return summary;
114
+ }
115
+ lookupSecret(clientRandom) {
116
+ const normalizedClientRandom = normalizeHex(clientRandom);
117
+ const cached = this.secretByClientRandom.get(normalizedClientRandom);
118
+ if (cached) return cached;
119
+ for (const entry of this.cachedEntries.length > 0 ? this.cachedEntries : this.parseKeyLog()) if (entry.clientRandom === normalizedClientRandom) return entry.secret;
120
+ return null;
121
+ }
122
+ };
123
+ const LEGACY_DEFAULT_PATH = "/tmp/sslkeylog.log";
124
+ function enableKeyLog(path = LEGACY_DEFAULT_PATH) {
125
+ process.env.SSLKEYLOGFILE = path;
126
+ return path;
127
+ }
128
+ function disableKeyLog() {
129
+ delete process.env.SSLKEYLOGFILE;
130
+ }
131
+ function getKeyLogFilePath() {
132
+ const configured = process.env.SSLKEYLOGFILE;
133
+ if (!configured || configured.trim().length === 0) return null;
134
+ return configured;
135
+ }
136
+ function parseKeyLog(contentOrPath) {
137
+ if (contentOrPath.length === 0) return [];
138
+ if (contentOrPath.includes("\n") || contentOrPath.includes("\r") || contentOrPath.includes("CLIENT_") || contentOrPath.trim().startsWith("#")) return parseEntriesFromContent(contentOrPath);
139
+ return new TLSKeyLogExtractor(contentOrPath).parseKeyLog();
140
+ }
141
+ function summarizeKeyLog(entries) {
142
+ const labels = [...new Set(entries.map((entry) => entry.label))];
143
+ const uniqueClients = new Set(entries.map((entry) => entry.clientRandom)).size;
144
+ const hasTrafficSecrets = entries.some((entry) => entry.label.includes("TRAFFIC_SECRET"));
145
+ return {
146
+ totalEntries: entries.length,
147
+ uniqueClients,
148
+ hasClientRandom: labels.includes("CLIENT_RANDOM"),
149
+ hasTrafficSecrets,
150
+ labels
151
+ };
152
+ }
153
+ function lookupSecret(entries, clientRandom, label) {
154
+ const normalizedClientRandom = normalizeHex(clientRandom);
155
+ const normalizedLabel = label?.trim();
156
+ for (const entry of entries) {
157
+ if (entry.clientRandom !== normalizedClientRandom) continue;
158
+ if (normalizedLabel && entry.label !== normalizedLabel) continue;
159
+ return entry.secret;
160
+ }
161
+ return null;
162
+ }
163
+ function decryptPayload(encryptedHex, keyHex, nonceHex, algorithm = "aes-256-gcm", authTagHex) {
164
+ try {
165
+ const encrypted = Buffer.from(normalizeHex(encryptedHex), "hex");
166
+ const decipher = createDecipheriv(algorithm, Buffer.from(normalizeHex(keyHex), "hex"), Buffer.from(normalizeHex(nonceHex), "hex"));
167
+ if (authTagHex) {
168
+ const maybeSetAuthTag = Reflect.get(decipher, "setAuthTag");
169
+ if (typeof maybeSetAuthTag === "function") maybeSetAuthTag.call(decipher, Buffer.from(normalizeHex(authTagHex), "hex"));
170
+ }
171
+ return Buffer.concat([decipher.update(encrypted), decipher.final()]).toString("utf8");
172
+ } catch {
173
+ return `DECRYPTION_FAILED:${algorithm}`;
174
+ }
175
+ }
176
+ //#endregion
177
+ //#region src/modules/boringssl-inspector/index.ts
178
+ var boringssl_inspector_exports = /* @__PURE__ */ __exportAll({ TLSKeyLogExtractor: () => TLSKeyLogExtractor });
179
+ //#endregion
180
+ export { enableKeyLog as a, parseKeyLog as c, disableKeyLog as i, summarizeKeyLog as l, TLSKeyLogExtractor as n, getKeyLogFilePath as o, decryptPayload as r, lookupSecret as s, boringssl_inspector_exports as t };