@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
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { t as tool } from "./tool-builder-BHJp32mV.mjs";
|
|
2
|
+
import { t as networkAuthorizationSchema } from "./authorization-schema-DRqyJMSk.mjs";
|
|
3
|
+
//#region src/server/domains/network/definitions/analysis-tools.ts
|
|
4
|
+
const analysisTools = [
|
|
5
|
+
tool("network_extract_auth", (t) => t.desc("Extract authentication data from captured network requests.").number("minConfidence", "Minimum confidence threshold 0-1", {
|
|
6
|
+
default: .4,
|
|
7
|
+
minimum: 0,
|
|
8
|
+
maximum: 1
|
|
9
|
+
})),
|
|
10
|
+
tool("network_export_har", (t) => t.desc("Export captured network traffic as HAR.").string("outputPath", "File path to write the HAR file. If omitted, returns HAR as JSON.").boolean("includeBodies", "Include response bodies in the HAR (may be slow for large captures). Default: false", { default: false }).openWorld()),
|
|
11
|
+
tool("network_replay_request", (t) => t.desc("Replay a captured network request with optional changes.").string("requestId", "Request ID from network_get_requests to replay").object("headerPatch", { additionalProperties: { type: "string" } }, "Headers to add or override (key-value pairs)").object("sessionProfile", {
|
|
12
|
+
cookies: {
|
|
13
|
+
type: "array",
|
|
14
|
+
items: {
|
|
15
|
+
type: "object",
|
|
16
|
+
properties: {
|
|
17
|
+
name: { type: "string" },
|
|
18
|
+
value: { type: "string" },
|
|
19
|
+
domain: { type: "string" },
|
|
20
|
+
path: { type: "string" },
|
|
21
|
+
expires: { type: "number" },
|
|
22
|
+
httpOnly: { type: "boolean" },
|
|
23
|
+
secure: { type: "boolean" },
|
|
24
|
+
sameSite: {
|
|
25
|
+
type: "string",
|
|
26
|
+
enum: [
|
|
27
|
+
"Strict",
|
|
28
|
+
"Lax",
|
|
29
|
+
"None"
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
required: ["name", "value"]
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
userAgent: { type: "string" },
|
|
37
|
+
acceptLanguage: { type: "string" },
|
|
38
|
+
referer: { type: "string" },
|
|
39
|
+
clientHints: {
|
|
40
|
+
type: "object",
|
|
41
|
+
properties: {
|
|
42
|
+
"sec-ch-ua": { type: "string" },
|
|
43
|
+
"sec-ch-ua-mobile": { type: "string" },
|
|
44
|
+
"sec-ch-ua-platform": { type: "string" },
|
|
45
|
+
"sec-ch-ua-full-version-list": { type: "string" }
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
platform: { type: "string" },
|
|
49
|
+
origin: { type: "string" },
|
|
50
|
+
collectedAt: { type: "number" },
|
|
51
|
+
ttlSec: { type: "number" }
|
|
52
|
+
}, "Inject browser cookies, User-Agent and Accept-Language from a captured session into the replay.").string("bodyPatch", "Replace the entire request body with this string").string("methodOverride", "Override the HTTP method").string("urlOverride", "Override the request URL").object("authorization", networkAuthorizationSchema, "Request-scoped authorization policy for private-network or insecure-HTTP replay. Use exact hosts/CIDRs instead of process-wide bypasses.").string("authorizationCapability", "Base64url-encoded JSON capability for request-scoped authorization. Payload fields mirror authorization and must include requestId.").number("timeoutMs", "Request timeout in milliseconds", {
|
|
53
|
+
default: 3e4,
|
|
54
|
+
minimum: 1e3,
|
|
55
|
+
maximum: 12e4
|
|
56
|
+
}).boolean("dryRun", "Preview the request without sending it", { default: true }).requiredOpenWorld("requestId")),
|
|
57
|
+
tool("network_intercept", (t) => t.desc("Manage network interception rules.").enum("action", [
|
|
58
|
+
"add",
|
|
59
|
+
"list",
|
|
60
|
+
"disable"
|
|
61
|
+
], "Intercept operation").string("urlPattern", "URL pattern to match").enum("urlPatternType", ["glob", "regex"], "How to interpret urlPattern", { default: "glob" }).enum("stage", ["Request", "Response"], "Intercept stage. Response (default) intercepts after server responds.", { default: "Response" }).number("responseCode", "HTTP status code to return", {
|
|
62
|
+
default: 200,
|
|
63
|
+
minimum: 100,
|
|
64
|
+
maximum: 599
|
|
65
|
+
}).object("responseHeaders", { additionalProperties: { type: "string" } }, "Custom response headers as key-value pairs.").string("responseBody", "Custom response body string.").array("rules", {
|
|
66
|
+
type: "object",
|
|
67
|
+
properties: {
|
|
68
|
+
urlPattern: { type: "string" },
|
|
69
|
+
urlPatternType: {
|
|
70
|
+
type: "string",
|
|
71
|
+
enum: ["glob", "regex"]
|
|
72
|
+
},
|
|
73
|
+
stage: {
|
|
74
|
+
type: "string",
|
|
75
|
+
enum: ["Request", "Response"]
|
|
76
|
+
},
|
|
77
|
+
responseCode: { type: "number" },
|
|
78
|
+
responseHeaders: {
|
|
79
|
+
type: "object",
|
|
80
|
+
additionalProperties: { type: "string" }
|
|
81
|
+
},
|
|
82
|
+
responseBody: { type: "string" }
|
|
83
|
+
},
|
|
84
|
+
required: ["urlPattern"]
|
|
85
|
+
}, "Rule objects to add").string("ruleId", "Rule ID to remove").boolean("all", "Remove all rules", { default: false }).required("action")),
|
|
86
|
+
tool("network_tls_fingerprint", (t) => t.desc("Compute TLS/HTTP fingerprint hashes for bot detection.").enum("mode", [
|
|
87
|
+
"analyze_request",
|
|
88
|
+
"compute_tls",
|
|
89
|
+
"compute_http"
|
|
90
|
+
], "Fingerprint mode").string("requestId", "Request ID to analyze").array("tlsVersions", { type: "string" }, "TLS version codes in order").array("ciphers", { type: "string" }, "Cipher suite codes in order").array("extensions", { type: "string" }, "Extension type codes in order").array("signatureAlgorithms", { type: "string" }, "Signature algorithm codes in order").enum("protocol", [
|
|
91
|
+
"tls",
|
|
92
|
+
"quic",
|
|
93
|
+
"dtls"
|
|
94
|
+
], "Transport protocol type", { default: "tls" }).boolean("sni", "Whether SNI (Server Name Indication) extension is present", { default: true }).string("alpn", "ALPN value").array("httpHeaders", { type: "string" }, "HTTP header names in order").string("userAgent", "User-Agent value").string("httpMethod", "HTTP method", { default: "GET" }).string("httpVersion", "HTTP version", { default: "1.1" }).string("cookieHeader", "Cookie header value").string("acceptLanguage", "Accept-Language header value").boolean("includeAnalysis", "Include detailed fingerprint breakdown", { default: true }).required("mode")),
|
|
95
|
+
tool("network_bot_detect_analyze", (t) => t.desc("Analyze captured requests for bot-detection signals.").number("limit", "Maximum requests to analyze", {
|
|
96
|
+
default: 50,
|
|
97
|
+
minimum: 1,
|
|
98
|
+
maximum: 500
|
|
99
|
+
}).boolean("includeDetails", "Include per-request analysis details", { default: false }).query())
|
|
100
|
+
];
|
|
101
|
+
//#endregion
|
|
102
|
+
//#region src/server/domains/network/definitions/capture-tools.ts
|
|
103
|
+
const captureTools = [
|
|
104
|
+
tool("network_enable", (t) => t.desc("Enable network request monitoring.").boolean("enableExceptions", "Also capture uncaught exceptions", { default: true })),
|
|
105
|
+
tool("network_disable", (t) => t.desc("Disable network request monitoring").destructive()),
|
|
106
|
+
tool("network_get_status", (t) => t.desc("Get network monitoring status.").query()),
|
|
107
|
+
tool("network_monitor", (t) => t.desc("Manage network request monitoring.").enum("action", [
|
|
108
|
+
"enable",
|
|
109
|
+
"disable",
|
|
110
|
+
"status"
|
|
111
|
+
], "Action to perform").boolean("enableExceptions", "Only for enable action: Also capture uncaught exceptions", { default: true }).required("action")),
|
|
112
|
+
tool("network_get_requests", (t) => t.desc("Get captured network requests.").string("url", "Filter by URL substring").string("urlRegex", "Filter by URL regex pattern").string("method", "Filter by HTTP method (GET, POST, PUT, DELETE)").number("sinceTimestamp", "Only return requests after this epoch timestamp (milliseconds). Useful for incremental polling.").string("sinceRequestId", "Only return requests after this requestId (exclusive). Useful for incremental retrieval.").number("tail", "Return the last N requests after filtering").number("limit", "Maximum number of results per page", {
|
|
113
|
+
default: 100,
|
|
114
|
+
minimum: 1,
|
|
115
|
+
maximum: 1e3
|
|
116
|
+
}).number("offset", "Skip results for pagination", {
|
|
117
|
+
default: 0,
|
|
118
|
+
minimum: 0
|
|
119
|
+
}).boolean("autoEnable", "Auto-enable network monitoring when currently disabled", { default: true }).boolean("enableExceptions", "When autoEnable=true, also enable uncaught exception monitoring", { default: true })),
|
|
120
|
+
tool("network_get_response_body", (t) => t.desc("Get the response body for a captured request.").string("requestId", "Request ID (from network_get_requests)").number("maxSize", "Maximum response size in bytes", {
|
|
121
|
+
default: 1e5,
|
|
122
|
+
minimum: 1024,
|
|
123
|
+
maximum: 2e7
|
|
124
|
+
}).boolean("returnSummary", "Return only size and preview instead of full body", { default: false }).number("retries", "Retry count when response body is not yet available", {
|
|
125
|
+
default: 3,
|
|
126
|
+
minimum: 0,
|
|
127
|
+
maximum: 10
|
|
128
|
+
}).number("retryIntervalMs", "Retry interval in milliseconds", {
|
|
129
|
+
default: 500,
|
|
130
|
+
minimum: 100,
|
|
131
|
+
maximum: 1e4
|
|
132
|
+
}).boolean("autoEnable", "Auto-enable network monitoring when currently disabled", { default: false }).boolean("enableExceptions", "When autoEnable=true, also enable uncaught exception monitoring", { default: true }).required("requestId")),
|
|
133
|
+
tool("network_get_stats", (t) => t.desc("Get network statistics.").query()),
|
|
134
|
+
tool("performance_get_metrics", (t) => t.desc("Get page performance metrics.").boolean("includeTimeline", "Include detailed timeline events", { default: false }).query()),
|
|
135
|
+
tool("performance_coverage", (t) => t.desc("Start or stop code coverage recording.").enum("action", ["start", "stop"], "Coverage action").required("action")),
|
|
136
|
+
tool("performance_take_heap_snapshot", (t) => t.desc("Take a V8 heap memory snapshot")),
|
|
137
|
+
tool("performance_trace", (t) => t.desc("Start or stop a Chrome performance trace.").enum("action", ["start", "stop"], "Trace action").array("categories", { type: "string" }, "Trace categories to capture").boolean("screenshots", "Capture screenshots during tracing", { default: false }).string("artifactPath", "Custom output path").required("action")),
|
|
138
|
+
tool("profiler_cpu", (t) => t.desc("Start or stop CPU profiling.").enum("action", ["start", "stop"], "Profiler action").string("artifactPath", "Custom output path").required("action")),
|
|
139
|
+
tool("profiler_heap_sampling", (t) => t.desc("Start or stop heap allocation sampling.").enum("action", ["start", "stop"], "Sampling action").number("samplingInterval", "Sampling interval in bytes", {
|
|
140
|
+
default: 32768,
|
|
141
|
+
minimum: 256,
|
|
142
|
+
maximum: 1048576
|
|
143
|
+
}).string("artifactPath", "Custom output path").number("topN", "Number of top allocators to return", {
|
|
144
|
+
default: 20,
|
|
145
|
+
minimum: 1,
|
|
146
|
+
maximum: 100
|
|
147
|
+
}).required("action"))
|
|
148
|
+
];
|
|
149
|
+
//#endregion
|
|
150
|
+
//#region src/server/domains/network/definitions/console-tools.ts
|
|
151
|
+
const consoleTools = [
|
|
152
|
+
tool("console_get_exceptions", (t) => t.desc("Get captured uncaught exceptions from the page").string("url", "Filter by URL substring").number("limit", "Maximum number of exceptions to return", {
|
|
153
|
+
default: 50,
|
|
154
|
+
minimum: 1,
|
|
155
|
+
maximum: 1e3
|
|
156
|
+
}).readOnly()),
|
|
157
|
+
tool("console_inject", (t) => t.desc("Inject an in-page script, XHR, fetch, or function monitor.").enum("type", [
|
|
158
|
+
"script",
|
|
159
|
+
"xhr",
|
|
160
|
+
"fetch",
|
|
161
|
+
"function"
|
|
162
|
+
], "Injection type").string("functionName", "Global function path to trace").boolean("persistent", "Keep the injection across page navigations", { default: false }).required("type").openWorld()),
|
|
163
|
+
tool("console_inject_fetch_interceptor", (t) => t.desc("Inject a fetch interceptor.").boolean("persistent", "Keep the injection across page navigations", { default: false }).openWorld()),
|
|
164
|
+
tool("console_inject_xhr_interceptor", (t) => t.desc("Inject an XMLHttpRequest interceptor.").boolean("persistent", "Keep the injection across page navigations", { default: false }).openWorld()),
|
|
165
|
+
tool("console_buffers", (t) => t.desc("Manage injected interceptor state.").enum("action", ["clear", "reset"], "Buffer action: clear buffers or reset interceptors").required("action"))
|
|
166
|
+
];
|
|
167
|
+
//#endregion
|
|
168
|
+
//#region src/server/domains/network/definitions/probe-tools.ts
|
|
169
|
+
const probeTools = [tool("network_traceroute", (t) => t.desc("Run an ICMP traceroute.").string("target", "Target hostname or IP address to trace route to").number("maxHops", "Maximum number of hops", {
|
|
170
|
+
default: 30,
|
|
171
|
+
minimum: 1,
|
|
172
|
+
maximum: 64
|
|
173
|
+
}).number("timeout", "Per-hop timeout in milliseconds", {
|
|
174
|
+
default: 5e3,
|
|
175
|
+
minimum: 100,
|
|
176
|
+
maximum: 3e4
|
|
177
|
+
}).number("packetSize", "ICMP echo request payload size in bytes", {
|
|
178
|
+
default: 32,
|
|
179
|
+
minimum: 8,
|
|
180
|
+
maximum: 65500
|
|
181
|
+
}).required("target").query()), tool("network_icmp_probe", (t) => t.desc("Run an ICMP echo probe.").string("target", "Target hostname or IP address to probe").number("ttl", "Time-to-live value", {
|
|
182
|
+
default: 128,
|
|
183
|
+
minimum: 1,
|
|
184
|
+
maximum: 255
|
|
185
|
+
}).number("packetSize", "ICMP echo request payload size in bytes", {
|
|
186
|
+
default: 32,
|
|
187
|
+
minimum: 8,
|
|
188
|
+
maximum: 65500
|
|
189
|
+
}).number("timeout", "Timeout in milliseconds", {
|
|
190
|
+
default: 5e3,
|
|
191
|
+
minimum: 100,
|
|
192
|
+
maximum: 3e4
|
|
193
|
+
}).required("target").query())];
|
|
194
|
+
//#endregion
|
|
195
|
+
//#region src/server/domains/network/definitions/transport-tools.ts
|
|
196
|
+
const transportTools = [
|
|
197
|
+
tool("http_request_build", (t) => t.desc("Build a raw HTTP/1.x request payload.").string("method", "HTTP method token").string("target", "Request target, such as /path, *, or an absolute-form URL").string("host", "Optional Host header value to inject when addHostHeader is enabled").object("headers", { additionalProperties: { type: "string" } }, "Optional HTTP headers to include in the request").string("body", "Optional UTF-8 request body").enum("httpVersion", ["1.0", "1.1"], "HTTP protocol version to emit", { default: "1.1" }).boolean("addHostHeader", "Auto-add the Host header when host is provided", { default: true }).boolean("addContentLength", "Auto-add Content-Length when a body is present and Transfer-Encoding is absent", { default: true }).boolean("addConnectionClose", "Auto-add Connection: close when absent", { default: true }).requiredOpenWorld("method", "target")),
|
|
198
|
+
tool("http_plain_request", (t) => t.desc("Send a raw HTTP request over plain TCP.").string("host", "Target hostname or IP literal").number("port", "TCP port to connect to. Default: 80", {
|
|
199
|
+
default: 80,
|
|
200
|
+
minimum: 1,
|
|
201
|
+
maximum: 65535
|
|
202
|
+
}).string("requestText", "Raw HTTP request text to send as UTF-8 bytes").object("authorization", networkAuthorizationSchema, "Request-scoped authorization policy for private-network or insecure-HTTP targets. Use exact hosts/CIDRs instead of process-wide bypasses.").number("timeoutMs", "Socket timeout in milliseconds", {
|
|
203
|
+
default: 3e4,
|
|
204
|
+
minimum: 1e3,
|
|
205
|
+
maximum: 12e4
|
|
206
|
+
}).number("maxResponseBytes", "Maximum number of raw response bytes to capture before truncating the exchange", {
|
|
207
|
+
default: 512e3,
|
|
208
|
+
minimum: 1024,
|
|
209
|
+
maximum: 10485760
|
|
210
|
+
}).requiredOpenWorld("host", "requestText")),
|
|
211
|
+
tool("http2_probe", (t) => t.desc("Probe an HTTP/2 endpoint.").string("url", "Absolute http:// or https:// URL to probe").string("method", "HTTP method token to send. Default: GET").object("headers", { additionalProperties: { type: "string" } }, "Optional request headers to include. Header names are normalized to lowercase for HTTP/2.").string("body", "Optional UTF-8 request body to send with the probe").array("alpnProtocols", { type: "string" }, "ALPN protocols to offer").object("authorization", networkAuthorizationSchema, "Request-scoped authorization policy for private-network or insecure-HTTP targets. Use exact hosts/CIDRs instead of process-wide bypasses.").number("timeoutMs", "Probe timeout in milliseconds", {
|
|
212
|
+
default: 3e4,
|
|
213
|
+
minimum: 1e3,
|
|
214
|
+
maximum: 12e4
|
|
215
|
+
}).number("maxBodyBytes", "Maximum number of response body bytes to capture for the snippet before truncating", {
|
|
216
|
+
default: 32768,
|
|
217
|
+
minimum: 1024,
|
|
218
|
+
maximum: 1048576
|
|
219
|
+
}).requiredOpenWorld("url")),
|
|
220
|
+
tool("http2_frame_build", (t) => t.desc("Build a raw HTTP/2 frame.").string("frameType", "HTTP/2 frame type: DATA, SETTINGS, PING, WINDOW_UPDATE, RST_STREAM, GOAWAY, or RAW").number("streamId", "Stream identifier (0 for connection-level frames). Default: 0", {
|
|
221
|
+
default: 0,
|
|
222
|
+
minimum: 0,
|
|
223
|
+
maximum: 2147483647
|
|
224
|
+
}).number("flags", "Raw flags byte (0-255). Overrides type-specific defaults when set.", {
|
|
225
|
+
minimum: 0,
|
|
226
|
+
maximum: 255
|
|
227
|
+
}).number("frameTypeCode", "Explicit frame type code for RAW frames (0-255). Required when frameType is RAW.", {
|
|
228
|
+
minimum: 0,
|
|
229
|
+
maximum: 255
|
|
230
|
+
}).string("payloadHex", "Frame payload as a hex string. Mutually exclusive with payloadText.").string("payloadText", "Frame payload as a text string. Mutually exclusive with payloadHex.").string("payloadEncoding", "Encoding for payloadText: utf8 or ascii. Default: utf8").array("settings", {
|
|
231
|
+
type: "object",
|
|
232
|
+
properties: {
|
|
233
|
+
id: { type: "number" },
|
|
234
|
+
value: { type: "number" }
|
|
235
|
+
},
|
|
236
|
+
required: ["id", "value"]
|
|
237
|
+
}, "Array of {id, value} entries for SETTINGS frames").boolean("ack", "Set the ACK flag on SETTINGS or PING frames").string("pingOpaqueDataHex", "Exactly 8 bytes of opaque data for PING frames (hex string)").number("windowSizeIncrement", "Window size increment for WINDOW_UPDATE frames (1 to 2^31-1)").number("errorCode", "Error code for RST_STREAM or GOAWAY frames (0 to 2^32-1)").number("lastStreamId", "Last stream ID for GOAWAY frames (0 to 2^31-1)").string("debugDataText", "Optional debug data for GOAWAY frames").string("debugDataEncoding", "Encoding for debugDataText: utf8 or ascii. Default: utf8").requiredOpenWorld("frameType")),
|
|
238
|
+
tool("network_rtt_measure", (t) => t.desc("Measure round-trip time to a target URL.").string("url", "Target URL to measure RTT to").string("probeType", "Probe type: tcp, tls, or http. Default: tcp", { default: "tcp" }).number("iterations", "Number of probe iterations (1-50). Default: 5", {
|
|
239
|
+
default: 5,
|
|
240
|
+
minimum: 1,
|
|
241
|
+
maximum: 50
|
|
242
|
+
}).number("timeoutMs", "Per-probe timeout in milliseconds (100-30000). Default: 5000", {
|
|
243
|
+
default: 5e3,
|
|
244
|
+
minimum: 100,
|
|
245
|
+
maximum: 3e4
|
|
246
|
+
}).object("authorization", { additionalProperties: { type: "string" } }, "Authorization policy for network access").requiredOpenWorld("url"))
|
|
247
|
+
];
|
|
248
|
+
//#endregion
|
|
249
|
+
//#region src/server/domains/network/definitions.ts
|
|
250
|
+
const advancedTools = [
|
|
251
|
+
...captureTools,
|
|
252
|
+
...consoleTools,
|
|
253
|
+
...transportTools,
|
|
254
|
+
...analysisTools,
|
|
255
|
+
...probeTools
|
|
256
|
+
];
|
|
257
|
+
//#endregion
|
|
258
|
+
export { advancedTools as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as tool } from "./tool-builder-
|
|
1
|
+
import { t as tool } from "./tool-builder-BHJp32mV.mjs";
|
|
2
2
|
//#region src/server/domains/transform/definitions.ts
|
|
3
3
|
const transformsEnum = [
|
|
4
4
|
"constant_fold",
|
|
@@ -11,7 +11,7 @@ const transformTools = [
|
|
|
11
11
|
tool("ast_transform_preview", (t) => t.desc("Preview lightweight AST-like transforms (string/regex based) and return before/after diff.").string("code", "Source code to transform.").array("transforms", {
|
|
12
12
|
type: "string",
|
|
13
13
|
enum: transformsEnum
|
|
14
|
-
}, "Ordered transform list.").boolean("preview", "Whether to generate line diff output.", { default: true }).required("code", "transforms")),
|
|
14
|
+
}, "Ordered transform list.").boolean("preview", "Whether to generate line diff output.", { default: true }).required("code", "transforms").query()),
|
|
15
15
|
tool("ast_transform_chain", (t) => t.desc("Create and store an in-memory transform chain.").string("name", "Chain name.").array("transforms", {
|
|
16
16
|
type: "string",
|
|
17
17
|
enum: transformsEnum
|
|
@@ -21,8 +21,8 @@ const transformTools = [
|
|
|
21
21
|
enum: transformsEnum
|
|
22
22
|
}, "Direct transform list (used when chainName is not provided).")),
|
|
23
23
|
tool("crypto_extract_standalone", (t) => t.desc("Extract crypto/sign/encrypt function from current page and generate standalone runnable code.").string("targetFunction", "Target function name/path, e.g. \"window.sign\".").boolean("includePolyfills", "Include minimal runtime polyfills.", { default: true }).required("targetFunction")),
|
|
24
|
-
tool("crypto_test_harness", (t) => t.desc("Run extracted crypto code in worker_threads + vm sandbox and return deterministic test results.").string("code", "Standalone function code.").string("functionName", "Exported function name to execute.").array("testInputs", { type: "string" }, "Input list for test execution.").required("code", "functionName", "testInputs")),
|
|
25
|
-
tool("crypto_compare", (t) => t.desc("Compare two crypto implementations against identical test vectors.").string("code1", "Implementation A code.").string("code2", "Implementation B code.").string("functionName", "Function name shared by both implementations.").array("testInputs", { type: "string" }, "Input list for comparison.").required("code1", "code2", "functionName", "testInputs"))
|
|
24
|
+
tool("crypto_test_harness", (t) => t.desc("Run extracted crypto code in worker_threads + vm sandbox and return deterministic test results.").string("code", "Standalone function code.").string("functionName", "Exported function name to execute.").array("testInputs", { type: "string" }, "Input list for test execution.").required("code", "functionName", "testInputs").query()),
|
|
25
|
+
tool("crypto_compare", (t) => t.desc("Compare two crypto implementations against identical test vectors.").string("code1", "Implementation A code.").string("code2", "Implementation B code.").string("functionName", "Function name shared by both implementations.").array("testInputs", { type: "string" }, "Input list for comparison.").required("code1", "code2", "functionName", "testInputs").query())
|
|
26
26
|
];
|
|
27
27
|
//#endregion
|
|
28
28
|
export { transformTools as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as argString, n as argEnum, r as argNumber } from "./parse-args-
|
|
2
|
-
import "./definitions-
|
|
1
|
+
import { a as argString, n as argEnum, r as argNumber } from "./parse-args-B4cY5Vx5.mjs";
|
|
2
|
+
import "./definitions-DPRpZQ96.mjs";
|
|
3
3
|
import { homedir, tmpdir } from "node:os";
|
|
4
4
|
import { isAbsolute, resolve } from "node:path";
|
|
5
5
|
import { readFile, realpath } from "node:fs/promises";
|
|
@@ -882,8 +882,22 @@ function printableRatio(buffer) {
|
|
|
882
882
|
//#region src/server/domains/encoding/handlers.impl.core.runtime.ts
|
|
883
883
|
var EncodingToolHandlers = class {
|
|
884
884
|
collector;
|
|
885
|
-
|
|
885
|
+
responseBodyResolver;
|
|
886
|
+
constructor(collector, responseBodyResolver) {
|
|
886
887
|
this.collector = collector;
|
|
888
|
+
this.responseBodyResolver = responseBodyResolver;
|
|
889
|
+
}
|
|
890
|
+
async resolveCapturedRequestBody(requestId) {
|
|
891
|
+
if (this.responseBodyResolver) try {
|
|
892
|
+
const payload = await this.responseBodyResolver(requestId);
|
|
893
|
+
if (payload && typeof payload.body === "string") {
|
|
894
|
+
if (payload.base64Encoded) return Buffer.from(payload.body, "base64");
|
|
895
|
+
const maybeBase64 = payload.body.trim();
|
|
896
|
+
if (looksLikeBase64(maybeBase64)) return Buffer.from(maybeBase64, "base64");
|
|
897
|
+
return Buffer.from(payload.body, "utf8");
|
|
898
|
+
}
|
|
899
|
+
} catch {}
|
|
900
|
+
return resolveRequestBodyFromActivePage(this.collector, requestId);
|
|
887
901
|
}
|
|
888
902
|
async handleBinaryDetectFormat(args) {
|
|
889
903
|
try {
|
|
@@ -894,7 +908,7 @@ var EncodingToolHandlers = class {
|
|
|
894
908
|
let buffer = null;
|
|
895
909
|
let requestBodyUsed = false;
|
|
896
910
|
if (source === "raw" && requestId) {
|
|
897
|
-
buffer = await
|
|
911
|
+
buffer = await this.resolveCapturedRequestBody(requestId);
|
|
898
912
|
requestBodyUsed = buffer !== null;
|
|
899
913
|
}
|
|
900
914
|
if (!buffer) {
|
|
@@ -26,6 +26,7 @@ var CrossDomainEvidenceBridge = class {
|
|
|
26
26
|
const label = input.method ? `${input.method} ${input.url}` : input.url;
|
|
27
27
|
const node = this.graph.addNode("network-request", label, {
|
|
28
28
|
domain: "network",
|
|
29
|
+
requestId: input.requestId,
|
|
29
30
|
url: input.url,
|
|
30
31
|
method: input.method ?? "GET"
|
|
31
32
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./chunk-CjcI7cDX.mjs";
|
|
2
|
-
import { _ as WriteProcessMemory, b as openProcessForMemory, d as ReadProcessMemory, f as VirtualAllocEx, h as VirtualQueryEx, i as GetModuleBaseName, l as MEM, m as VirtualProtectEx, n as EnumProcessModules, p as VirtualFreeEx, s as GetModuleInformation, t as CloseHandle, u as PAGE, v as isKoffiAvailable, y as isWindows } from "./Win32API-
|
|
3
|
-
import { _ as machVmReadOverwrite, a as VM_PROT, b as taskForPid, c as dyldImageCount, d as kernReturnName, f as machPortDeallocate, g as machVmProtect, h as machVmDeallocate, i as VM_FLAGS, l as isDarwin, m as machVmAllocate, n as KERN, o as dyldGetImageHeader, p as machTaskSelf, r as SM, s as dyldGetImageName, u as isKoffiAvailableOnDarwin, v as machVmRegion, y as machVmWrite } from "./DarwinAPI-
|
|
2
|
+
import { _ as WriteProcessMemory, b as openProcessForMemory, d as ReadProcessMemory, f as VirtualAllocEx, h as VirtualQueryEx, i as GetModuleBaseName, l as MEM, m as VirtualProtectEx, n as EnumProcessModules, p as VirtualFreeEx, s as GetModuleInformation, t as CloseHandle, u as PAGE, v as isKoffiAvailable, y as isWindows } from "./Win32API-C2kjj0ze.mjs";
|
|
3
|
+
import { _ as machVmReadOverwrite, a as VM_PROT, b as taskForPid, c as dyldImageCount, d as kernReturnName, f as machPortDeallocate, g as machVmProtect, h as machVmDeallocate, i as VM_FLAGS, l as isDarwin, m as machVmAllocate, n as KERN, o as dyldGetImageHeader, p as machTaskSelf, r as SM, s as dyldGetImageName, u as isKoffiAvailableOnDarwin, v as machVmRegion, y as machVmWrite } from "./DarwinAPI-ETyy0xyo.mjs";
|
|
4
4
|
import fs from "node:fs";
|
|
5
5
|
//#region src/native/platform/win32/Win32MemoryProvider.ts
|
|
6
6
|
const handleMap$1 = /* @__PURE__ */ new WeakMap();
|
|
@@ -287,13 +287,13 @@ var DarwinMemoryProvider = class {
|
|
|
287
287
|
}
|
|
288
288
|
enumerateModules(handle) {
|
|
289
289
|
const h = getDarwinHandle(handle);
|
|
290
|
-
if (handle.pid === process.pid) return this.
|
|
291
|
-
return this.
|
|
290
|
+
if (handle.pid === process.pid) return this.enumerateModulesSelf();
|
|
291
|
+
return this.enumerateModulesRemote(h.task);
|
|
292
292
|
}
|
|
293
293
|
/**
|
|
294
294
|
* Enumerate modules for the current process using dyld APIs (fast path).
|
|
295
295
|
*/
|
|
296
|
-
|
|
296
|
+
enumerateModulesSelf() {
|
|
297
297
|
const count = dyldImageCount();
|
|
298
298
|
const modules = [];
|
|
299
299
|
for (let i = 0; i < count; i++) {
|
|
@@ -315,7 +315,7 @@ var DarwinMemoryProvider = class {
|
|
|
315
315
|
* This reads the target process's dyld info structures from memory.
|
|
316
316
|
* Falls back to an empty list if the info struct cannot be located.
|
|
317
317
|
*/
|
|
318
|
-
|
|
318
|
+
enumerateModulesRemote(task) {
|
|
319
319
|
const modules = [];
|
|
320
320
|
let address = 0n;
|
|
321
321
|
for (let i = 0; i < 1e4; i++) {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//#region src/modules/browser/flat-target-session.ts
|
|
2
|
+
function readSessionId(response) {
|
|
3
|
+
if (typeof response !== "object" || response === null) return null;
|
|
4
|
+
const sessionId = response.sessionId;
|
|
5
|
+
return typeof sessionId === "string" && sessionId.length > 0 ? sessionId : null;
|
|
6
|
+
}
|
|
7
|
+
function readAttachedSessionId(session) {
|
|
8
|
+
const sessionId = session.id?.();
|
|
9
|
+
return typeof sessionId === "string" && sessionId.length > 0 ? sessionId : null;
|
|
10
|
+
}
|
|
11
|
+
async function attachToFlatTarget(parentSession, targetId) {
|
|
12
|
+
const sessionId = readSessionId(await parentSession.send("Target.attachToTarget", {
|
|
13
|
+
targetId,
|
|
14
|
+
flatten: true
|
|
15
|
+
}));
|
|
16
|
+
if (!sessionId) throw new Error(`Target.attachToTarget did not return sessionId for ${targetId}`);
|
|
17
|
+
const connection = parentSession.connection?.();
|
|
18
|
+
if (!connection || typeof connection.session !== "function") throw new Error(`CDP connection lookup unavailable for attached target ${targetId}`);
|
|
19
|
+
const attachedSession = connection.session(sessionId);
|
|
20
|
+
if (!attachedSession) throw new Error(`CDP attached target session ${sessionId} was not registered for ${targetId}`);
|
|
21
|
+
return attachedSession;
|
|
22
|
+
}
|
|
23
|
+
async function detachFromFlatTarget(parentSession, attachedSession) {
|
|
24
|
+
const sessionId = readAttachedSessionId(attachedSession);
|
|
25
|
+
if (!sessionId) throw new Error("CDP attached target session id unavailable for detach");
|
|
26
|
+
await parentSession.send("Target.detachFromTarget", { sessionId });
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { detachFromFlatTarget as n, attachToFlatTarget as t };
|