@jshookmcp/jshook 0.2.9 → 0.3.1
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 +25 -50
- package/README.zh.md +25 -48
- package/dist/AntiCheatDetector-CGVGNfy5.mjs +1 -0
- package/dist/CacheAdapters-CdAxBmVW.mjs +1 -0
- package/dist/CodeInjector-BlgyqTOk.mjs +1 -0
- package/dist/ConsoleMonitor-Dkqc0HNi.mjs +490 -0
- package/dist/DOMInspector-BYY_EJ0C.mjs +95 -0
- package/dist/DarwinAPI-DC4HGGLl.mjs +1 -0
- package/dist/DetailedDataManager-BniBJlVv.mjs +1 -0
- package/dist/EventBus-DgciURGg.mjs +1 -0
- package/dist/EvidenceGraphBridge-BIfgB7HP.mjs +1 -0
- package/dist/ExtensionManager-erMpqcLk.mjs +1 -0
- package/dist/FingerprintManager-N7BZqjxP.mjs +1 -0
- package/dist/HardwareBreakpoint-OcJqNFVc.mjs +1 -0
- package/dist/HeapAnalyzer-CqAxZzeS.mjs +1 -0
- package/dist/{HookGeneratorBuilders.core.generators.storage-CtcdK78Q.mjs → HookGeneratorBuilders.core.generators.storage-Bf1fbrNK.mjs} +66 -174
- package/dist/InstrumentationSession-DxXs0sCp.mjs +1 -0
- package/dist/MCPServer.search.handlers.domain-DVbWL1bT.mjs +1 -0
- package/dist/MemoryController-BaqstM5w.mjs +2 -0
- package/dist/MemoryScanSession-CaxAjZJf.mjs +1 -0
- package/dist/MemoryScanner-BLYnMJy6.mjs +1 -0
- package/dist/NativeMemoryManager.impl-CI554XbY.mjs +1 -0
- package/dist/NativeMemoryManager.utils-DM4NC3FE.mjs +1 -0
- package/dist/PEAnalyzer-DJyaJTQJ.mjs +1 -0
- package/dist/PageController-D9jVkH0i.mjs +1 -0
- package/dist/PointerChainEngine-5nF9eNlu.mjs +1 -0
- package/dist/PrerequisiteError-Bl3dK8XA.mjs +1 -0
- package/dist/ProcessRegistry-Hf12LlR9.mjs +1 -0
- package/dist/ResponseBuilder-B2lu4KEl.mjs +1 -0
- package/dist/ReverseEvidenceGraph-B931HeoW.mjs +2 -0
- package/dist/ScriptManager-fgqiALgj.mjs +7 -0
- package/dist/Speedhack-l6s8L2Qw.mjs +1 -0
- package/dist/StealthVerifier-Dhbj4B4P.mjs +1 -0
- package/dist/StructureAnalyzer-A-WamfYE.mjs +2 -0
- package/dist/ToolCatalog-D_IKl1Hu.mjs +1 -0
- package/dist/ToolError-DWU_z7gp.mjs +1 -0
- package/dist/ToolProbe-xsfALmN3.mjs +1 -0
- package/dist/ToolRegistry-B0Zs-phN.mjs +1 -0
- package/dist/ToolRouter.policy-CFHoN_Lw.mjs +4 -0
- package/dist/TraceRecorder-Dd8jLXpi.mjs +272 -0
- package/dist/VersionDetector-DMoUWyNm.mjs +9 -0
- package/dist/Win32API-Bhi5xFBe.mjs +1 -0
- package/dist/Win32Debug-CQteFL4F.mjs +1 -0
- package/dist/WorkflowEngine-CxEp2WXH.mjs +1 -0
- package/dist/analysis-BuR-NgX8.mjs +5 -0
- package/dist/{antidebug-CqDTB_uk.mjs → antidebug-BOTZH6-0.mjs} +8 -259
- package/dist/artifactRetention-NBdncOEW.mjs +1 -0
- package/dist/artifacts-B5xQuEa_.mjs +1 -0
- package/dist/authorization-schema-B40obG1A.mjs +1 -0
- package/dist/betterSqlite3-CGaxz4AX.mjs +1 -0
- package/dist/binary-instrument-Cf9qqLlM.mjs +7 -0
- package/dist/bind-helpers-BlAOQrFQ.mjs +1 -0
- package/dist/boringssl-inspector-BST5vtKx.mjs +2 -0
- package/dist/browser-C4Le3xqA.mjs +11 -0
- package/dist/capabilities-DbYCv-HF.mjs +1 -0
- package/dist/chunk-C_pMuVsO.mjs +1 -0
- package/dist/collector-CKO8RPK8.mjs +1 -0
- package/dist/concurrency-CcK46d0h.mjs +1 -0
- package/dist/constants-Cp6hBrrx.mjs +1 -0
- package/dist/coordination-BbijHEHH.mjs +1 -0
- package/dist/debugger-CRJq_krh.mjs +1 -0
- package/dist/definitions-BGobEDQa.mjs +1 -0
- package/dist/definitions-BGwNSkVm.mjs +1 -0
- package/dist/definitions-BbxOUiP-.mjs +1 -0
- package/dist/definitions-CCP9gphV.mjs +1 -0
- package/dist/definitions-CIO9O-Sw.mjs +1 -0
- package/dist/definitions-CYFbewnd.mjs +1 -0
- package/dist/definitions-CdWEuIkI.mjs +1 -0
- package/dist/definitions-CoQFbggH.mjs +1 -0
- package/dist/definitions-CuJRsJ6N.mjs +1 -0
- package/dist/definitions-DI9YXsJk.mjs +1 -0
- package/dist/definitions-DJklW2sS.mjs +1 -0
- package/dist/definitions-DZ8uKusP.mjs +1 -0
- package/dist/definitions-Dds_zrWx.mjs +1 -0
- package/dist/definitions-Dgrg7f3D.mjs +1 -0
- package/dist/definitions-DtE0XLrT.mjs +1 -0
- package/dist/definitions-LaYTuwQd.mjs +26 -0
- package/dist/definitions-NoVp_9Pm.mjs +1 -0
- package/dist/definitions-OvGsfxdt.mjs +1 -0
- package/dist/definitions-jXPaVy4P.mjs +1 -0
- package/dist/encoding-DGcr6Aj_.mjs +2 -0
- package/dist/ensure-browser-core-Buls24LQ.mjs +1 -0
- package/dist/evidence-graph-bridge-B0yhGPcs.mjs +1 -0
- package/dist/factory-Cx_1LorX.mjs +1 -0
- package/dist/flat-target-session-CO5g78k3.mjs +1 -0
- package/dist/formatAddress-C7j2fDlM.mjs +1 -0
- package/dist/graphql-HLf3MS8H.mjs +62 -0
- package/dist/handlers-BLMa4X7l.mjs +54 -0
- package/dist/handlers-BP12ZsWc.mjs +4 -0
- package/dist/handlers-BZoPla6E.mjs +1 -0
- package/dist/handlers-BggKiVx9.mjs +2 -0
- package/dist/handlers-D3iev8g1.mjs +1 -0
- package/dist/handlers-D49r1-1P.mjs +1 -0
- package/dist/handlers-DCE45Ww8.mjs +2 -0
- package/dist/handlers-DW5AbYs5.mjs +5 -0
- package/dist/handlers-De5u62Ga2.mjs +1 -0
- package/dist/handlers-DmQzIc44.mjs +31 -0
- package/dist/handlers-DnJRGp7t.mjs +302 -0
- package/dist/handlers-Dv_runVv.mjs +2 -0
- package/dist/handlers-S9Ws0IGy.mjs +2 -0
- package/dist/{handlers-Bl8zkwz1.mjs → handlers-pVNpaw4A.mjs} +144 -841
- package/dist/handlers.impl-CD2_kOcC.mjs +1 -0
- package/dist/hooks-DDKppogd.mjs +600 -0
- package/dist/index.mjs +12 -5225
- package/dist/logger-sBC6IdRT.mjs +1 -0
- package/dist/maintenance-CutEO84j.mjs +1 -0
- package/dist/manifest-BFGxlDRh.mjs +123 -0
- package/dist/manifest-BPuE6oH2.mjs +1 -0
- package/dist/manifest-BXry5N09.mjs +1 -0
- package/dist/manifest-BeP_zJGb2.mjs +1 -0
- package/dist/manifest-C0g67k6U.mjs +1 -0
- package/dist/manifest-C1nZkTkO.mjs +1 -0
- package/dist/manifest-C7qV1z7F.mjs +1 -0
- package/dist/manifest-CDeUZGUZ.mjs +1 -0
- package/dist/manifest-CDiCtaQT.mjs +1 -0
- package/dist/manifest-CFn0359q2.mjs +1 -0
- package/dist/manifest-CGq4NpqH2.mjs +1 -0
- package/dist/manifest-CJMGt7Qy.mjs +1 -0
- package/dist/manifest-CRIJq4Hs.mjs +1 -0
- package/dist/manifest-C_hEIjSx.mjs +1 -0
- package/dist/manifest-CeQmtQOY.mjs +1 -0
- package/dist/manifest-Cq0j7GZt.mjs +1 -0
- package/dist/manifest-CtPmHAdn.mjs +1 -0
- package/dist/manifest-Cx2IVMUY.mjs +1 -0
- package/dist/manifest-D16xPXro.mjs +1 -0
- package/dist/manifest-D44TaRJU.mjs +1 -0
- package/dist/manifest-D610kxZr.mjs +2 -0
- package/dist/manifest-DC-SMF6b.mjs +1 -0
- package/dist/manifest-DD3rtxvV.mjs +1 -0
- package/dist/manifest-DKUorv5M.mjs +1 -0
- package/dist/manifest-DMJlcsTR.mjs +1 -0
- package/dist/manifest-DWUUWBz0.mjs +1 -0
- package/dist/manifest-De-6Wf2R.mjs +1 -0
- package/dist/manifest-Dgh0uDW-.mjs +1 -0
- package/dist/manifest-Dm0o3i2U.mjs +1 -0
- package/dist/manifest-DsVh7Y4U.mjs +1 -0
- package/dist/manifest-DtEFSRaq.mjs +1 -0
- package/dist/manifest-H-EpAyZQ.mjs +1 -0
- package/dist/manifest-ais9Afrw.mjs +1 -0
- package/dist/manifest-tmb54wmA.mjs +1 -0
- package/dist/manifest-yu2xiQqe.mjs +1 -0
- package/dist/manifest-zrbrpKCC.mjs +1 -0
- package/dist/matchesWildcardPattern-BGqLSmEs.mjs +1 -0
- package/dist/modules-p-PUNv9r.mjs +332 -0
- package/dist/mojo-ipc-VGlv3Qyp.mjs +9 -0
- package/dist/network-BjZ1Y-GB.mjs +7 -0
- package/dist/outputPaths-BonGThuc.mjs +2 -0
- package/dist/parse-args-Cuk7-xUt.mjs +1 -0
- package/dist/platform-C446Lf97.mjs +93 -0
- package/dist/playwright-cdp-fallback-BwVR-_T3.mjs +1 -0
- package/dist/process-C9f2A5zk.mjs +962 -0
- package/dist/proxy-CvRepxgV.mjs +1 -0
- package/dist/registry-DUHIPE-v.mjs +1 -0
- package/dist/response-C7rKQst4.mjs +1 -0
- package/dist/search-defaults-D2bY-rzH.mjs +1 -0
- package/dist/server/plugin-api.mjs +1 -293
- package/dist/shared-state-board-Cyg-xh_k.mjs +1 -0
- package/dist/sourcemap-D6Q1UuAp.mjs +1 -0
- package/dist/ssrf-policy-T96MR3r6.mjs +1 -0
- package/dist/streaming-CTX58tbb.mjs +1 -0
- package/dist/tool-builder-CI9914Tf.mjs +1 -0
- package/dist/transform-Cv9P2vVD.mjs +103 -0
- package/dist/types-CuyefmGT.mjs +1 -0
- package/dist/types-DtThH00r.mjs +1 -0
- package/dist/wasm-DaJa8J0V.mjs +174 -0
- package/dist/webcrack-CsLLJIs9.mjs +46 -0
- package/dist/workflow-CYIXtrWD.mjs +101 -0
- package/package.json +12 -7
- package/dist/AntiCheatDetector-BNk-EoBt.mjs +0 -244
- package/dist/CacheAdapters-CDe5WPSV.mjs +0 -80
- package/dist/CodeInjector-Cq8q01kp.mjs +0 -150
- package/dist/ConsoleMonitor-CPVQW1Y-.mjs +0 -2201
- package/dist/DarwinAPI-BNPxu0RH.mjs +0 -363
- package/dist/DetailedDataManager-BQQcxh64.mjs +0 -217
- package/dist/EventBus-DgPmwpeu.mjs +0 -141
- package/dist/EvidenceGraphBridge-SFesNera.mjs +0 -153
- package/dist/ExtensionManager-CWYgw0YW.mjs +0 -714
- package/dist/FingerprintManager-gzWtkKuf.mjs +0 -96
- package/dist/HardwareBreakpoint-B9gZCdFP.mjs +0 -239
- package/dist/HeapAnalyzer-BLDH0dCv.mjs +0 -284
- package/dist/InstrumentationSession-CvPC7Jwy.mjs +0 -244
- package/dist/MemoryController-CbVdCIJF.mjs +0 -167
- package/dist/MemoryScanSession-BsDZbLYm.mjs +0 -278
- package/dist/MemoryScanner-Bcpml6II.mjs +0 -425
- package/dist/NativeMemoryManager.impl-dZtA1ZGn.mjs +0 -482
- package/dist/NativeMemoryManager.utils-B-FjA2mJ.mjs +0 -165
- package/dist/PEAnalyzer-D1lzJ_VG.mjs +0 -385
- package/dist/PageController-Bqm2kZ_X.mjs +0 -417
- package/dist/PointerChainEngine-BOhyVsjx.mjs +0 -322
- package/dist/PrerequisiteError-Dl33Svkz.mjs +0 -20
- package/dist/ResponseBuilder-D3iFYx2N.mjs +0 -143
- package/dist/ReverseEvidenceGraph-Dlsk94LC.mjs +0 -269
- package/dist/ScriptManager-aHHq0X7U.mjs +0 -3000
- package/dist/Speedhack-CqdIFlQl.mjs +0 -156
- package/dist/StealthVerifier-Bo4T3bz8.mjs +0 -135
- package/dist/StructureAnalyzer-DhFaPvRO.mjs +0 -426
- package/dist/ToolCatalog-C0JGZoOm.mjs +0 -582
- package/dist/ToolError-jh9whhMd.mjs +0 -15
- package/dist/ToolProbe-oC7aPrkv.mjs +0 -45
- package/dist/ToolRegistry-BjaF4oNz.mjs +0 -131
- package/dist/ToolRouter.policy-BWV67ZK-.mjs +0 -304
- package/dist/TraceRecorder-DgxyVbdQ.mjs +0 -519
- package/dist/VersionDetector-CwVLVdDM.mjs +0 -104
- package/dist/Win32API-CePkipZY.mjs +0 -340
- package/dist/Win32Debug-BvKs-gxc.mjs +0 -274
- package/dist/WorkflowEngine-CuvkZtWu.mjs +0 -598
- package/dist/analysis-CL9uACt9.mjs +0 -463
- package/dist/artifactRetention-CFEprwPw.mjs +0 -591
- package/dist/artifacts-Bk2-_uPq.mjs +0 -59
- package/dist/betterSqlite3-0pqusHHH.mjs +0 -74
- package/dist/binary-instrument-CXfpx6fT.mjs +0 -979
- package/dist/bind-helpers-xFfRF-qm.mjs +0 -22
- package/dist/boringssl-inspector-BH2D3VKc.mjs +0 -180
- package/dist/browser-BpOr5PEx.mjs +0 -4082
- package/dist/chunk-CjcI7cDX.mjs +0 -15
- package/dist/concurrency-Bt0yv1kJ.mjs +0 -41
- package/dist/constants-B0OANIBL.mjs +0 -519
- package/dist/coordination-qUbyF8KU.mjs +0 -259
- package/dist/debugger-gnKxRSN0.mjs +0 -1271
- package/dist/definitions-6M-eejaT.mjs +0 -53
- package/dist/definitions-B18eyf0B.mjs +0 -18
- package/dist/definitions-B3QdlrHv.mjs +0 -34
- package/dist/definitions-B4rAvHNZ.mjs +0 -63
- package/dist/definitions-BB_4jnmy.mjs +0 -37
- package/dist/definitions-BMfYXoNC.mjs +0 -43
- package/dist/definitions-Beid2EB3.mjs +0 -27
- package/dist/definitions-C1UvM5Iy.mjs +0 -126
- 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-Cke7zEb8.mjs +0 -94
- package/dist/definitions-ClJLzsJQ.mjs +0 -25
- package/dist/definitions-Cq-zroAU.mjs +0 -28
- package/dist/definitions-Cy3Sl6gV.mjs +0 -34
- package/dist/definitions-D3VsGcvz.mjs +0 -47
- package/dist/definitions-DVGfrn7y.mjs +0 -96
- package/dist/definitions-LKpC3-nL.mjs +0 -9
- package/dist/definitions-bAhHQJq9.mjs +0 -359
- package/dist/encoding-Bvz5jLRv.mjs +0 -1065
- package/dist/evidence-graph-bridge-C_fv9PuC.mjs +0 -135
- package/dist/factory-DxlGh9Xf.mjs +0 -575
- package/dist/formatAddress-DVkj9kpI.mjs +0 -17
- package/dist/graphql-DYWzJ29s.mjs +0 -1026
- package/dist/handlers-9sAbfIg-.mjs +0 -2552
- package/dist/handlers-C67ktuRN.mjs +0 -710
- package/dist/handlers-C87g8oCe.mjs +0 -276
- package/dist/handlers-CTsDAO6p.mjs +0 -681
- package/dist/handlers-Cgyg6c0U.mjs +0 -645
- package/dist/handlers-D6j6yka7.mjs +0 -2124
- package/dist/handlers-DdFzXLvF.mjs +0 -446
- package/dist/handlers-DeLOCd5m.mjs +0 -799
- package/dist/handlers-DlCJN4Td.mjs +0 -757
- package/dist/handlers-DxGIq15_2.mjs +0 -917
- package/dist/handlers-U6L4xhuF.mjs +0 -585
- package/dist/handlers-tB9Mp9ZK.mjs +0 -84
- package/dist/handlers-tiy7EIBp.mjs +0 -572
- package/dist/handlers.impl-DS0d9fUw.mjs +0 -761
- package/dist/hooks-CzCWByww.mjs +0 -898
- package/dist/logger-Dh_xb7_2.mjs +0 -93
- package/dist/maintenance-P7ePRXQC.mjs +0 -830
- package/dist/manifest-2ToTpjv8.mjs +0 -106
- package/dist/manifest-3g71z6Bg.mjs +0 -79
- package/dist/manifest-82baTv4U.mjs +0 -45
- package/dist/manifest-B3QVVeBS.mjs +0 -82
- package/dist/manifest-BB2J8IMJ.mjs +0 -149
- package/dist/manifest-BKbgbSiY.mjs +0 -60
- package/dist/manifest-Bcf-TJzH.mjs +0 -848
- package/dist/manifest-BmtZzQiQ2.mjs +0 -45
- package/dist/manifest-Bnd7kqEY.mjs +0 -55
- package/dist/manifest-BqQX6OQC2.mjs +0 -65
- package/dist/manifest-BqrQ4Tpj.mjs +0 -81
- package/dist/manifest-Br4RPFt5.mjs +0 -370
- package/dist/manifest-C5qDjysN.mjs +0 -107
- package/dist/manifest-C9RT5nk32.mjs +0 -34
- package/dist/manifest-CAhOuvSl.mjs +0 -204
- package/dist/manifest-CBYWCUBJ.mjs +0 -51
- package/dist/manifest-CFADCRa1.mjs +0 -37
- package/dist/manifest-CQVhavRF.mjs +0 -114
- package/dist/manifest-CT7zZBV1.mjs +0 -48
- package/dist/manifest-CV12bcrF.mjs +0 -121
- package/dist/manifest-CXsRWjjI.mjs +0 -224
- package/dist/manifest-CZLUCfG02.mjs +0 -95
- package/dist/manifest-D6phHKFd.mjs +0 -131
- package/dist/manifest-DCyjf4n2.mjs +0 -294
- package/dist/manifest-DHsnKgP6.mjs +0 -60
- package/dist/manifest-Df_dliIe.mjs +0 -55
- package/dist/manifest-Dh8WBmEW.mjs +0 -129
- package/dist/manifest-DhKRAT8_.mjs +0 -92
- package/dist/manifest-DlpTj4ic2.mjs +0 -193
- package/dist/manifest-DrbmZcFl2.mjs +0 -253
- package/dist/manifest-DuwHjUa5.mjs +0 -70
- package/dist/manifest-DzwvxPJX.mjs +0 -38
- package/dist/manifest-NXctwWQq.mjs +0 -68
- package/dist/manifest-Sc_0JQ13.mjs +0 -418
- package/dist/manifest-gZ4s_UtG.mjs +0 -96
- package/dist/manifest-qSleDqdO.mjs +0 -1023
- package/dist/modules-C184v-S9.mjs +0 -11365
- package/dist/mojo-ipc-B_H61Afw.mjs +0 -525
- package/dist/network-671Cw6hV.mjs +0 -3346
- package/dist/outputPaths-B1uGmrWZ.mjs +0 -1145
- package/dist/parse-args-BlRjqlkL.mjs +0 -39
- package/dist/platform-WmNn8Sxb.mjs +0 -2070
- package/dist/process-QcbIy5Zq.mjs +0 -1401
- package/dist/proxy-DqNs0bAd.mjs +0 -170
- package/dist/registry-D-6e18lB.mjs +0 -34
- package/dist/response-BQVP-xUn.mjs +0 -28
- package/dist/shared-state-board-DV-dpHFJ.mjs +0 -586
- package/dist/sourcemap-Dq8ez8vS.mjs +0 -650
- package/dist/ssrf-policy-ZaUfvhq7.mjs +0 -166
- package/dist/streaming-BUQ0VJsg.mjs +0 -725
- package/dist/tool-builder-DCbIC5Eo.mjs +0 -186
- package/dist/transform-CiYJfNX0.mjs +0 -1007
- package/dist/types-Bx92KJfT.mjs +0 -4
- package/dist/types-CPhOReNX.mjs +0 -37
- package/dist/wasm-DQTnHDs4.mjs +0 -531
- package/dist/workflow-f3xJOcjx.mjs +0 -725
|
@@ -1,757 +0,0 @@
|
|
|
1
|
-
import { n as asJsonResponse } from "./response-BQVP-xUn.mjs";
|
|
2
|
-
import { a as argString, t as argBool } from "./parse-args-BlRjqlkL.mjs";
|
|
3
|
-
//#region src/server/domains/cross-domain/handlers/skia-correlator.ts
|
|
4
|
-
function normalizeSkiaToken(value) {
|
|
5
|
-
return value.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
6
|
-
}
|
|
7
|
-
function computeTokenSimilarity(a, b) {
|
|
8
|
-
const na = normalizeSkiaToken(a);
|
|
9
|
-
const nb = normalizeSkiaToken(b);
|
|
10
|
-
if (na === nb && na.length > 0) return 1;
|
|
11
|
-
if (na.length === 0 || nb.length === 0) return 0;
|
|
12
|
-
if (na.includes(nb) || nb.includes(na)) return .8;
|
|
13
|
-
return 0;
|
|
14
|
-
}
|
|
15
|
-
function findBestJSMatch(label, jsObjects) {
|
|
16
|
-
let bestScore = 0;
|
|
17
|
-
let bestMatch;
|
|
18
|
-
for (const obj of jsObjects) {
|
|
19
|
-
const nameScore = computeTokenSimilarity(label, obj.name);
|
|
20
|
-
if (nameScore > bestScore) {
|
|
21
|
-
bestScore = nameScore;
|
|
22
|
-
bestMatch = {
|
|
23
|
-
objectId: obj.objectId,
|
|
24
|
-
name: obj.name,
|
|
25
|
-
score: nameScore
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
for (const prop of obj.stringProps) {
|
|
29
|
-
const propScore = computeTokenSimilarity(label, prop);
|
|
30
|
-
if (propScore > bestScore) {
|
|
31
|
-
bestScore = propScore;
|
|
32
|
-
bestMatch = {
|
|
33
|
-
objectId: obj.objectId,
|
|
34
|
-
name: obj.name,
|
|
35
|
-
score: propScore
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
if (bestMatch && bestScore >= .5) return bestMatch;
|
|
41
|
-
}
|
|
42
|
-
function correlateSkiaToJS(bridge, input) {
|
|
43
|
-
const graphNodeIds = [];
|
|
44
|
-
const correlations = [];
|
|
45
|
-
const unmatchedSkiaNodes = [];
|
|
46
|
-
const matchedIds = /* @__PURE__ */ new Set();
|
|
47
|
-
const allSkiaItems = [];
|
|
48
|
-
for (const layer of input.sceneTree.layers) allSkiaItems.push({
|
|
49
|
-
id: layer.id,
|
|
50
|
-
label: layer.label,
|
|
51
|
-
heapObjectId: layer.heapObjectId
|
|
52
|
-
});
|
|
53
|
-
for (const cmd of input.sceneTree.drawCommands) allSkiaItems.push({
|
|
54
|
-
id: cmd.id,
|
|
55
|
-
label: cmd.label
|
|
56
|
-
});
|
|
57
|
-
const totalSkiaNodes = allSkiaItems.length;
|
|
58
|
-
for (const item of allSkiaItems) {
|
|
59
|
-
const canvasNode = bridge.addCanvasNode({
|
|
60
|
-
nodeId: item.id,
|
|
61
|
-
label: item.label
|
|
62
|
-
});
|
|
63
|
-
graphNodeIds.push(canvasNode.id);
|
|
64
|
-
if (item.heapObjectId) {
|
|
65
|
-
const jsObj = input.jsObjects.find((o) => o.objectId === item.heapObjectId);
|
|
66
|
-
if (jsObj) {
|
|
67
|
-
const heapNode = bridge.addV8Object({
|
|
68
|
-
address: item.heapObjectId,
|
|
69
|
-
name: jsObj.name
|
|
70
|
-
});
|
|
71
|
-
graphNodeIds.push(heapNode.id);
|
|
72
|
-
bridge.getGraph().addEdge(heapNode.id, canvasNode.id, "canvas-rendered-by", {
|
|
73
|
-
domain: "cross-domain",
|
|
74
|
-
matchScore: 1
|
|
75
|
-
});
|
|
76
|
-
correlations.push({
|
|
77
|
-
skiaNodeId: item.id,
|
|
78
|
-
matchedObjectId: jsObj.objectId,
|
|
79
|
-
matchedObjectName: jsObj.name,
|
|
80
|
-
matchScore: 1
|
|
81
|
-
});
|
|
82
|
-
matchedIds.add(item.id);
|
|
83
|
-
continue;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
const match = findBestJSMatch(item.label, input.jsObjects);
|
|
87
|
-
if (match) {
|
|
88
|
-
const heapNode = bridge.addV8Object({
|
|
89
|
-
address: match.objectId,
|
|
90
|
-
name: match.name
|
|
91
|
-
});
|
|
92
|
-
graphNodeIds.push(heapNode.id);
|
|
93
|
-
bridge.getGraph().addEdge(heapNode.id, canvasNode.id, "canvas-rendered-by", {
|
|
94
|
-
domain: "cross-domain",
|
|
95
|
-
matchScore: match.score
|
|
96
|
-
});
|
|
97
|
-
correlations.push({
|
|
98
|
-
skiaNodeId: item.id,
|
|
99
|
-
matchedObjectId: match.objectId,
|
|
100
|
-
matchedObjectName: match.name,
|
|
101
|
-
matchScore: match.score
|
|
102
|
-
});
|
|
103
|
-
matchedIds.add(item.id);
|
|
104
|
-
} else unmatchedSkiaNodes.push(item.id);
|
|
105
|
-
}
|
|
106
|
-
return {
|
|
107
|
-
skiaNodes: totalSkiaNodes,
|
|
108
|
-
correlations,
|
|
109
|
-
unmatchedSkiaNodes,
|
|
110
|
-
confidence: totalSkiaNodes === 0 ? 0 : correlations.length / totalSkiaNodes,
|
|
111
|
-
graphNodeIds
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
//#endregion
|
|
115
|
-
//#region src/server/domains/cross-domain/handlers/mojo-cdp-correlator.ts
|
|
116
|
-
/** Mapping of Mojo interface patterns to CDP event patterns. */
|
|
117
|
-
const INTERFACE_TO_CDP_PATTERNS = [
|
|
118
|
-
{
|
|
119
|
-
mojoPattern: /URLLoader/i,
|
|
120
|
-
cdpPattern: /Network\./i
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
mojoPattern: /WebSocket/i,
|
|
124
|
-
cdpPattern: /Network\.webSocket/i
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
mojoPattern: /Fetch/i,
|
|
128
|
-
cdpPattern: /Fetch\./i
|
|
129
|
-
}
|
|
130
|
-
];
|
|
131
|
-
const TIMESTAMP_PROXIMITY_MS = 50;
|
|
132
|
-
function correlateMojoToCDP(bridge, mojoMessages, cdpEvents, networkRequests) {
|
|
133
|
-
const graphNodeIds = [];
|
|
134
|
-
const matchedPairs = [];
|
|
135
|
-
const matchedMojoIds = /* @__PURE__ */ new Set();
|
|
136
|
-
if (mojoMessages.length === 0) return {
|
|
137
|
-
mojoMessages: 0,
|
|
138
|
-
matchedPairs: [],
|
|
139
|
-
unmatchedMojo: [],
|
|
140
|
-
confidence: 0,
|
|
141
|
-
graphNodeIds: []
|
|
142
|
-
};
|
|
143
|
-
const mojoNodeMap = /* @__PURE__ */ new Map();
|
|
144
|
-
for (const msg of mojoMessages) {
|
|
145
|
-
const node = bridge.addMojoMessage({
|
|
146
|
-
interface: msg.interface,
|
|
147
|
-
method: msg.method,
|
|
148
|
-
timestamp: msg.timestamp
|
|
149
|
-
});
|
|
150
|
-
mojoNodeMap.set(msg.messageId, node.id);
|
|
151
|
-
graphNodeIds.push(node.id);
|
|
152
|
-
}
|
|
153
|
-
for (const msg of mojoMessages) {
|
|
154
|
-
if (matchedMojoIds.has(msg.messageId)) continue;
|
|
155
|
-
for (const pattern of INTERFACE_TO_CDP_PATTERNS) {
|
|
156
|
-
if (!pattern.mojoPattern.test(msg.interface)) continue;
|
|
157
|
-
const matchingCdp = cdpEvents.find((evt) => pattern.cdpPattern.test(evt.eventType) && !matchedMojoIds.has(msg.messageId));
|
|
158
|
-
if (matchingCdp) {
|
|
159
|
-
matchedPairs.push({
|
|
160
|
-
mojoMessageId: msg.messageId,
|
|
161
|
-
matchType: "interface",
|
|
162
|
-
cdpEventType: matchingCdp.eventType
|
|
163
|
-
});
|
|
164
|
-
matchedMojoIds.add(msg.messageId);
|
|
165
|
-
break;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
for (const msg of mojoMessages) {
|
|
170
|
-
if (matchedMojoIds.has(msg.messageId)) continue;
|
|
171
|
-
if (/URLLoader/i.test(msg.interface)) {
|
|
172
|
-
const matchingReq = networkRequests.find((req) => Math.abs(req.timestamp - msg.timestamp) <= TIMESTAMP_PROXIMITY_MS);
|
|
173
|
-
if (matchingReq) {
|
|
174
|
-
matchedPairs.push({
|
|
175
|
-
mojoMessageId: msg.messageId,
|
|
176
|
-
matchType: "urlloader",
|
|
177
|
-
networkRequestId: matchingReq.requestId,
|
|
178
|
-
timestampDelta: Math.abs(matchingReq.timestamp - msg.timestamp)
|
|
179
|
-
});
|
|
180
|
-
matchedMojoIds.add(msg.messageId);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
for (const msg of mojoMessages) {
|
|
185
|
-
if (matchedMojoIds.has(msg.messageId)) continue;
|
|
186
|
-
let closestDelta = Infinity;
|
|
187
|
-
let closestCdp;
|
|
188
|
-
for (const evt of cdpEvents) {
|
|
189
|
-
const delta = Math.abs(evt.timestamp - msg.timestamp);
|
|
190
|
-
if (delta <= TIMESTAMP_PROXIMITY_MS && delta < closestDelta) {
|
|
191
|
-
closestDelta = delta;
|
|
192
|
-
closestCdp = evt;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
if (closestCdp) {
|
|
196
|
-
matchedPairs.push({
|
|
197
|
-
mojoMessageId: msg.messageId,
|
|
198
|
-
matchType: "timestamp",
|
|
199
|
-
cdpEventType: closestCdp.eventType,
|
|
200
|
-
timestampDelta: closestDelta
|
|
201
|
-
});
|
|
202
|
-
matchedMojoIds.add(msg.messageId);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
const unmatchedMojo = mojoMessages.filter((msg) => !matchedMojoIds.has(msg.messageId)).map((msg) => msg.messageId);
|
|
206
|
-
const confidence = mojoMessages.length === 0 ? 0 : matchedMojoIds.size / mojoMessages.length;
|
|
207
|
-
return {
|
|
208
|
-
mojoMessages: mojoMessages.length,
|
|
209
|
-
matchedPairs,
|
|
210
|
-
unmatchedMojo,
|
|
211
|
-
confidence,
|
|
212
|
-
graphNodeIds
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
//#endregion
|
|
216
|
-
//#region src/server/domains/cross-domain/handlers/syscall-js-correlator.ts
|
|
217
|
-
/**
|
|
218
|
-
* Patterns mapping syscall names to JS API patterns for confidence scoring.
|
|
219
|
-
* If the JS function name matches a pattern associated with a syscall, confidence is higher.
|
|
220
|
-
*/
|
|
221
|
-
const SYSCALL_JS_PATTERNS = {
|
|
222
|
-
NtReadFile: /read|fs[_.]read/i,
|
|
223
|
-
NtWriteFile: /write|fs[_.]write/i,
|
|
224
|
-
NtOpenFile: /open|fs[_.]open/i,
|
|
225
|
-
NtCreateFile: /create|fs[_.]create/i,
|
|
226
|
-
NtClose: /close|fs[_.]close/i,
|
|
227
|
-
NtDeviceIoControlFile: /ioctl|device/i,
|
|
228
|
-
NtQueryInformationFile: /stat|info|query/i,
|
|
229
|
-
NtSetInformationFile: /set|chmod|chown/i
|
|
230
|
-
};
|
|
231
|
-
function scoreConfidence(syscallName, functionName) {
|
|
232
|
-
const pattern = SYSCALL_JS_PATTERNS[syscallName];
|
|
233
|
-
if (pattern && pattern.test(functionName)) return "high";
|
|
234
|
-
if (/file|fs|read|write|open|close/i.test(functionName)) return "medium";
|
|
235
|
-
return "low";
|
|
236
|
-
}
|
|
237
|
-
function correlateSyscallToJS(bridge, syscallEvents, jsStacks) {
|
|
238
|
-
const graphNodeIds = [];
|
|
239
|
-
const correlations = [];
|
|
240
|
-
const unmatchedSyscalls = [];
|
|
241
|
-
if (syscallEvents.length === 0) return {
|
|
242
|
-
syscalls: 0,
|
|
243
|
-
correlations: [],
|
|
244
|
-
unmatchedSyscalls: [],
|
|
245
|
-
correlationConfidence: 0,
|
|
246
|
-
graphNodeIds: []
|
|
247
|
-
};
|
|
248
|
-
for (const event of syscallEvents) {
|
|
249
|
-
const syscallNode = bridge.addSyscallEvent({
|
|
250
|
-
pid: event.pid,
|
|
251
|
-
tid: event.tid,
|
|
252
|
-
syscallName: event.syscallName,
|
|
253
|
-
timestamp: event.timestamp
|
|
254
|
-
});
|
|
255
|
-
graphNodeIds.push(syscallNode.id);
|
|
256
|
-
const matchingStack = jsStacks.find((stack) => stack.threadId === event.tid && stack.timestamp === event.timestamp);
|
|
257
|
-
if (matchingStack && matchingStack.frames.length > 0) {
|
|
258
|
-
const topFrame = matchingStack.frames[0];
|
|
259
|
-
if (topFrame) {
|
|
260
|
-
const functionName = topFrame.functionName;
|
|
261
|
-
const confidence = scoreConfidence(event.syscallName, functionName);
|
|
262
|
-
const funcNode = bridge.addNode("function", functionName, {
|
|
263
|
-
domain: "v8-inspector",
|
|
264
|
-
functionName,
|
|
265
|
-
threadId: event.tid
|
|
266
|
-
});
|
|
267
|
-
graphNodeIds.push(funcNode.id);
|
|
268
|
-
bridge.getGraph().addEdge(funcNode.id, syscallNode.id, "syscall-emitted-by", {
|
|
269
|
-
domain: "cross-domain",
|
|
270
|
-
confidence
|
|
271
|
-
});
|
|
272
|
-
correlations.push({
|
|
273
|
-
syscallName: event.syscallName,
|
|
274
|
-
topJsFunction: functionName,
|
|
275
|
-
threadId: event.tid,
|
|
276
|
-
timestamp: event.timestamp,
|
|
277
|
-
confidence
|
|
278
|
-
});
|
|
279
|
-
} else unmatchedSyscalls.push({
|
|
280
|
-
syscallName: event.syscallName,
|
|
281
|
-
tid: event.tid
|
|
282
|
-
});
|
|
283
|
-
} else unmatchedSyscalls.push({
|
|
284
|
-
syscallName: event.syscallName,
|
|
285
|
-
tid: event.tid
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
const correlationConfidence = syscallEvents.length === 0 ? 0 : correlations.length / syscallEvents.length;
|
|
289
|
-
return {
|
|
290
|
-
syscalls: syscallEvents.length,
|
|
291
|
-
correlations,
|
|
292
|
-
unmatchedSyscalls,
|
|
293
|
-
correlationConfidence,
|
|
294
|
-
graphNodeIds
|
|
295
|
-
};
|
|
296
|
-
}
|
|
297
|
-
//#endregion
|
|
298
|
-
//#region src/server/domains/cross-domain/handlers/binary-to-js-pipeline.ts
|
|
299
|
-
/** Patterns that identify functions callable from JS or exported for JS use. */
|
|
300
|
-
const JS_CALLABLE_PATTERNS = [
|
|
301
|
-
/^native_/i,
|
|
302
|
-
/^JS_/i,
|
|
303
|
-
/^Java_/i
|
|
304
|
-
];
|
|
305
|
-
function isJSCallable(func) {
|
|
306
|
-
if (func.calledFrom && func.calledFrom.length > 0) return true;
|
|
307
|
-
return JS_CALLABLE_PATTERNS.some((pattern) => pattern.test(func.name));
|
|
308
|
-
}
|
|
309
|
-
function generateFridaHookCode(functions, moduleName) {
|
|
310
|
-
const lines = [];
|
|
311
|
-
lines.push("// Binary-to-JS Hook Script");
|
|
312
|
-
lines.push(`// Module: ${moduleName}`);
|
|
313
|
-
lines.push(`// Generated at: ${(/* @__PURE__ */ new Date()).toISOString()}`);
|
|
314
|
-
lines.push("");
|
|
315
|
-
for (const func of functions) {
|
|
316
|
-
const resolvedModule = func.moduleName || moduleName;
|
|
317
|
-
if (func.address) {
|
|
318
|
-
lines.push(`// Hook: ${func.name} at ${func.address} in ${resolvedModule}`);
|
|
319
|
-
lines.push(`Interceptor.attach(Module.findBaseAddress('${resolvedModule}').add(${func.address}), {`);
|
|
320
|
-
} else {
|
|
321
|
-
lines.push(`// Hook: ${func.name} in ${resolvedModule}`);
|
|
322
|
-
lines.push(`Interceptor.attach(Module.findExportByName('${resolvedModule}', '${func.name}'), {`);
|
|
323
|
-
}
|
|
324
|
-
lines.push(` onEnter(args) {`);
|
|
325
|
-
lines.push(` console.log('[${func.name}] called with args:', args[0], args[1]);`);
|
|
326
|
-
lines.push(` },`);
|
|
327
|
-
lines.push(` onLeave(retval) {`);
|
|
328
|
-
lines.push(` console.log('[${func.name}] returned:', retval);`);
|
|
329
|
-
lines.push(` }`);
|
|
330
|
-
lines.push(`});`);
|
|
331
|
-
lines.push("");
|
|
332
|
-
}
|
|
333
|
-
lines.push(`console.log('Binary-to-JS hook script loaded for ${moduleName}');`);
|
|
334
|
-
return lines.join("\n");
|
|
335
|
-
}
|
|
336
|
-
function buildBinaryToJSPipeline(bridge, ghidraOutput, forcedFunctions) {
|
|
337
|
-
const evidenceGraphLinks = [];
|
|
338
|
-
const injectedFunctions = [];
|
|
339
|
-
let selectedFunctions;
|
|
340
|
-
if (forcedFunctions && forcedFunctions.length > 0) {
|
|
341
|
-
const forcedSet = new Set(forcedFunctions);
|
|
342
|
-
selectedFunctions = ghidraOutput.functions.filter((f) => forcedSet.has(f.name));
|
|
343
|
-
} else selectedFunctions = ghidraOutput.functions.filter(isJSCallable);
|
|
344
|
-
const generatedHookScript = generateFridaHookCode(selectedFunctions, ghidraOutput.moduleName);
|
|
345
|
-
for (const func of selectedFunctions) {
|
|
346
|
-
const symbolNode = bridge.addBinarySymbol({
|
|
347
|
-
moduleName: func.moduleName || ghidraOutput.moduleName,
|
|
348
|
-
symbolName: func.name,
|
|
349
|
-
address: func.address ?? "0x0"
|
|
350
|
-
});
|
|
351
|
-
const hookNode = bridge.addNode("breakpoint-hook", `frida:${func.name}`, {
|
|
352
|
-
domain: "binary-instrument",
|
|
353
|
-
hookType: "frida-interceptor",
|
|
354
|
-
functionName: func.name,
|
|
355
|
-
moduleName: func.moduleName || ghidraOutput.moduleName
|
|
356
|
-
});
|
|
357
|
-
bridge.getGraph().addEdge(symbolNode.id, hookNode.id, "binary-exports", {
|
|
358
|
-
domain: "cross-domain",
|
|
359
|
-
relation: "binary-to-frida-hook"
|
|
360
|
-
});
|
|
361
|
-
evidenceGraphLinks.push({
|
|
362
|
-
binarySymbolNodeId: symbolNode.id,
|
|
363
|
-
hookScriptNodeId: hookNode.id,
|
|
364
|
-
functionName: func.name
|
|
365
|
-
});
|
|
366
|
-
injectedFunctions.push(func.name);
|
|
367
|
-
}
|
|
368
|
-
return {
|
|
369
|
-
hookCount: selectedFunctions.length,
|
|
370
|
-
generatedHookScript,
|
|
371
|
-
injectedFunctions,
|
|
372
|
-
evidenceGraphLinks
|
|
373
|
-
};
|
|
374
|
-
}
|
|
375
|
-
//#endregion
|
|
376
|
-
//#region src/server/domains/cross-domain/workflows/missions.ts
|
|
377
|
-
const WORKFLOWS = {
|
|
378
|
-
WORKFLOW_REVERSE_OBFUSCATED: {
|
|
379
|
-
id: "reverse-obfuscated-api",
|
|
380
|
-
displayName: "Reverse Obfuscated API",
|
|
381
|
-
steps: [
|
|
382
|
-
{
|
|
383
|
-
tool: "deobfuscate",
|
|
384
|
-
args: { targetUrl: "${input.targetUrl}" }
|
|
385
|
-
},
|
|
386
|
-
{
|
|
387
|
-
tool: "js_heap_search",
|
|
388
|
-
args: { query: "${previous.cryptoKeys}" }
|
|
389
|
-
},
|
|
390
|
-
{
|
|
391
|
-
tool: "network_enable",
|
|
392
|
-
args: {}
|
|
393
|
-
},
|
|
394
|
-
{
|
|
395
|
-
tool: "tls_cert_pin_bypass",
|
|
396
|
-
args: { target: "${input.target}" }
|
|
397
|
-
},
|
|
398
|
-
{
|
|
399
|
-
tool: "console_inject_fetch_interceptor",
|
|
400
|
-
args: { urls: ["${input.apiEndpoint}"] }
|
|
401
|
-
}
|
|
402
|
-
]
|
|
403
|
-
},
|
|
404
|
-
WORKFLOW_GAME_CANVAS_SKIA: {
|
|
405
|
-
id: "game-canvas-skia-v8",
|
|
406
|
-
displayName: "Game Canvas + SKIA + V8 Analysis",
|
|
407
|
-
steps: [
|
|
408
|
-
{
|
|
409
|
-
tool: "canvas_engine_fingerprint",
|
|
410
|
-
args: { canvasId: "${input.canvasId}" }
|
|
411
|
-
},
|
|
412
|
-
{
|
|
413
|
-
tool: "canvas_scene_dump",
|
|
414
|
-
args: { canvasId: "${input.canvasId}" }
|
|
415
|
-
},
|
|
416
|
-
{
|
|
417
|
-
tool: "skia_correlate_objects",
|
|
418
|
-
args: { skiaNodeIds: "${previous.nodeIds}" }
|
|
419
|
-
},
|
|
420
|
-
{
|
|
421
|
-
tool: "performance_take_heap_snapshot",
|
|
422
|
-
args: {}
|
|
423
|
-
},
|
|
424
|
-
{
|
|
425
|
-
tool: "js_heap_search",
|
|
426
|
-
args: { query: "${input.searchTerm}" }
|
|
427
|
-
}
|
|
428
|
-
]
|
|
429
|
-
},
|
|
430
|
-
WORKFLOW_BINARY_NATIVE_HOOK: {
|
|
431
|
-
id: "binary-native-hook",
|
|
432
|
-
displayName: "Binary Analysis + Native Hook",
|
|
433
|
-
steps: [
|
|
434
|
-
{
|
|
435
|
-
tool: "ghidra_analyze",
|
|
436
|
-
args: { binaryPath: "${input.binaryPath}" }
|
|
437
|
-
},
|
|
438
|
-
{
|
|
439
|
-
tool: "generate_hooks",
|
|
440
|
-
args: { symbols: "${previous.exportedSymbols}" }
|
|
441
|
-
},
|
|
442
|
-
{
|
|
443
|
-
tool: "frida_attach",
|
|
444
|
-
args: { target: "${input.target}" }
|
|
445
|
-
},
|
|
446
|
-
{
|
|
447
|
-
tool: "frida_run_script",
|
|
448
|
-
args: { script: "${previous.hookScript}" }
|
|
449
|
-
}
|
|
450
|
-
]
|
|
451
|
-
}
|
|
452
|
-
};
|
|
453
|
-
//#endregion
|
|
454
|
-
//#region src/server/domains/cross-domain/handlers.impl.ts
|
|
455
|
-
function isRecord(value) {
|
|
456
|
-
return value !== null && typeof value === "object";
|
|
457
|
-
}
|
|
458
|
-
function extractSkiaSceneTree(value) {
|
|
459
|
-
if (!isRecord(value)) return {
|
|
460
|
-
layers: [],
|
|
461
|
-
drawCommands: []
|
|
462
|
-
};
|
|
463
|
-
return {
|
|
464
|
-
layers: Array.isArray(value["layers"]) ? value["layers"] : [],
|
|
465
|
-
drawCommands: Array.isArray(value["drawCommands"]) ? value["drawCommands"] : []
|
|
466
|
-
};
|
|
467
|
-
}
|
|
468
|
-
function extractJSObjectArray(value) {
|
|
469
|
-
if (!Array.isArray(value)) return [];
|
|
470
|
-
return value.filter(isRecord).map((item) => ({
|
|
471
|
-
objectId: typeof item["objectId"] === "string" ? item["objectId"] : "",
|
|
472
|
-
className: typeof item["className"] === "string" ? item["className"] : "",
|
|
473
|
-
name: typeof item["name"] === "string" ? item["name"] : "",
|
|
474
|
-
stringProps: Array.isArray(item["stringProps"]) ? item["stringProps"].filter((s) => typeof s === "string") : [],
|
|
475
|
-
numericProps: isRecord(item["numericProps"]) ? Object.fromEntries(Object.entries(item["numericProps"]).filter((entry) => typeof entry[1] === "number")) : {},
|
|
476
|
-
colorProps: Array.isArray(item["colorProps"]) ? item["colorProps"].filter((s) => typeof s === "string") : [],
|
|
477
|
-
urlProps: Array.isArray(item["urlProps"]) ? item["urlProps"].filter((s) => typeof s === "string") : []
|
|
478
|
-
}));
|
|
479
|
-
}
|
|
480
|
-
function extractMojoMessages(value) {
|
|
481
|
-
if (!Array.isArray(value)) return [];
|
|
482
|
-
return value.filter(isRecord).map((item) => ({
|
|
483
|
-
interface: typeof item["interface"] === "string" ? item["interface"] : "",
|
|
484
|
-
method: typeof item["method"] === "string" ? item["method"] : "",
|
|
485
|
-
timestamp: typeof item["timestamp"] === "number" ? item["timestamp"] : 0,
|
|
486
|
-
messageId: typeof item["messageId"] === "string" ? item["messageId"] : ""
|
|
487
|
-
}));
|
|
488
|
-
}
|
|
489
|
-
function extractCDPEvents(value) {
|
|
490
|
-
if (!Array.isArray(value)) return [];
|
|
491
|
-
return value.filter(isRecord).map((item) => ({
|
|
492
|
-
eventType: typeof item["eventType"] === "string" ? item["eventType"] : "",
|
|
493
|
-
timestamp: typeof item["timestamp"] === "number" ? item["timestamp"] : 0,
|
|
494
|
-
url: typeof item["url"] === "string" ? item["url"] : void 0
|
|
495
|
-
}));
|
|
496
|
-
}
|
|
497
|
-
function extractNetworkRequests(value) {
|
|
498
|
-
if (!Array.isArray(value)) return [];
|
|
499
|
-
return value.filter(isRecord).map((item) => ({
|
|
500
|
-
requestId: typeof item["requestId"] === "string" ? item["requestId"] : "",
|
|
501
|
-
url: typeof item["url"] === "string" ? item["url"] : "",
|
|
502
|
-
timestamp: typeof item["timestamp"] === "number" ? item["timestamp"] : 0
|
|
503
|
-
}));
|
|
504
|
-
}
|
|
505
|
-
function extractSyscallEvents(value) {
|
|
506
|
-
if (!Array.isArray(value)) return [];
|
|
507
|
-
return value.filter(isRecord).map((item) => ({
|
|
508
|
-
pid: typeof item["pid"] === "number" ? item["pid"] : 0,
|
|
509
|
-
tid: typeof item["tid"] === "number" ? item["tid"] : 0,
|
|
510
|
-
syscallName: typeof item["syscallName"] === "string" ? item["syscallName"] : "",
|
|
511
|
-
timestamp: typeof item["timestamp"] === "number" ? item["timestamp"] : 0
|
|
512
|
-
}));
|
|
513
|
-
}
|
|
514
|
-
function extractJSStacks(value) {
|
|
515
|
-
if (!Array.isArray(value)) return [];
|
|
516
|
-
return value.filter(isRecord).map((item) => {
|
|
517
|
-
const frames = Array.isArray(item["frames"]) ? item["frames"].filter(isRecord).map((f) => ({ functionName: typeof f["functionName"] === "string" ? f["functionName"] : "" })) : [];
|
|
518
|
-
return {
|
|
519
|
-
threadId: typeof item["threadId"] === "number" ? item["threadId"] : 0,
|
|
520
|
-
timestamp: typeof item["timestamp"] === "number" ? item["timestamp"] : 0,
|
|
521
|
-
frames
|
|
522
|
-
};
|
|
523
|
-
});
|
|
524
|
-
}
|
|
525
|
-
function extractGhidraOutput(value) {
|
|
526
|
-
if (!isRecord(value)) return null;
|
|
527
|
-
const moduleName = typeof value["moduleName"] === "string" ? value["moduleName"] : "";
|
|
528
|
-
if (!moduleName) return null;
|
|
529
|
-
return {
|
|
530
|
-
functions: (Array.isArray(value["functions"]) ? value["functions"] : []).filter(isRecord).map((item) => ({
|
|
531
|
-
name: typeof item["name"] === "string" ? item["name"] : "",
|
|
532
|
-
moduleName: typeof item["moduleName"] === "string" ? item["moduleName"] : "",
|
|
533
|
-
address: typeof item["address"] === "string" ? item["address"] : void 0,
|
|
534
|
-
calledFrom: Array.isArray(item["calledFrom"]) ? item["calledFrom"].filter((c) => typeof c === "string") : void 0
|
|
535
|
-
})),
|
|
536
|
-
moduleName
|
|
537
|
-
};
|
|
538
|
-
}
|
|
539
|
-
const V5_DOMAIN_NAMES = [
|
|
540
|
-
"analysis",
|
|
541
|
-
"browser",
|
|
542
|
-
"network",
|
|
543
|
-
"canvas",
|
|
544
|
-
"skia-capture",
|
|
545
|
-
"v8-inspector",
|
|
546
|
-
"mojo-ipc",
|
|
547
|
-
"syscall-hook",
|
|
548
|
-
"binary-instrument",
|
|
549
|
-
"boringssl-inspector",
|
|
550
|
-
"evidence"
|
|
551
|
-
];
|
|
552
|
-
var CrossDomainWorkflowClassifier = class {
|
|
553
|
-
constructor(ctx, evidenceBridgeReady) {
|
|
554
|
-
this.ctx = ctx;
|
|
555
|
-
this.evidenceBridgeReady = evidenceBridgeReady;
|
|
556
|
-
}
|
|
557
|
-
getCapabilities() {
|
|
558
|
-
const availableDomains = this.getAvailableDomains();
|
|
559
|
-
const missingDomains = V5_DOMAIN_NAMES.filter((d) => !availableDomains.includes(d));
|
|
560
|
-
const workflows = Object.entries(WORKFLOWS).map(([workflowKey, workflow]) => {
|
|
561
|
-
const evaluation = this.evaluateWorkflow(workflow);
|
|
562
|
-
return {
|
|
563
|
-
workflowKey,
|
|
564
|
-
id: workflow.id,
|
|
565
|
-
displayName: workflow.displayName,
|
|
566
|
-
stepCount: workflow.steps.length,
|
|
567
|
-
...evaluation
|
|
568
|
-
};
|
|
569
|
-
});
|
|
570
|
-
return {
|
|
571
|
-
availableDomains,
|
|
572
|
-
missingDomains,
|
|
573
|
-
supportedDomains: [...V5_DOMAIN_NAMES],
|
|
574
|
-
workflows
|
|
575
|
-
};
|
|
576
|
-
}
|
|
577
|
-
suggestWorkflow(goal, preferAvailableOnly) {
|
|
578
|
-
const normalizedGoal = goal.toLowerCase();
|
|
579
|
-
const scored = Object.entries(WORKFLOWS).map(([workflowKey, workflow]) => {
|
|
580
|
-
return {
|
|
581
|
-
workflowKey,
|
|
582
|
-
workflow,
|
|
583
|
-
keywordScore: this.scoreWorkflowGoal(normalizedGoal, workflowKey, workflow),
|
|
584
|
-
evaluation: this.evaluateWorkflow(workflow)
|
|
585
|
-
};
|
|
586
|
-
});
|
|
587
|
-
const candidates = preferAvailableOnly ? scored.filter((item) => item.evaluation.missingDomains.length === 0) : scored;
|
|
588
|
-
const rankedPool = candidates.length > 0 ? candidates : scored;
|
|
589
|
-
rankedPool.sort((a, b) => {
|
|
590
|
-
if (b.keywordScore !== a.keywordScore) return b.keywordScore - a.keywordScore;
|
|
591
|
-
return b.evaluation.coverage - a.evaluation.coverage;
|
|
592
|
-
});
|
|
593
|
-
const selected = rankedPool[0];
|
|
594
|
-
if (!selected) throw new Error("No workflow definitions are available for cross-domain suggestion");
|
|
595
|
-
const reason = this.describeWorkflowReason(normalizedGoal, selected.evaluation);
|
|
596
|
-
return {
|
|
597
|
-
workflowKey: selected.workflowKey,
|
|
598
|
-
id: selected.workflow.id,
|
|
599
|
-
displayName: selected.workflow.displayName,
|
|
600
|
-
reason,
|
|
601
|
-
...selected.evaluation
|
|
602
|
-
};
|
|
603
|
-
}
|
|
604
|
-
getHealth() {
|
|
605
|
-
const availableDomains = this.getAvailableDomains();
|
|
606
|
-
return {
|
|
607
|
-
evidenceBridgeReady: this.evidenceBridgeReady,
|
|
608
|
-
orchestratorReady: true,
|
|
609
|
-
availableDomains,
|
|
610
|
-
missingDomains: V5_DOMAIN_NAMES.filter((d) => !availableDomains.includes(d))
|
|
611
|
-
};
|
|
612
|
-
}
|
|
613
|
-
getAvailableDomains() {
|
|
614
|
-
const currentEnabledDomains = this.ctx.enabledDomains.size > 0 ? this.ctx.enabledDomains : this.ctx.resolveEnabledDomains(this.ctx.selectedTools);
|
|
615
|
-
const available = [];
|
|
616
|
-
for (const d of V5_DOMAIN_NAMES) if (currentEnabledDomains.has(d)) available.push(d);
|
|
617
|
-
return available;
|
|
618
|
-
}
|
|
619
|
-
evaluateWorkflow(workflow) {
|
|
620
|
-
const requiredSet = /* @__PURE__ */ new Set();
|
|
621
|
-
for (const step of workflow.steps) for (const d of this.inferDomainsForTool(step.tool)) requiredSet.add(d);
|
|
622
|
-
const requiredDomains = [...requiredSet];
|
|
623
|
-
const available = this.getAvailableDomains().filter((d) => requiredSet.has(d));
|
|
624
|
-
return {
|
|
625
|
-
requiredDomains,
|
|
626
|
-
availableDomains: available,
|
|
627
|
-
missingDomains: requiredDomains.filter((d) => !available.includes(d)),
|
|
628
|
-
coverage: requiredDomains.length === 0 ? 1 : available.length / requiredDomains.length
|
|
629
|
-
};
|
|
630
|
-
}
|
|
631
|
-
inferDomainsForTool(toolName) {
|
|
632
|
-
if (toolName.startsWith("deobfuscate") || toolName.startsWith("advanced_deobfuscate")) return ["analysis"];
|
|
633
|
-
if (toolName.startsWith("js_heap") || toolName.startsWith("performance_take_heap_snapshot")) return ["v8-inspector"];
|
|
634
|
-
if (toolName.startsWith("network_")) return ["network"];
|
|
635
|
-
if (toolName.startsWith("console_")) return ["browser"];
|
|
636
|
-
if (toolName.startsWith("tls_") || toolName.startsWith("net_raw_")) return ["boringssl-inspector"];
|
|
637
|
-
if (toolName.startsWith("canvas_")) return ["canvas"];
|
|
638
|
-
if (toolName.startsWith("skia_")) return ["skia-capture"];
|
|
639
|
-
if (toolName.startsWith("v8_")) return ["v8-inspector"];
|
|
640
|
-
if (toolName.startsWith("mojo_")) return ["mojo-ipc"];
|
|
641
|
-
if (toolName.startsWith("syscall_")) return ["syscall-hook"];
|
|
642
|
-
if (toolName.startsWith("adb_")) return ["adb-bridge"];
|
|
643
|
-
if (toolName.startsWith("ghidra_") || toolName.startsWith("frida_") || toolName.startsWith("generate_hooks") || toolName.startsWith("unidbg_") || toolName.startsWith("export_hook_script")) return ["binary-instrument"];
|
|
644
|
-
if (toolName.startsWith("extension_") || toolName.startsWith("webhook_")) return ["extension-registry"];
|
|
645
|
-
if (toolName.startsWith("cross_domain_")) return ["cross-domain"];
|
|
646
|
-
if (toolName.startsWith("evidence_")) return ["evidence"];
|
|
647
|
-
if (toolName.startsWith("boringssl_")) return ["boringssl-inspector"];
|
|
648
|
-
return [];
|
|
649
|
-
}
|
|
650
|
-
scoreWorkflowGoal(normalizedGoal, workflowKey, workflow) {
|
|
651
|
-
let score = 0;
|
|
652
|
-
if (workflowKey === "WORKFLOW_REVERSE_OBFUSCATED") {
|
|
653
|
-
if (normalizedGoal.includes("obfus") || normalizedGoal.includes("api")) score += 3;
|
|
654
|
-
if (normalizedGoal.includes("tls") || normalizedGoal.includes("pin")) score += 2;
|
|
655
|
-
}
|
|
656
|
-
if (workflowKey === "WORKFLOW_GAME_CANVAS_SKIA") {
|
|
657
|
-
if (normalizedGoal.includes("canvas") || normalizedGoal.includes("game")) score += 3;
|
|
658
|
-
if (normalizedGoal.includes("skia") || normalizedGoal.includes("scene")) score += 2;
|
|
659
|
-
}
|
|
660
|
-
if (workflowKey === "WORKFLOW_BINARY_NATIVE_HOOK") {
|
|
661
|
-
if (normalizedGoal.includes("binary") || normalizedGoal.includes("native")) score += 3;
|
|
662
|
-
if (normalizedGoal.includes("hook") || normalizedGoal.includes("frida")) score += 2;
|
|
663
|
-
}
|
|
664
|
-
if (score === 0 && workflow.displayName.toLowerCase().includes(normalizedGoal)) score += 1;
|
|
665
|
-
return score;
|
|
666
|
-
}
|
|
667
|
-
describeWorkflowReason(normalizedGoal, evaluation) {
|
|
668
|
-
if (evaluation.missingDomains.length === 0) return `Matched goal "${normalizedGoal}" and all required domains are enabled.`;
|
|
669
|
-
return `Matched goal "${normalizedGoal}" with ${Math.round(evaluation.coverage * 100)}% domain coverage. Missing: ${evaluation.missingDomains.join(", ")}.`;
|
|
670
|
-
}
|
|
671
|
-
};
|
|
672
|
-
var CrossDomainHandlers = class {
|
|
673
|
-
constructor(evidenceBridge, workflowClassifier) {
|
|
674
|
-
this.evidenceBridge = evidenceBridge;
|
|
675
|
-
this.workflowClassifier = workflowClassifier;
|
|
676
|
-
}
|
|
677
|
-
async handleCapabilities(_args) {
|
|
678
|
-
const capabilities = {
|
|
679
|
-
evidenceGraphAvailable: true,
|
|
680
|
-
workflowClassifierAvailable: this.workflowClassifier !== void 0
|
|
681
|
-
};
|
|
682
|
-
if (this.workflowClassifier) return asJsonResponse({
|
|
683
|
-
capabilities,
|
|
684
|
-
...this.workflowClassifier.getCapabilities()
|
|
685
|
-
});
|
|
686
|
-
return asJsonResponse({ capabilities });
|
|
687
|
-
}
|
|
688
|
-
async handleSuggestWorkflow(args) {
|
|
689
|
-
const query = argString(args, "query", "") || argString(args, "goal", "");
|
|
690
|
-
const preferAvailableOnly = argBool(args, "preferAvailableOnly", true);
|
|
691
|
-
if (this.workflowClassifier && query) return asJsonResponse(this.workflowClassifier.suggestWorkflow(query, preferAvailableOnly));
|
|
692
|
-
return asJsonResponse({ message: "Cross-domain workflow suggestion requires a classifier and query." });
|
|
693
|
-
}
|
|
694
|
-
async handleHealth() {
|
|
695
|
-
const stats = this.evidenceBridge.getStats();
|
|
696
|
-
if (this.workflowClassifier) return asJsonResponse({
|
|
697
|
-
...this.workflowClassifier.getHealth(),
|
|
698
|
-
evidenceGraph: stats
|
|
699
|
-
});
|
|
700
|
-
return asJsonResponse({
|
|
701
|
-
evidenceBridgeReady: true,
|
|
702
|
-
orchestratorReady: false,
|
|
703
|
-
evidenceGraph: stats
|
|
704
|
-
});
|
|
705
|
-
}
|
|
706
|
-
async handleCorrelateAll(args) {
|
|
707
|
-
const errors = [];
|
|
708
|
-
const results = {};
|
|
709
|
-
try {
|
|
710
|
-
const sceneTree = extractSkiaSceneTree(args["sceneTree"]);
|
|
711
|
-
const jsObjects = extractJSObjectArray(args["jsObjects"]);
|
|
712
|
-
results["skia"] = correlateSkiaToJS(this.evidenceBridge, {
|
|
713
|
-
sceneTree,
|
|
714
|
-
jsObjects
|
|
715
|
-
});
|
|
716
|
-
} catch (e) {
|
|
717
|
-
errors.push(`SKIA-03: ${e instanceof Error ? e.message : String(e)}`);
|
|
718
|
-
}
|
|
719
|
-
try {
|
|
720
|
-
const mojoMessages = extractMojoMessages(args["mojoMessages"]);
|
|
721
|
-
const cdpEvents = extractCDPEvents(args["cdpEvents"]);
|
|
722
|
-
const networkRequests = extractNetworkRequests(args["networkRequests"]);
|
|
723
|
-
results["mojo"] = correlateMojoToCDP(this.evidenceBridge, mojoMessages, cdpEvents, networkRequests);
|
|
724
|
-
} catch (e) {
|
|
725
|
-
errors.push(`MOJO-03: ${e instanceof Error ? e.message : String(e)}`);
|
|
726
|
-
}
|
|
727
|
-
try {
|
|
728
|
-
const syscallEvents = extractSyscallEvents(args["syscallEvents"]);
|
|
729
|
-
const jsStacks = extractJSStacks(args["jsStacks"]);
|
|
730
|
-
results["syscall"] = correlateSyscallToJS(this.evidenceBridge, syscallEvents, jsStacks);
|
|
731
|
-
} catch (e) {
|
|
732
|
-
errors.push(`SYSCALL-02: ${e instanceof Error ? e.message : String(e)}`);
|
|
733
|
-
}
|
|
734
|
-
try {
|
|
735
|
-
const ghidraOutput = extractGhidraOutput(args["ghidraOutput"]);
|
|
736
|
-
if (ghidraOutput) results["binary"] = buildBinaryToJSPipeline(this.evidenceBridge, ghidraOutput);
|
|
737
|
-
} catch (e) {
|
|
738
|
-
errors.push(`BIN-04: ${e instanceof Error ? e.message : String(e)}`);
|
|
739
|
-
}
|
|
740
|
-
const snapshot = this.evidenceBridge.exportGraph();
|
|
741
|
-
return asJsonResponse({
|
|
742
|
-
correlationResults: {
|
|
743
|
-
...results,
|
|
744
|
-
errors
|
|
745
|
-
},
|
|
746
|
-
evidenceGraph: snapshot
|
|
747
|
-
});
|
|
748
|
-
}
|
|
749
|
-
async handleEvidenceExport() {
|
|
750
|
-
return asJsonResponse(this.evidenceBridge.exportGraph());
|
|
751
|
-
}
|
|
752
|
-
async handleEvidenceStats() {
|
|
753
|
-
return asJsonResponse(this.evidenceBridge.getStats());
|
|
754
|
-
}
|
|
755
|
-
};
|
|
756
|
-
//#endregion
|
|
757
|
-
export { CrossDomainHandlers, CrossDomainWorkflowClassifier };
|