@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,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { fn as SANDBOX_EXEC_TIMEOUT_MS, mn as SANDBOX_MEMORY_LIMIT_MB, pn as SANDBOX_MAX_TIMEOUT_MS } from "./constants-CDZLOoVv.mjs";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import { getQuickJS } from "quickjs-emscripten";
|
|
4
4
|
//#region src/server/sandbox/SandboxHelpers.ts
|
|
@@ -358,10 +358,10 @@ var QuickJSSandbox = class {
|
|
|
358
358
|
const context = runtime.newContext();
|
|
359
359
|
const logs = [];
|
|
360
360
|
try {
|
|
361
|
-
this.
|
|
362
|
-
this.
|
|
363
|
-
if (this.bridge) this.
|
|
364
|
-
if (options.globals) this.
|
|
361
|
+
this.injectConsole(context, logs);
|
|
362
|
+
this.injectHelpers(context);
|
|
363
|
+
if (this.bridge) this.injectBridge(context, this.bridge, logs);
|
|
364
|
+
if (options.globals) this.injectGlobals(context, options.globals);
|
|
365
365
|
const result = context.evalCode(code, "sandbox-eval.js");
|
|
366
366
|
if (result.error) {
|
|
367
367
|
const errorMsg = context.dump(result.error);
|
|
@@ -433,7 +433,7 @@ var QuickJSSandbox = class {
|
|
|
433
433
|
__bridgeRound: round
|
|
434
434
|
};
|
|
435
435
|
if (round > 0) roundGlobals.__bridgeResults = bridgeResults;
|
|
436
|
-
const roundResult = await this.
|
|
436
|
+
const roundResult = await this.executeOneRound(code, bridge, {
|
|
437
437
|
...options,
|
|
438
438
|
globals: roundGlobals
|
|
439
439
|
});
|
|
@@ -492,7 +492,7 @@ var QuickJSSandbox = class {
|
|
|
492
492
|
* Run a single evaluation round inside a fresh QuickJS runtime.
|
|
493
493
|
* Used internally by executeWithOrchestration.
|
|
494
494
|
*/
|
|
495
|
-
async
|
|
495
|
+
async executeOneRound(code, bridge, options = {}) {
|
|
496
496
|
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
497
497
|
const memoryLimitBytes = options.memoryLimitBytes ?? DEFAULT_MEMORY_LIMIT_BYTES;
|
|
498
498
|
const runtime = (await getQuickJS()).newRuntime();
|
|
@@ -509,10 +509,10 @@ var QuickJSSandbox = class {
|
|
|
509
509
|
const context = runtime.newContext();
|
|
510
510
|
const logs = [];
|
|
511
511
|
try {
|
|
512
|
-
this.
|
|
513
|
-
this.
|
|
514
|
-
this.
|
|
515
|
-
if (options.globals) this.
|
|
512
|
+
this.injectConsole(context, logs);
|
|
513
|
+
this.injectHelpers(context);
|
|
514
|
+
this.injectBridgeForOrchestration(context, bridge, logs);
|
|
515
|
+
if (options.globals) this.injectGlobals(context, options.globals);
|
|
516
516
|
const result = context.evalCode(code, "sandbox-eval.js");
|
|
517
517
|
if (result.error) {
|
|
518
518
|
const errorMsg = context.dump(result.error);
|
|
@@ -558,7 +558,7 @@ var QuickJSSandbox = class {
|
|
|
558
558
|
* Inject a `console` object into the sandbox whose `log` method
|
|
559
559
|
* pushes stringified arguments into the captured `logs` array.
|
|
560
560
|
*/
|
|
561
|
-
|
|
561
|
+
injectConsole(ctx, logs) {
|
|
562
562
|
const consoleObj = ctx.newObject();
|
|
563
563
|
const logFn = ctx.newFunction("log", (...args) => {
|
|
564
564
|
const parts = args.map((a) => {
|
|
@@ -577,7 +577,7 @@ var QuickJSSandbox = class {
|
|
|
577
577
|
/**
|
|
578
578
|
* Inject user-supplied global variables into the QuickJS context.
|
|
579
579
|
*/
|
|
580
|
-
|
|
580
|
+
injectGlobals(ctx, globals) {
|
|
581
581
|
for (const [key, value] of Object.entries(globals)) {
|
|
582
582
|
const handle = marshalToQuickJS(ctx, value);
|
|
583
583
|
ctx.setProp(ctx.global, key, handle);
|
|
@@ -588,7 +588,7 @@ var QuickJSSandbox = class {
|
|
|
588
588
|
* Inject pre-built helper libraries (base64, hex, hash, etc.) into the
|
|
589
589
|
* sandbox global scope by evaluating the helper source code.
|
|
590
590
|
*/
|
|
591
|
-
|
|
591
|
+
injectHelpers(ctx) {
|
|
592
592
|
const result = ctx.evalCode(SANDBOX_HELPER_SOURCE, "sandbox-helpers.js");
|
|
593
593
|
if (result.error) {
|
|
594
594
|
ctx.dump(result.error);
|
|
@@ -606,7 +606,7 @@ var QuickJSSandbox = class {
|
|
|
606
606
|
* For sandbox scripts that need bridge results inline, the host orchestrator
|
|
607
607
|
* (AutoCorrectionLoop or handler) resolves bridge calls between executions.
|
|
608
608
|
*/
|
|
609
|
-
|
|
609
|
+
injectBridge(ctx, bridge, logs) {
|
|
610
610
|
const mcpObj = ctx.newObject();
|
|
611
611
|
const callFn = ctx.newFunction("call", (nameHandle, argsHandle) => {
|
|
612
612
|
const name = ctx.getString(nameHandle);
|
|
@@ -635,7 +635,7 @@ var QuickJSSandbox = class {
|
|
|
635
635
|
* resolves these calls between rounds and injects results into
|
|
636
636
|
* `__bridgeResults[callId]`.
|
|
637
637
|
*/
|
|
638
|
-
|
|
638
|
+
injectBridgeForOrchestration(ctx, bridge, logs) {
|
|
639
639
|
const mcpObj = ctx.newObject();
|
|
640
640
|
const callFn = ctx.newFunction("call", (nameHandle, argsHandle) => {
|
|
641
641
|
const name = ctx.getString(nameHandle);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as asJsonResponse, r as asTextResponse } from "./response-
|
|
1
|
+
import { n as asJsonResponse, r as asTextResponse } from "./response-CWhh2aLo.mjs";
|
|
2
2
|
//#region src/server/domains/evidence/handlers.ts
|
|
3
3
|
/**
|
|
4
4
|
* Evidence domain handlers — delegates to ReverseEvidenceGraph.
|
|
@@ -7,6 +7,12 @@ var EvidenceHandlers = class {
|
|
|
7
7
|
constructor(graph) {
|
|
8
8
|
this.graph = graph;
|
|
9
9
|
}
|
|
10
|
+
pickStringArg(args, keys) {
|
|
11
|
+
for (const key of keys) {
|
|
12
|
+
const value = args[key];
|
|
13
|
+
if (typeof value === "string" && value.length > 0) return value;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
10
16
|
serializeNodes(nodes) {
|
|
11
17
|
return nodes.map((node) => ({
|
|
12
18
|
id: node.id,
|
|
@@ -17,9 +23,30 @@ var EvidenceHandlers = class {
|
|
|
17
23
|
}
|
|
18
24
|
handleQueryDispatch(args) {
|
|
19
25
|
switch (args["by"]) {
|
|
20
|
-
case "function": return this.handleQueryFunction(
|
|
21
|
-
|
|
22
|
-
|
|
26
|
+
case "function": return this.handleQueryFunction({
|
|
27
|
+
...args,
|
|
28
|
+
name: this.pickStringArg(args, [
|
|
29
|
+
"name",
|
|
30
|
+
"value",
|
|
31
|
+
"query"
|
|
32
|
+
])
|
|
33
|
+
});
|
|
34
|
+
case "script": return this.handleQueryScript({
|
|
35
|
+
...args,
|
|
36
|
+
scriptId: this.pickStringArg(args, [
|
|
37
|
+
"scriptId",
|
|
38
|
+
"value",
|
|
39
|
+
"query"
|
|
40
|
+
])
|
|
41
|
+
});
|
|
42
|
+
default: return this.handleQueryUrl({
|
|
43
|
+
...args,
|
|
44
|
+
url: this.pickStringArg(args, [
|
|
45
|
+
"url",
|
|
46
|
+
"value",
|
|
47
|
+
"query"
|
|
48
|
+
])
|
|
49
|
+
});
|
|
23
50
|
}
|
|
24
51
|
}
|
|
25
52
|
handleExportDispatch(args) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as ToolError } from "./ToolError-jh9whhMd.mjs";
|
|
2
|
-
import { a as argString, o as argStringArray, t as argBool } from "./parse-args-
|
|
2
|
+
import { a as argString, o as argStringArray, t as argBool } from "./parse-args-B4cY5Vx5.mjs";
|
|
3
3
|
//#region src/modules/skia-capture/SkiaSceneExtractor.ts
|
|
4
4
|
function hasEvaluate(value) {
|
|
5
5
|
if (typeof value !== "object" || value === null || !("evaluate" in value)) return false;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as asJsonResponse } from "./response-
|
|
3
|
-
import { i as getProjectRoot, r as getExtensionRegistryDir } from "./outputPaths-
|
|
4
|
-
import { a as argString, i as argObject, s as argStringRequired } from "./parse-args-
|
|
1
|
+
import { kr as WEBHOOK_PROCESS_TIMEOUT_MS } from "./constants-CDZLOoVv.mjs";
|
|
2
|
+
import { n as asJsonResponse } from "./response-CWhh2aLo.mjs";
|
|
3
|
+
import { i as getProjectRoot, r as getExtensionRegistryDir } from "./outputPaths-um7lCRY3.mjs";
|
|
4
|
+
import { a as argString, i as argObject, s as argStringRequired } from "./parse-args-B4cY5Vx5.mjs";
|
|
5
5
|
import http from "node:http";
|
|
6
6
|
import { existsSync, mkdirSync, readFileSync, readdirSync } from "node:fs";
|
|
7
7
|
import path from "node:path";
|
|
@@ -279,7 +279,7 @@ var WebhookBridge = class {
|
|
|
279
279
|
}
|
|
280
280
|
/**
|
|
281
281
|
* Register an external callback URL for a webhook endpoint.
|
|
282
|
-
* Used when
|
|
282
|
+
* Used when webhook({ action: "create" }) registers an endpoint — the URL is stored
|
|
283
283
|
* here so emitEvent() can forward events to external callbacks.
|
|
284
284
|
*/
|
|
285
285
|
registerExternalCallback(endpointId, url) {
|
|
@@ -620,8 +620,8 @@ function isCallable(value) {
|
|
|
620
620
|
return typeof value === "function";
|
|
621
621
|
}
|
|
622
622
|
var ExtensionRegistryHandlers = class {
|
|
623
|
-
|
|
624
|
-
|
|
623
|
+
webhookServer;
|
|
624
|
+
commandQueue;
|
|
625
625
|
constructor(registry, webhook) {
|
|
626
626
|
this.registry = registry;
|
|
627
627
|
this.webhook = webhook;
|
|
@@ -741,21 +741,21 @@ var ExtensionRegistryHandlers = class {
|
|
|
741
741
|
});
|
|
742
742
|
}
|
|
743
743
|
getWebhookServer() {
|
|
744
|
-
if (!this.
|
|
745
|
-
this.
|
|
746
|
-
this.
|
|
744
|
+
if (!this.webhookServer) {
|
|
745
|
+
this.commandQueue = new CommandQueue();
|
|
746
|
+
this.webhookServer = new WebhookServer({ commandQueue: this.commandQueue });
|
|
747
747
|
}
|
|
748
|
-
return this.
|
|
748
|
+
return this.webhookServer;
|
|
749
749
|
}
|
|
750
750
|
async startWebhookServer() {
|
|
751
751
|
const server = this.getWebhookServer();
|
|
752
752
|
if (!server.isRunning()) server.start();
|
|
753
753
|
}
|
|
754
754
|
async stopWebhookServer() {
|
|
755
|
-
if (this.
|
|
756
|
-
await this.
|
|
757
|
-
this.
|
|
758
|
-
this.
|
|
755
|
+
if (this.webhookServer) {
|
|
756
|
+
await this.webhookServer.stop();
|
|
757
|
+
this.webhookServer = void 0;
|
|
758
|
+
this.commandQueue = void 0;
|
|
759
759
|
}
|
|
760
760
|
}
|
|
761
761
|
getRegistry() {
|
|
@@ -767,8 +767,8 @@ var ExtensionRegistryHandlers = class {
|
|
|
767
767
|
return this.webhook;
|
|
768
768
|
}
|
|
769
769
|
getCommandQueue() {
|
|
770
|
-
if (!this.
|
|
771
|
-
return this.
|
|
770
|
+
if (!this.commandQueue) this.commandQueue = new CommandQueue();
|
|
771
|
+
return this.commandQueue;
|
|
772
772
|
}
|
|
773
773
|
emitEvent(event, payload) {
|
|
774
774
|
this.getWebhook().sendEvent(event, payload).catch(() => void 0);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as invokePlugin, c as FridaSession, i as getAvailablePlugins, n as UnidbgRunner, o as HookCodeGenerator, r as HookGenerator, s as GhidraAnalyzer } from "./binary-instrument
|
|
1
|
+
import { xr as UNIDBG_TIMEOUT_MS } from "./constants-CDZLOoVv.mjs";
|
|
2
|
+
import { a as invokePlugin, c as FridaSession, i as getAvailablePlugins, n as UnidbgRunner, o as HookCodeGenerator, r as HookGenerator, s as GhidraAnalyzer } from "./binary-instrument--V3MAhJ4.mjs";
|
|
3
|
+
import { n as capabilityReport, t as capabilityFailure } from "./capabilities-CcHlvWgK.mjs";
|
|
3
4
|
import { access } from "node:fs/promises";
|
|
4
5
|
import { execFile } from "node:child_process";
|
|
5
6
|
//#region src/server/domains/binary-instrument/handlers/shared.ts
|
|
@@ -7,6 +8,12 @@ import { execFile } from "node:child_process";
|
|
|
7
8
|
* Shared types and helpers for binary-instrument sub-handlers.
|
|
8
9
|
*/
|
|
9
10
|
const UNIDBG_MAX_BUFFER_BYTES = 8 * 1024 * 1024;
|
|
11
|
+
const LEGACY_PLUGIN_FIXES = {
|
|
12
|
+
plugin_frida_bridge: "Install @jshookmcpextension/plugin-frida-bridge and reload extensions.",
|
|
13
|
+
plugin_ghidra_bridge: "Install @jshookmcpextension/plugin-ghidra-bridge and reload extensions.",
|
|
14
|
+
plugin_ida_bridge: "Install @jshookmcpextension/plugin-ida-bridge and reload extensions.",
|
|
15
|
+
plugin_jadx_bridge: "Install @jshookmcpextension/plugin-jadx-bridge and reload extensions."
|
|
16
|
+
};
|
|
10
17
|
function textResponse(text) {
|
|
11
18
|
return { content: [{
|
|
12
19
|
type: "text",
|
|
@@ -46,15 +53,39 @@ function hasInstalledLegacyPlugin(context, pluginId) {
|
|
|
46
53
|
if (!(installed instanceof Map)) return void 0;
|
|
47
54
|
return installed.has(pluginId);
|
|
48
55
|
}
|
|
56
|
+
function getLegacyPluginFix(pluginId) {
|
|
57
|
+
return LEGACY_PLUGIN_FIXES[pluginId];
|
|
58
|
+
}
|
|
59
|
+
function getLegacyPluginStatus(context, pluginId) {
|
|
60
|
+
const installed = hasInstalledLegacyPlugin(context, pluginId);
|
|
61
|
+
if (installed === true) return {
|
|
62
|
+
status: "available",
|
|
63
|
+
fix: getLegacyPluginFix(pluginId)
|
|
64
|
+
};
|
|
65
|
+
if (installed === false) return {
|
|
66
|
+
status: "unavailable",
|
|
67
|
+
reason: `Plugin ${pluginId.replaceAll("_", "-")} is not installed`,
|
|
68
|
+
fix: getLegacyPluginFix(pluginId)
|
|
69
|
+
};
|
|
70
|
+
return {
|
|
71
|
+
status: "unknown",
|
|
72
|
+
reason: "Extension plugin registry is not available in the current server context",
|
|
73
|
+
fix: "Run inside the full MCP server with extension support enabled."
|
|
74
|
+
};
|
|
75
|
+
}
|
|
49
76
|
async function invokeLegacyPlugin(context, pluginId, toolName, args) {
|
|
50
|
-
|
|
77
|
+
const pluginStatus = getLegacyPluginStatus(context, pluginId);
|
|
78
|
+
if (!context || pluginStatus.status !== "available") return jsonResponse({
|
|
79
|
+
...capabilityFailure(toolName, pluginId, pluginStatus.reason ?? `Plugin ${pluginId.replaceAll("_", "-")} is not available`, pluginStatus.fix),
|
|
80
|
+
status: pluginStatus.status
|
|
81
|
+
});
|
|
51
82
|
const result = await invokePlugin(context, {
|
|
52
83
|
pluginId,
|
|
53
84
|
toolName,
|
|
54
85
|
args
|
|
55
86
|
});
|
|
56
87
|
if (result.success) return jsonResponse(result);
|
|
57
|
-
return
|
|
88
|
+
return jsonResponse({ ...capabilityFailure(toolName, pluginId, result.error ?? "Plugin invocation failed", pluginStatus.fix) });
|
|
58
89
|
}
|
|
59
90
|
function readHookOptions(args, key) {
|
|
60
91
|
const raw = args[key];
|
|
@@ -179,7 +210,10 @@ var FridaHandlers = class {
|
|
|
179
210
|
if (!availability.available) {
|
|
180
211
|
const sessionId = `mock-frida-${makeMockId(target)}`;
|
|
181
212
|
return jsonResponse({
|
|
213
|
+
success: false,
|
|
182
214
|
available: false,
|
|
215
|
+
capability: "frida_cli",
|
|
216
|
+
fix: "Install frida-tools and ensure the frida CLI is on PATH.",
|
|
183
217
|
target,
|
|
184
218
|
sessionId,
|
|
185
219
|
reason: availability.reason ?? "Frida CLI is not available",
|
|
@@ -191,13 +225,27 @@ var FridaHandlers = class {
|
|
|
191
225
|
}]
|
|
192
226
|
});
|
|
193
227
|
}
|
|
194
|
-
|
|
228
|
+
let sessionId;
|
|
229
|
+
try {
|
|
230
|
+
sessionId = await frida.attach(target);
|
|
231
|
+
} catch (error) {
|
|
232
|
+
return jsonResponse({
|
|
233
|
+
success: false,
|
|
234
|
+
available: true,
|
|
235
|
+
capability: "frida_attach",
|
|
236
|
+
fix: "Run the server elevated or choose a target process that allows Frida injection.",
|
|
237
|
+
target,
|
|
238
|
+
reason: error instanceof Error ? error.message : String(error),
|
|
239
|
+
sessions: frida.listSessions()
|
|
240
|
+
});
|
|
241
|
+
}
|
|
195
242
|
this.state.context?.eventBus.emit("frida:attached", {
|
|
196
243
|
target,
|
|
197
244
|
sessionId,
|
|
198
245
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
199
246
|
});
|
|
200
247
|
return jsonResponse({
|
|
248
|
+
success: true,
|
|
201
249
|
available: true,
|
|
202
250
|
target,
|
|
203
251
|
sessionId,
|
|
@@ -210,6 +258,8 @@ var FridaHandlers = class {
|
|
|
210
258
|
const availability = await frida.getAvailability();
|
|
211
259
|
if (!availability.available) return jsonResponse({
|
|
212
260
|
available: false,
|
|
261
|
+
capability: "frida_cli",
|
|
262
|
+
fix: "Install frida-tools and ensure the frida CLI is on PATH.",
|
|
213
263
|
sessionId,
|
|
214
264
|
reason: availability.reason ?? "Frida CLI is not available",
|
|
215
265
|
modules: [{
|
|
@@ -221,14 +271,26 @@ var FridaHandlers = class {
|
|
|
221
271
|
});
|
|
222
272
|
if (!frida.useSession(sessionId)) return jsonResponse({
|
|
223
273
|
available: false,
|
|
274
|
+
capability: "frida_session",
|
|
275
|
+
fix: "Call frida_attach first and reuse the returned sessionId.",
|
|
224
276
|
sessionId,
|
|
225
277
|
reason: `Unknown Frida session: ${sessionId}`,
|
|
226
278
|
modules: []
|
|
227
279
|
});
|
|
280
|
+
const modules = await frida.enumerateModules();
|
|
281
|
+
const diagnostics = frida.getSessionDiagnostics(sessionId);
|
|
282
|
+
if (diagnostics?.status === "error" && diagnostics.lastError) return jsonResponse({
|
|
283
|
+
success: false,
|
|
284
|
+
available: true,
|
|
285
|
+
sessionId,
|
|
286
|
+
reason: diagnostics.lastError,
|
|
287
|
+
modules
|
|
288
|
+
});
|
|
228
289
|
return jsonResponse({
|
|
290
|
+
success: true,
|
|
229
291
|
available: true,
|
|
230
292
|
sessionId,
|
|
231
|
-
modules
|
|
293
|
+
modules
|
|
232
294
|
});
|
|
233
295
|
}
|
|
234
296
|
async handleFridaRunScript(args) {
|
|
@@ -239,6 +301,8 @@ var FridaHandlers = class {
|
|
|
239
301
|
const availability = await frida.getAvailability();
|
|
240
302
|
if (!availability.available) return {
|
|
241
303
|
available: false,
|
|
304
|
+
capability: "frida_cli",
|
|
305
|
+
fix: "Install frida-tools and ensure the frida CLI is on PATH.",
|
|
242
306
|
sessionId,
|
|
243
307
|
reason: availability.reason ?? "Frida CLI is not available",
|
|
244
308
|
execution: {
|
|
@@ -248,6 +312,8 @@ var FridaHandlers = class {
|
|
|
248
312
|
};
|
|
249
313
|
if (!frida.useSession(sessionId)) return {
|
|
250
314
|
available: false,
|
|
315
|
+
capability: "frida_session",
|
|
316
|
+
fix: "Call frida_attach first and reuse the returned sessionId.",
|
|
251
317
|
sessionId,
|
|
252
318
|
reason: `Unknown Frida session: ${sessionId}`,
|
|
253
319
|
execution: {
|
|
@@ -255,11 +321,20 @@ var FridaHandlers = class {
|
|
|
255
321
|
error: "Unknown session"
|
|
256
322
|
}
|
|
257
323
|
};
|
|
258
|
-
|
|
324
|
+
const execution = await frida.executeScript(script);
|
|
325
|
+
if (execution.error) return jsonResponse({
|
|
326
|
+
success: false,
|
|
259
327
|
available: true,
|
|
260
328
|
sessionId,
|
|
261
|
-
|
|
262
|
-
|
|
329
|
+
reason: execution.error,
|
|
330
|
+
execution
|
|
331
|
+
});
|
|
332
|
+
return jsonResponse({
|
|
333
|
+
success: true,
|
|
334
|
+
available: true,
|
|
335
|
+
sessionId,
|
|
336
|
+
execution
|
|
337
|
+
});
|
|
263
338
|
}
|
|
264
339
|
async handleFridaDetach(args) {
|
|
265
340
|
const sessionId = readOptionalString(args, "sessionId");
|
|
@@ -277,20 +352,28 @@ var FridaHandlers = class {
|
|
|
277
352
|
return invokeLegacyPlugin(this.state.context, "plugin_frida_bridge", "frida_detach", args);
|
|
278
353
|
}
|
|
279
354
|
async handleFridaListSessions(_args) {
|
|
280
|
-
if (hasInstalledLegacyPlugin(this.state.context, "plugin_frida_bridge") === false) return textResponse("Plugin plugin-frida-bridge is not installed");
|
|
281
355
|
const frida = this.getFridaSession();
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
}
|
|
356
|
+
const availability = await frida.getAvailability();
|
|
357
|
+
const sessions = frida.listSessions();
|
|
358
|
+
if (availability.available) return jsonResponse({
|
|
359
|
+
success: true,
|
|
360
|
+
available: true,
|
|
361
|
+
sessions,
|
|
362
|
+
count: sessions.length
|
|
363
|
+
});
|
|
364
|
+
const pluginStatus = getLegacyPluginStatus(this.state.context, "plugin_frida_bridge");
|
|
365
|
+
if (sessions.length > 0 || pluginStatus.status === "unavailable") return jsonResponse({
|
|
366
|
+
success: true,
|
|
367
|
+
available: false,
|
|
368
|
+
capability: "frida_cli",
|
|
369
|
+
reason: availability.reason ?? "Frida CLI is not available",
|
|
370
|
+
fix: "Install frida-tools and ensure the frida CLI is on PATH.",
|
|
371
|
+
sessions,
|
|
372
|
+
count: sessions.length
|
|
373
|
+
});
|
|
290
374
|
return invokeLegacyPlugin(this.state.context, "plugin_frida_bridge", "frida_list_sessions", _args);
|
|
291
375
|
}
|
|
292
376
|
async handleFridaGenerateScript(args) {
|
|
293
|
-
if (hasInstalledLegacyPlugin(this.state.context, "plugin_frida_bridge") === false) return textResponse("Plugin plugin-frida-bridge is not installed");
|
|
294
377
|
const target = readOptionalString(args, "target") ?? "unknown";
|
|
295
378
|
const template = readOptionalString(args, "template") ?? "trace";
|
|
296
379
|
const functionName = readOptionalString(args, "functionName") ?? "target_function";
|
|
@@ -315,6 +398,8 @@ var FridaHandlers = class {
|
|
|
315
398
|
const availability = await frida.getAvailability();
|
|
316
399
|
if (!availability.available) return {
|
|
317
400
|
available: false,
|
|
401
|
+
capability: "frida_cli",
|
|
402
|
+
fix: "Install frida-tools and ensure the frida CLI is on PATH.",
|
|
318
403
|
sessionId,
|
|
319
404
|
moduleName,
|
|
320
405
|
reason: availability.reason ?? "Frida CLI is not available",
|
|
@@ -322,18 +407,31 @@ var FridaHandlers = class {
|
|
|
322
407
|
};
|
|
323
408
|
if (!frida.useSession(sessionId)) return {
|
|
324
409
|
available: false,
|
|
410
|
+
capability: "frida_session",
|
|
411
|
+
fix: "Call frida_attach first and reuse the returned sessionId.",
|
|
325
412
|
sessionId,
|
|
326
413
|
reason: `Unknown Frida session: ${sessionId}`,
|
|
327
414
|
functions: []
|
|
328
415
|
};
|
|
329
416
|
const functions = await frida.enumerateFunctions(moduleName);
|
|
330
|
-
|
|
417
|
+
const diagnostics = frida.getSessionDiagnostics(sessionId);
|
|
418
|
+
if (diagnostics?.status === "error" && diagnostics.lastError) return jsonResponse({
|
|
419
|
+
success: false,
|
|
331
420
|
available: true,
|
|
332
421
|
sessionId,
|
|
333
422
|
moduleName,
|
|
423
|
+
reason: diagnostics.lastError,
|
|
334
424
|
functions,
|
|
335
425
|
count: functions.length
|
|
336
|
-
};
|
|
426
|
+
});
|
|
427
|
+
return jsonResponse({
|
|
428
|
+
success: true,
|
|
429
|
+
available: true,
|
|
430
|
+
sessionId,
|
|
431
|
+
moduleName,
|
|
432
|
+
functions,
|
|
433
|
+
count: functions.length
|
|
434
|
+
});
|
|
337
435
|
}
|
|
338
436
|
async handleFridaFindSymbols(args) {
|
|
339
437
|
const sessionId = readRequiredString(args, "sessionId");
|
|
@@ -342,6 +440,8 @@ var FridaHandlers = class {
|
|
|
342
440
|
const availability = await frida.getAvailability();
|
|
343
441
|
if (!availability.available) return {
|
|
344
442
|
available: false,
|
|
443
|
+
capability: "frida_cli",
|
|
444
|
+
fix: "Install frida-tools and ensure the frida CLI is on PATH.",
|
|
345
445
|
sessionId,
|
|
346
446
|
pattern,
|
|
347
447
|
reason: availability.reason ?? "Frida CLI is not available",
|
|
@@ -349,18 +449,31 @@ var FridaHandlers = class {
|
|
|
349
449
|
};
|
|
350
450
|
if (!frida.useSession(sessionId)) return {
|
|
351
451
|
available: false,
|
|
452
|
+
capability: "frida_session",
|
|
453
|
+
fix: "Call frida_attach first and reuse the returned sessionId.",
|
|
352
454
|
sessionId,
|
|
353
455
|
reason: `Unknown Frida session: ${sessionId}`,
|
|
354
456
|
symbols: []
|
|
355
457
|
};
|
|
356
458
|
const symbols = await frida.findSymbols(pattern);
|
|
357
|
-
|
|
459
|
+
const diagnostics = frida.getSessionDiagnostics(sessionId);
|
|
460
|
+
if (diagnostics?.status === "error" && diagnostics.lastError) return jsonResponse({
|
|
461
|
+
success: false,
|
|
358
462
|
available: true,
|
|
359
463
|
sessionId,
|
|
360
464
|
pattern,
|
|
465
|
+
reason: diagnostics.lastError,
|
|
361
466
|
symbols,
|
|
362
467
|
count: symbols.length
|
|
363
|
-
};
|
|
468
|
+
});
|
|
469
|
+
return jsonResponse({
|
|
470
|
+
success: true,
|
|
471
|
+
available: true,
|
|
472
|
+
sessionId,
|
|
473
|
+
pattern,
|
|
474
|
+
symbols,
|
|
475
|
+
count: symbols.length
|
|
476
|
+
});
|
|
364
477
|
}
|
|
365
478
|
getFridaSession() {
|
|
366
479
|
if (!this.state.fridaSession) this.state.fridaSession = new FridaSession();
|
|
@@ -387,6 +500,8 @@ var AnalysisHandlers = class {
|
|
|
387
500
|
const analysis = await ghidra.analyze(binaryPath, timeout !== void 0 ? { timeout } : void 0);
|
|
388
501
|
if (!availability.available) return {
|
|
389
502
|
available: false,
|
|
503
|
+
capability: "ghidra_headless",
|
|
504
|
+
fix: "Install Ghidra and ensure analyzeHeadless is on PATH.",
|
|
390
505
|
binaryPath,
|
|
391
506
|
reason: availability.reason ?? "Ghidra analyzeHeadless is not available",
|
|
392
507
|
analysis
|
|
@@ -452,6 +567,8 @@ var AnalysisHandlers = class {
|
|
|
452
567
|
const availability = await getUnidbgAvailability();
|
|
453
568
|
if (!availability.available) return {
|
|
454
569
|
available: false,
|
|
570
|
+
capability: "unidbg_jar",
|
|
571
|
+
fix: "Set UNIDBG_JAR to a reachable Unidbg JAR path.",
|
|
455
572
|
binaryPath,
|
|
456
573
|
functionName,
|
|
457
574
|
args: invokeArgs,
|
|
@@ -499,6 +616,8 @@ var AnalysisHandlers = class {
|
|
|
499
616
|
} catch (error) {
|
|
500
617
|
return {
|
|
501
618
|
available: false,
|
|
619
|
+
capability: "unidbg_jar",
|
|
620
|
+
fix: "Set UNIDBG_JAR to a reachable Unidbg JAR path and retry.",
|
|
502
621
|
soPath,
|
|
503
622
|
arch,
|
|
504
623
|
reason: error instanceof Error ? error.message : String(error),
|
|
@@ -560,6 +679,96 @@ var AnalysisHandlers = class {
|
|
|
560
679
|
}
|
|
561
680
|
};
|
|
562
681
|
//#endregion
|
|
682
|
+
//#region src/server/domains/binary-instrument/handlers/capability-handlers.ts
|
|
683
|
+
var CapabilityHandlers = class {
|
|
684
|
+
constructor(state) {
|
|
685
|
+
this.state = state;
|
|
686
|
+
}
|
|
687
|
+
async handleBinaryInstrumentCapabilities() {
|
|
688
|
+
const fridaAvailability = await this.getFridaSession().getAvailability();
|
|
689
|
+
const ghidraAvailability = await this.getGhidraAnalyzer().getAvailability();
|
|
690
|
+
const unidbgAvailability = await getUnidbgAvailability();
|
|
691
|
+
return jsonResponse(capabilityReport("binary_instrument_capabilities", [
|
|
692
|
+
{
|
|
693
|
+
capability: "frida_cli",
|
|
694
|
+
status: fridaAvailability.available ? "available" : "unavailable",
|
|
695
|
+
reason: fridaAvailability.reason,
|
|
696
|
+
fix: fridaAvailability.available ? void 0 : "Install frida-tools and ensure the frida CLI is on PATH.",
|
|
697
|
+
details: {
|
|
698
|
+
tools: [
|
|
699
|
+
"frida_attach",
|
|
700
|
+
"frida_enumerate_modules",
|
|
701
|
+
"frida_run_script",
|
|
702
|
+
"frida_enumerate_functions",
|
|
703
|
+
"frida_find_symbols"
|
|
704
|
+
],
|
|
705
|
+
...fridaAvailability.path ? { path: fridaAvailability.path } : {},
|
|
706
|
+
...fridaAvailability.version ? { version: fridaAvailability.version } : {}
|
|
707
|
+
}
|
|
708
|
+
},
|
|
709
|
+
{
|
|
710
|
+
capability: "plugin_frida_bridge",
|
|
711
|
+
...getLegacyPluginStatus(this.state.context, "plugin_frida_bridge"),
|
|
712
|
+
details: { tools: [
|
|
713
|
+
"frida_attach",
|
|
714
|
+
"frida_detach",
|
|
715
|
+
"frida_list_sessions"
|
|
716
|
+
] }
|
|
717
|
+
},
|
|
718
|
+
{
|
|
719
|
+
capability: "ghidra_headless",
|
|
720
|
+
status: ghidraAvailability.available ? "available" : "unavailable",
|
|
721
|
+
reason: ghidraAvailability.reason,
|
|
722
|
+
fix: ghidraAvailability.available ? void 0 : "Install Ghidra and ensure analyzeHeadless is on PATH.",
|
|
723
|
+
details: {
|
|
724
|
+
tools: ["ghidra_analyze"],
|
|
725
|
+
...ghidraAvailability.path ? { path: ghidraAvailability.path } : {},
|
|
726
|
+
...ghidraAvailability.version ? { version: ghidraAvailability.version } : {}
|
|
727
|
+
}
|
|
728
|
+
},
|
|
729
|
+
{
|
|
730
|
+
capability: "plugin_ghidra_bridge",
|
|
731
|
+
...getLegacyPluginStatus(this.state.context, "plugin_ghidra_bridge"),
|
|
732
|
+
details: { tools: ["ghidra_decompile"] }
|
|
733
|
+
},
|
|
734
|
+
{
|
|
735
|
+
capability: "plugin_ida_bridge",
|
|
736
|
+
...getLegacyPluginStatus(this.state.context, "plugin_ida_bridge"),
|
|
737
|
+
details: { tools: ["ida_decompile"] }
|
|
738
|
+
},
|
|
739
|
+
{
|
|
740
|
+
capability: "plugin_jadx_bridge",
|
|
741
|
+
...getLegacyPluginStatus(this.state.context, "plugin_jadx_bridge"),
|
|
742
|
+
details: { tools: ["jadx_decompile"] }
|
|
743
|
+
},
|
|
744
|
+
{
|
|
745
|
+
capability: "unidbg_jar",
|
|
746
|
+
status: unidbgAvailability.available ? "available" : "unavailable",
|
|
747
|
+
reason: unidbgAvailability.reason || void 0,
|
|
748
|
+
fix: unidbgAvailability.available ? void 0 : "Set UNIDBG_JAR to a reachable Unidbg JAR path.",
|
|
749
|
+
details: {
|
|
750
|
+
tools: [
|
|
751
|
+
"unidbg_emulate",
|
|
752
|
+
"unidbg_launch",
|
|
753
|
+
"unidbg_call",
|
|
754
|
+
"unidbg_trace"
|
|
755
|
+
],
|
|
756
|
+
command: unidbgAvailability.command,
|
|
757
|
+
jarPath: unidbgAvailability.jarPath
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
]));
|
|
761
|
+
}
|
|
762
|
+
getFridaSession() {
|
|
763
|
+
if (!this.state.fridaSession) this.state.fridaSession = new FridaSession();
|
|
764
|
+
return this.state.fridaSession;
|
|
765
|
+
}
|
|
766
|
+
getGhidraAnalyzer() {
|
|
767
|
+
if (!this.state.ghidra) this.state.ghidra = new GhidraAnalyzer();
|
|
768
|
+
return this.state.ghidra;
|
|
769
|
+
}
|
|
770
|
+
};
|
|
771
|
+
//#endregion
|
|
563
772
|
//#region src/server/domains/binary-instrument/handlers.impl.core.ts
|
|
564
773
|
/**
|
|
565
774
|
* BinaryInstrument domain — composition facade.
|
|
@@ -571,6 +780,7 @@ var BinaryInstrumentHandlers = class {
|
|
|
571
780
|
state;
|
|
572
781
|
frida;
|
|
573
782
|
analysis;
|
|
783
|
+
capabilities;
|
|
574
784
|
constructor(first, second, third) {
|
|
575
785
|
this.state = {
|
|
576
786
|
hookCodeGenerator: new HookCodeGenerator(),
|
|
@@ -582,6 +792,10 @@ var BinaryInstrumentHandlers = class {
|
|
|
582
792
|
if (third) this.state.hookGen = third;
|
|
583
793
|
this.frida = new FridaHandlers(this.state);
|
|
584
794
|
this.analysis = new AnalysisHandlers(this.state);
|
|
795
|
+
this.capabilities = new CapabilityHandlers(this.state);
|
|
796
|
+
}
|
|
797
|
+
handleBinaryInstrumentCapabilities() {
|
|
798
|
+
return this.capabilities.handleBinaryInstrumentCapabilities();
|
|
585
799
|
}
|
|
586
800
|
handleFridaAttach(args) {
|
|
587
801
|
return this.frida.handleFridaAttach(args);
|