@jshookmcp/jshook 0.3.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (346) hide show
  1. package/LICENSE +661 -661
  2. package/README.md +32 -49
  3. package/README.zh.md +32 -47
  4. package/dist/AntiCheatDetector-B6d4Qe9D.mjs +1 -0
  5. package/dist/BrowserSessionCoordinator-BJ-HOxo0.mjs +1 -0
  6. package/dist/CacheAdapters-CsNtQIR8.mjs +1 -0
  7. package/dist/CodeInjector-Cll_7bLJ.mjs +1 -0
  8. package/dist/ConsoleMonitor-CxDJV15E.mjs +306 -0
  9. package/dist/DOMInspector-C19J4zeq.mjs +95 -0
  10. package/dist/DarwinAPI-ZfQdpLNI.mjs +1 -0
  11. package/dist/DetailedDataManager-DmQ1LT-W.mjs +1 -0
  12. package/dist/EventBus-DL8iLA09.mjs +1 -0
  13. package/dist/EvidenceGraphBridge-BtbwXsLC.mjs +1 -0
  14. package/dist/ExtensionManager-BD724zkO.mjs +1 -0
  15. package/dist/ExtensionManager.tools-oVMJgPcN.mjs +1 -0
  16. package/dist/FingerprintManager-DT0EAUEo.mjs +1 -0
  17. package/dist/HardwareBreakpoint-BUfPdp0f.mjs +1 -0
  18. package/dist/HeapAnalyzer-B_aqY8oj.mjs +1 -0
  19. package/dist/{HookGeneratorBuilders.core.generators.storage-CTbB4Lcx.mjs → HookGeneratorBuilders.core.generators.storage-DzD6dIJd.mjs} +66 -101
  20. package/dist/InstrumentationSession-D_G1ZPyd.mjs +1 -0
  21. package/dist/MCPServer.search.handlers.domain-BbS-6LnX.mjs +1 -0
  22. package/dist/MemoryController-X1XNSn1n.mjs +2 -0
  23. package/dist/MemoryScanSession-DG_F-PjE.mjs +1 -0
  24. package/dist/MemoryScanner-g1_L1ub5.mjs +1 -0
  25. package/dist/NativeMemoryManager.impl-DniBe2wf.mjs +1 -0
  26. package/dist/NativeMemoryManager.utils-BHy1P_jM.mjs +1 -0
  27. package/dist/NetworkMonitor-B_-au6aV.mjs +185 -0
  28. package/dist/PEAnalyzer-yWQaGrcx.mjs +1 -0
  29. package/dist/PageController-Dfsm1_o7.mjs +1 -0
  30. package/dist/PointerChainEngine-BhCUkmxY.mjs +1 -0
  31. package/dist/PrerequisiteError-BjCQA-gK.mjs +1 -0
  32. package/dist/ProcessRegistry-C-bN48oR.mjs +1 -0
  33. package/dist/ResponseBuilder-BfWP-uaT.mjs +1 -0
  34. package/dist/ReverseEvidenceGraph-BhSYYdiI.mjs +2 -0
  35. package/dist/RingBuffer-Dm54ELKT.mjs +1 -0
  36. package/dist/ScriptManager-LWGPTdvD.mjs +7 -0
  37. package/dist/ServerRuntimeState-D2bWHqEE.mjs +1 -0
  38. package/dist/Speedhack-yseDPSZ9.mjs +1 -0
  39. package/dist/StealthVerifier-BmcxfwSF.mjs +1 -0
  40. package/dist/StructureAnalyzer-C5lpuZkg.mjs +2 -0
  41. package/dist/ToolCatalog-CYdD9F5f.mjs +1 -0
  42. package/dist/ToolError-DWU_z7gp.mjs +1 -0
  43. package/dist/ToolProbe-C7ZU2x7M.mjs +1 -0
  44. package/dist/ToolRegistry-C5oB8KP8.mjs +1 -0
  45. package/dist/ToolRouter.policy-CfhJczkt.mjs +4 -0
  46. package/dist/TraceRecorder-BiJWBXHX.mjs +272 -0
  47. package/dist/VersionDetector-CHT36Az0.mjs +9 -0
  48. package/dist/Win32API-eUCF57l_.mjs +1 -0
  49. package/dist/Win32Debug-CYrIQBvr.mjs +1 -0
  50. package/dist/WorkflowEngine-D876meOO.mjs +1 -0
  51. package/dist/analysis-D4swdMvq.mjs +6 -0
  52. package/dist/{antidebug-BRKeyt27.mjs → antidebug-7L3ygj_9.mjs} +8 -259
  53. package/dist/apk-packer-BqXcInnX.mjs +1 -0
  54. package/dist/artifactRetention-BCPQASm7.mjs +1 -0
  55. package/dist/artifacts-CkodUM4j.mjs +1 -0
  56. package/dist/authorization-schema-BOFwSXUN.mjs +1 -0
  57. package/dist/betterSqlite3-Brtq-SIQ.mjs +1 -0
  58. package/dist/binary-instrument-DU7V6TUM.mjs +7 -0
  59. package/dist/binary-secrets-PdMVoyt0.mjs +1 -0
  60. package/dist/bind-helpers-m2U8glkF.mjs +1 -0
  61. package/dist/boringssl-inspector-BBaJwwkU.mjs +2 -0
  62. package/dist/browser-Qqco2rOT.mjs +11 -0
  63. package/dist/capabilities-CyXuKUl1.mjs +1 -0
  64. package/dist/chunk-C_pMuVsO.mjs +1 -0
  65. package/dist/collector-Bpl6qy2L.mjs +1 -0
  66. package/dist/concurrency-DCr8WQ2M.mjs +1 -0
  67. package/dist/constants-BYj8Xek8.mjs +1 -0
  68. package/dist/coordination-CWXW1o8K.mjs +1 -0
  69. package/dist/dart-inspector-7AkPeZ_Q.mjs +0 -0
  70. package/dist/debugger-DyALjYMk.mjs +1 -0
  71. package/dist/definitions-BWxBke3r.mjs +1 -0
  72. package/dist/definitions-BYwATKc-.mjs +1 -0
  73. package/dist/definitions-B_83XfNQ.mjs +1 -0
  74. package/dist/definitions-Bf3H1EwV.mjs +1 -0
  75. package/dist/definitions-BftdXgXI.mjs +1 -0
  76. package/dist/definitions-Bio5XJYy.mjs +1 -0
  77. package/dist/definitions-C3qNgSn1.mjs +1 -0
  78. package/dist/definitions-CB6vmOer.mjs +1 -0
  79. package/dist/definitions-CMZRSy3k.mjs +1 -0
  80. package/dist/definitions-CQd7yCQH.mjs +1 -0
  81. package/dist/definitions-CT8ln6GQ.mjs +1 -0
  82. package/dist/definitions-Cenu6mxo.mjs +1 -0
  83. package/dist/definitions-D4g-MS10.mjs +1 -0
  84. package/dist/definitions-D5wl_8HN.mjs +1 -0
  85. package/dist/definitions-DAQm1Xar.mjs +1 -0
  86. package/dist/definitions-DP1vgxEY.mjs +1 -0
  87. package/dist/definitions-DxFNRQNK2.mjs +1 -0
  88. package/dist/definitions-Ibci7e_L.mjs +1 -0
  89. package/dist/definitions-OeLvmlQy.mjs +1 -0
  90. package/dist/definitions-RZYGD_Ey.mjs +1 -0
  91. package/dist/definitions-Tls8c0A0.mjs +1 -0
  92. package/dist/definitions-bybDvnG0.mjs +26 -0
  93. package/dist/definitions-l7TjdE6V.mjs +1 -0
  94. package/dist/encoding-ycOaz8Vr.mjs +2 -0
  95. package/dist/ensure-browser-core-DxWC-NTp.mjs +1 -0
  96. package/dist/evidence-graph-bridge-CV_UdYqj.mjs +1 -0
  97. package/dist/factory-CKr4fAE1.mjs +1 -0
  98. package/dist/flat-target-session-DvcQX7J5.mjs +1 -0
  99. package/dist/formatAddress-vLA_hOJt.mjs +1 -0
  100. package/dist/graphql-B2TiPEow.mjs +62 -0
  101. package/dist/handlers-0yKLRIfo.mjs +2 -0
  102. package/dist/handlers-8zN_vBIz.mjs +1 -0
  103. package/dist/handlers-B62K4FTc.mjs +1 -0
  104. package/dist/handlers-BpDlVVVU.mjs +1 -0
  105. package/dist/handlers-CMJK7m1c.mjs +31 -0
  106. package/dist/handlers-D2ZOul9p.mjs +54 -0
  107. package/dist/handlers-D5E40ssn.mjs +5 -0
  108. package/dist/handlers-DGbdQAgD.mjs +4 -0
  109. package/dist/handlers-DHO3rjsW.mjs +1 -0
  110. package/dist/handlers-FJ80VzUI.mjs +2 -0
  111. package/dist/handlers-VHWrxbM_.mjs +1 -0
  112. package/dist/handlers-l8QIKqBj.mjs +2 -0
  113. package/dist/handlers-mPFiNPe8.mjs +302 -0
  114. package/dist/{handlers-Dz9PYsCa.mjs → handlers-yo_xYzT8.mjs} +118 -904
  115. package/dist/handlers.impl-D9Hh8Bgl.mjs +1 -0
  116. package/dist/hooks-D4XLfgtV.mjs +600 -0
  117. package/dist/index.mjs +13 -5240
  118. package/dist/jadx-search-B_Yse0Zh.mjs +5 -0
  119. package/dist/logger-sBC6IdRT.mjs +1 -0
  120. package/dist/maintenance-BUpIukhg.mjs +1 -0
  121. package/dist/manifest-0Jpt_AQa.mjs +1 -0
  122. package/dist/manifest-B3fZbSWR.mjs +1 -0
  123. package/dist/manifest-B7NB2rh2.mjs +1 -0
  124. package/dist/manifest-BDi4nbH1.mjs +1 -0
  125. package/dist/manifest-BLDfkE7n.mjs +1 -0
  126. package/dist/manifest-BcXbB4gf.mjs +1 -0
  127. package/dist/manifest-Bdnc_vrc.mjs +1 -0
  128. package/dist/manifest-BuYKgCnp.mjs +1 -0
  129. package/dist/manifest-CBfNnGPV.mjs +1 -0
  130. package/dist/manifest-CPS1Xv69.mjs +1 -0
  131. package/dist/manifest-CQH9FhwI.mjs +1 -0
  132. package/dist/manifest-CRryuZF4.mjs +1 -0
  133. package/dist/manifest-CctIumog.mjs +1 -0
  134. package/dist/manifest-CvTe5ZGV2.mjs +1 -0
  135. package/dist/manifest-D-5GH0DV.mjs +1 -0
  136. package/dist/manifest-D3Ssf3IC.mjs +1 -0
  137. package/dist/manifest-D5ck3NvC.mjs +1 -0
  138. package/dist/manifest-D9jUUJAu.mjs +1 -0
  139. package/dist/manifest-DCx6w2XV.mjs +1 -0
  140. package/dist/manifest-DG19q-Ld.mjs +1 -0
  141. package/dist/manifest-DLMlD0Zc.mjs +1 -0
  142. package/dist/manifest-DYpn8w_h.mjs +1 -0
  143. package/dist/manifest-DYzWI8Xs.mjs +1 -0
  144. package/dist/manifest-D_obs5F4.mjs +1 -0
  145. package/dist/manifest-DujQqEQR.mjs +2 -0
  146. package/dist/manifest-DwL2ik8P.mjs +1 -0
  147. package/dist/manifest-ItF5P8A12.mjs +1 -0
  148. package/dist/manifest-KZphqIyX.mjs +1 -0
  149. package/dist/manifest-LG42zPLY2.mjs +1 -0
  150. package/dist/manifest-LLdI5m4T.mjs +1 -0
  151. package/dist/manifest-QYbQXJn0.mjs +1 -0
  152. package/dist/manifest-RcpX_MyZ.mjs +123 -0
  153. package/dist/manifest-YgVd8Sgz.mjs +1 -0
  154. package/dist/manifest-Zy7Odg5J.mjs +1 -0
  155. package/dist/manifest-ff1H7Pdp.mjs +1 -0
  156. package/dist/manifest-iuhF6pTL2.mjs +1 -0
  157. package/dist/manifest-nXHmtMSp2.mjs +1 -0
  158. package/dist/manifest-xWfu6iLo.mjs +1 -0
  159. package/dist/manifest-yC16OhL2.mjs +1 -0
  160. package/dist/manifest-ztWJoXy4.mjs +1 -0
  161. package/dist/matchesWildcardPattern-BAG6LvX5.mjs +1 -0
  162. package/dist/modules-BPBcSaM-.mjs +333 -0
  163. package/dist/mojo-ipc-BhwsdVUW.mjs +9 -0
  164. package/dist/native/scripts/linux/enum-windows.sh +12 -12
  165. package/dist/native/scripts/macos/enum-windows.applescript +22 -22
  166. package/dist/native-j8l473zn.mjs +961 -0
  167. package/dist/network-T0VRwNPd.mjs +7 -0
  168. package/dist/outputPaths-B4Ic4RZh.mjs +2 -0
  169. package/dist/parse-args-Bw413PlW.mjs +1 -0
  170. package/dist/platform-CzaQtISh.mjs +93 -0
  171. package/dist/playwright-cdp-fallback-DqFdx9-s.mjs +1 -0
  172. package/dist/process-CWhsCWrf.mjs +2 -0
  173. package/dist/proxy-DZFlDsG3.mjs +2 -0
  174. package/dist/registry-DH4sc1dt.mjs +1 -0
  175. package/dist/renderer-pid-9tJnZ_9N.mjs +1 -0
  176. package/dist/response-C7rKQst4.mjs +1 -0
  177. package/dist/search-defaults-lYBVn_3L.mjs +1 -0
  178. package/dist/server/plugin-api.d.mts +19 -36
  179. package/dist/server/plugin-api.mjs +1 -293
  180. package/dist/shared-state-board-BSjXLUV1.mjs +1 -0
  181. package/dist/sourcemap-Dh3Ai_ur.mjs +1 -0
  182. package/dist/ssrf-policy-CsIJGkpd.mjs +1 -0
  183. package/dist/streaming-BcJ0B6ao.mjs +1 -0
  184. package/dist/tool-builder-qif8M9-K.mjs +1 -0
  185. package/dist/transform-DOxzeWPB.mjs +103 -0
  186. package/dist/types-D9EiE5o9.mjs +1 -0
  187. package/dist/types-Fz69RzbZ.mjs +1 -0
  188. package/dist/wasm-CZ_HTfKR.mjs +174 -0
  189. package/dist/webcrack-C1iYG_EX.mjs +46 -0
  190. package/dist/workflow-BdwQmARn.mjs +101 -0
  191. package/package.json +55 -82
  192. package/src/native/scripts/linux/enum-windows.sh +12 -12
  193. package/src/native/scripts/macos/enum-windows.applescript +22 -22
  194. package/dist/AntiCheatDetector-CqGDXmfc.mjs +0 -350
  195. package/dist/CacheAdapters-jJFy20G-.mjs +0 -80
  196. package/dist/CodeInjector-BdjRfNx7.mjs +0 -150
  197. package/dist/ConsoleMonitor-DykL3IAw.mjs +0 -2269
  198. package/dist/DarwinAPI-ETyy0xyo.mjs +0 -363
  199. package/dist/DetailedDataManager-HT49OrvF.mjs +0 -217
  200. package/dist/EventBus-DFKvADm3.mjs +0 -141
  201. package/dist/EvidenceGraphBridge-318Oi0Lf.mjs +0 -153
  202. package/dist/ExtensionManager-BDMsY2Dz.mjs +0 -721
  203. package/dist/FingerprintManager-BN4UQWnX.mjs +0 -96
  204. package/dist/HardwareBreakpoint-Cc2AFq1Y.mjs +0 -239
  205. package/dist/HeapAnalyzer-DruMgsgj.mjs +0 -284
  206. package/dist/InstrumentationSession-DLH0vd-z.mjs +0 -244
  207. package/dist/MemoryController-CMtviNW_.mjs +0 -167
  208. package/dist/MemoryScanSession-ITgb_NMi.mjs +0 -278
  209. package/dist/MemoryScanner-CiL7Z3ey.mjs +0 -428
  210. package/dist/NativeMemoryManager.impl-D9Lkovvn.mjs +0 -485
  211. package/dist/NativeMemoryManager.utils-BBlAixF5.mjs +0 -165
  212. package/dist/PEAnalyzer-DMQ44gen.mjs +0 -385
  213. package/dist/PageController-BPJNqqBN.mjs +0 -431
  214. package/dist/PointerChainEngine-K7wN8Z-w.mjs +0 -325
  215. package/dist/PrerequisiteError-TuyZIs6n.mjs +0 -20
  216. package/dist/ProcessRegistry-zGg12QbE.mjs +0 -74
  217. package/dist/ResponseBuilder-CJXWmWNw.mjs +0 -143
  218. package/dist/ReverseEvidenceGraph-C02-gXOh.mjs +0 -269
  219. package/dist/ScriptManager-ZuWD-0Jg.mjs +0 -3003
  220. package/dist/Speedhack-D-z0umeT.mjs +0 -156
  221. package/dist/StealthVerifier-BWmPgQsv.mjs +0 -135
  222. package/dist/StructureAnalyzer-Cav5AVSL.mjs +0 -429
  223. package/dist/ToolCatalog-5OJdMiF0.mjs +0 -582
  224. package/dist/ToolError-jh9whhMd.mjs +0 -15
  225. package/dist/ToolProbe-DbCFGyrg.mjs +0 -45
  226. package/dist/ToolRegistry-B9krbTtI.mjs +0 -180
  227. package/dist/ToolRouter.policy-BGDAGyeH.mjs +0 -344
  228. package/dist/TraceRecorder-B41Z5XBj.mjs +0 -1286
  229. package/dist/VersionDetector-K3V4vGsw.mjs +0 -104
  230. package/dist/Win32API-C2kjj0ze.mjs +0 -346
  231. package/dist/Win32Debug-CKrGOTpo.mjs +0 -274
  232. package/dist/WorkflowEngine-DJ6M4opp.mjs +0 -569
  233. package/dist/analysis-BHeJW2Nb.mjs +0 -1234
  234. package/dist/artifactRetention-CPXkUJXp.mjs +0 -598
  235. package/dist/artifacts-DkfosXH3.mjs +0 -59
  236. package/dist/authorization-schema-DRqyJMSk.mjs +0 -31
  237. package/dist/betterSqlite3-DLSBZodi.mjs +0 -74
  238. package/dist/binary-instrument--V3MAhJ4.mjs +0 -971
  239. package/dist/bind-helpers-ClV34xdn.mjs +0 -42
  240. package/dist/boringssl-inspector-Bo_LOLaS.mjs +0 -180
  241. package/dist/browser-Dx3_S2cG.mjs +0 -4369
  242. package/dist/capabilities-CcHlvWgK.mjs +0 -33
  243. package/dist/chunk-CjcI7cDX.mjs +0 -15
  244. package/dist/concurrency-Drev_Vz9.mjs +0 -41
  245. package/dist/constants-CDZLOoVv.mjs +0 -534
  246. package/dist/coordination-DgItD9DL.mjs +0 -259
  247. package/dist/debugger-RS3RSAqs.mjs +0 -1288
  248. package/dist/definitions-BEoYofW5.mjs +0 -47
  249. package/dist/definitions-BRaefg3u.mjs +0 -365
  250. package/dist/definitions-BbkvZkiv.mjs +0 -96
  251. package/dist/definitions-BtWSHJ3o.mjs +0 -17
  252. package/dist/definitions-C1gCHO0i.mjs +0 -43
  253. package/dist/definitions-CDOg_b-l.mjs +0 -138
  254. package/dist/definitions-CVPD9hzZ.mjs +0 -54
  255. package/dist/definitions-Cea8Lgl7.mjs +0 -94
  256. package/dist/definitions-DAgIyjxM.mjs +0 -10
  257. package/dist/definitions-DJA27nsL.mjs +0 -66
  258. package/dist/definitions-DKPFU3LW.mjs +0 -25
  259. package/dist/definitions-DPRpZQ96.mjs +0 -47
  260. package/dist/definitions-DUE5gmdn.mjs +0 -18
  261. package/dist/definitions-DYVjOtxa.mjs +0 -26
  262. package/dist/definitions-DcYLVLCo.mjs +0 -37
  263. package/dist/definitions-Pp5LI2H4.mjs +0 -27
  264. package/dist/definitions-j9KdHVNR.mjs +0 -14
  265. package/dist/definitions-uzkjBwa7.mjs +0 -258
  266. package/dist/definitions-va-AnLuQ.mjs +0 -28
  267. package/dist/encoding-DJeqHmpd.mjs +0 -1079
  268. package/dist/evidence-graph-bridge-DcYizFk2.mjs +0 -136
  269. package/dist/factory-C90tBff6.mjs +0 -575
  270. package/dist/flat-target-session-Dgax2Cy3.mjs +0 -29
  271. package/dist/formatAddress-nnMvEohD.mjs +0 -17
  272. package/dist/graphql-CoHrhweh.mjs +0 -1197
  273. package/dist/handlers-4jmR0nMs.mjs +0 -898
  274. package/dist/handlers-BAHPxcch.mjs +0 -789
  275. package/dist/handlers-BOs9b907.mjs +0 -2600
  276. package/dist/handlers-BWXEy6ef.mjs +0 -917
  277. package/dist/handlers-Bndn6QvE.mjs +0 -111
  278. package/dist/handlers-BqC4bD4s.mjs +0 -681
  279. package/dist/handlers-BtYq60bM2.mjs +0 -276
  280. package/dist/handlers-BzgcB4iv.mjs +0 -799
  281. package/dist/handlers-CRyRWj2b.mjs +0 -859
  282. package/dist/handlers-CVv2H1uq.mjs +0 -592
  283. package/dist/handlers-Dl5a7JS4.mjs +0 -572
  284. package/dist/handlers-Dx2d7jt7.mjs +0 -2537
  285. package/dist/handlers-HujRKC3b.mjs +0 -661
  286. package/dist/handlers.impl-XWXkQfyi.mjs +0 -807
  287. package/dist/hooks-B1B8NRHL.mjs +0 -898
  288. package/dist/logger-Dh_xb7_2.mjs +0 -93
  289. package/dist/maintenance-PRMkLVRW.mjs +0 -835
  290. package/dist/manifest-67Bok-Si.mjs +0 -58
  291. package/dist/manifest-6lNTMZAB2.mjs +0 -87
  292. package/dist/manifest-B2duEHiH.mjs +0 -90
  293. package/dist/manifest-B6EY9Vm8.mjs +0 -57
  294. package/dist/manifest-B6nKSbyY.mjs +0 -95
  295. package/dist/manifest-BL8AQNPF.mjs +0 -106
  296. package/dist/manifest-BSZvJJmV.mjs +0 -47
  297. package/dist/manifest-BU7qzUyX.mjs +0 -418
  298. package/dist/manifest-Bl62e8WK.mjs +0 -49
  299. package/dist/manifest-Bo5cXjdt.mjs +0 -82
  300. package/dist/manifest-BpS4gtUK.mjs +0 -1347
  301. package/dist/manifest-Bv65_e2W.mjs +0 -101
  302. package/dist/manifest-BytNIF4Z.mjs +0 -117
  303. package/dist/manifest-C-xtsjS3.mjs +0 -81
  304. package/dist/manifest-CDYl7OhA.mjs +0 -66
  305. package/dist/manifest-CRZ3xmkD.mjs +0 -61
  306. package/dist/manifest-CoW6u4Tp.mjs +0 -132
  307. package/dist/manifest-Cq5zN_8A.mjs +0 -50
  308. package/dist/manifest-D7YZM_2e.mjs +0 -194
  309. package/dist/manifest-DE_VrAeQ.mjs +0 -314
  310. package/dist/manifest-DGsXSCpT.mjs +0 -39
  311. package/dist/manifest-DJ2vfEuW.mjs +0 -156
  312. package/dist/manifest-DPXDYhEu.mjs +0 -80
  313. package/dist/manifest-Dd4fQb0a.mjs +0 -322
  314. package/dist/manifest-Deq6opGg.mjs +0 -223
  315. package/dist/manifest-DfJTafJK.mjs +0 -37
  316. package/dist/manifest-DgOdgN_j.mjs +0 -50
  317. package/dist/manifest-DlbMW4v4.mjs +0 -47
  318. package/dist/manifest-DmVfbH0w.mjs +0 -374
  319. package/dist/manifest-Dog6Ddjr.mjs +0 -109
  320. package/dist/manifest-DvgU5FWb.mjs +0 -58
  321. package/dist/manifest-HsfDBs7j.mjs +0 -50
  322. package/dist/manifest-I8oQHvCG.mjs +0 -186
  323. package/dist/manifest-NvH_a-av.mjs +0 -786
  324. package/dist/manifest-cEJU1v0Z.mjs +0 -129
  325. package/dist/manifest-wOl5XLB12.mjs +0 -112
  326. package/dist/modules-tZozf0LQ.mjs +0 -10635
  327. package/dist/mojo-ipc-DXNEXEqb.mjs +0 -640
  328. package/dist/network-CPVvwvFg.mjs +0 -3852
  329. package/dist/outputPaths-um7lCRY3.mjs +0 -1141
  330. package/dist/parse-args-B4cY5Vx5.mjs +0 -39
  331. package/dist/platform-CYeFoTWp.mjs +0 -2161
  332. package/dist/process-BTbgcVc6.mjs +0 -1306
  333. package/dist/proxy-r8YN6nP1.mjs +0 -192
  334. package/dist/registry-Bl8ZQW61.mjs +0 -34
  335. package/dist/response-CWhh2aLo.mjs +0 -34
  336. package/dist/shared-state-board-BoZnSoj-.mjs +0 -586
  337. package/dist/sourcemap-BIDHUVXy.mjs +0 -934
  338. package/dist/ssrf-policy-Dsqd-DTX.mjs +0 -166
  339. package/dist/streaming-Dal6utPp.mjs +0 -725
  340. package/dist/tool-builder-BHJp32mV.mjs +0 -186
  341. package/dist/transform-DRVgGG90.mjs +0 -1011
  342. package/dist/types-Bx92KJfT.mjs +0 -4
  343. package/dist/types-DDBWs9UP.mjs +0 -37
  344. package/dist/wasm-BYx5UOeG.mjs +0 -1044
  345. package/dist/webcrack-Be0_FccV.mjs +0 -747
  346. package/dist/workflow-BpuKEtvn.mjs +0 -725
@@ -0,0 +1 @@
1
+ import{an as e}from"./constants-BYj8Xek8.mjs";import{n as t}from"./ResponseBuilder-BfWP-uaT.mjs";import{t as n}from"./renderer-pid-9tJnZ_9N.mjs";var r=class{sessionManager;constructor(e){this.sessionManager=e}async handleScanList(e){return t(async()=>{let e=this.sessionManager.listSessions();return{sessions:e,count:e.length}})}async handleScanDelete(e){return t(async()=>({deleted:this.sessionManager.deleteSession(e.sessionId)}))}async handleScanExport(e){return t(async()=>({exportedData:this.sessionManager.exportSession(e.sessionId)}))}};async function i(e,t,r){return await n(e,t,r)}function a(t){return t===void 0||!Number.isFinite(t)||t<=0?e:Math.min(t,e)}var o=class{scanner;eventBus;processManager;ctx;constructor(e,t,n,r){this.scanner=e,this.eventBus=t,this.processManager=n,this.ctx=r}async resolvePid(e){return this.processManager?await i(e,this.processManager,this.ctx):e}async handleFirstScan(e){return t(async()=>{let t=await this.resolvePid(e.pid),n={valueType:e.valueType,alignment:e.alignment,maxResults:a(e.maxResults),regionFilter:e.regionFilter,onProgress:e.onProgress},r=await this.scanner.firstScan(t,e.value,n);return this.eventBus?.emit(`memory:scan_completed`,{scanType:`first`,resultCount:r.totalMatches??0,timestamp:new Date().toISOString()}),{...r,hint:r.totalMatches>0?`Found ${r.totalMatches} matches. Use memory_next_scan with sessionId "${r.sessionId}" to narrow down.`:`No matches found. Try a different value or type.`}})}async handleNextScan(e){return t(async()=>{let t=await this.scanner.nextScan(e.sessionId,e.mode,e.value,e.value2);return{...t,hint:t.totalMatches<=10?`Few matches remaining — inspect these addresses.`:`${t.totalMatches} matches remain. Continue narrowing with memory_next_scan.`}})}async handleUnknownScan(e){return t(async()=>{let t=await this.resolvePid(e.pid),n={valueType:e.valueType,alignment:e.alignment,maxResults:a(e.maxResults),regionFilter:e.regionFilter,onProgress:e.onProgress},r=await this.scanner.unknownInitialScan(t,n);return{...r,hint:`Captured ${r.totalMatches} addresses. Use memory_next_scan with changed/unchanged/increased/decreased to narrow.`}})}async handlePointerScan(e){return t(async()=>{let t=await this.resolvePid(e.pid);return{...await this.scanner.pointerScan(t,e.targetAddress,{maxResults:a(e.maxResults),moduleOnly:e.moduleOnly})}})}async handleGroupScan(e){return t(async()=>{let t=await this.resolvePid(e.pid);return{...await this.scanner.groupScan(t,e.pattern,{alignment:e.alignment,maxResults:a(e.maxResults)})}})}},s=class{ptrEngine;processManager;ctx;constructor(e,t,n){this.ptrEngine=e,this.processManager=t,this.ctx=n}async resolvePid(e){return this.processManager?await i(e,this.processManager,this.ctx):e}async handlePointerChainScan(e){return t(async()=>{let t=await this.resolvePid(e.pid),n=await this.ptrEngine.scan(t,e.targetAddress,{maxDepth:e.maxDepth,maxOffset:e.maxOffset,staticOnly:e.staticOnly,modules:e.modules,maxResults:e.maxResults});return{...n,hint:n.totalFound>0?`Found ${n.totalFound} pointer chains. Static chains survive process restarts.`:`No pointer chains found. Try increasing maxDepth or maxOffset.`}})}async handlePointerChainValidate(e){return t(async()=>{let t=await this.resolvePid(e.pid),n=JSON.parse(e.chains),r=await this.ptrEngine.validateChains(t,n);return{results:r,validCount:r.filter(e=>e.isValid).length,totalChecked:n.length}})}async handlePointerChainResolve(e){return t(async()=>{let t=await this.resolvePid(e.pid),n=JSON.parse(e.chain),r=await this.ptrEngine.resolveChain(t,n);return{chainId:n.id,resolvedAddress:r,isResolvable:r!==null}})}async handlePointerChainExport(e){return t(async()=>{let t=JSON.parse(e.chains);return{exportedData:this.ptrEngine.exportChains(t),chainCount:t.length}})}};const c={int8_t:`int8`,uint8_t:`uint8`,int16_t:`int16`,uint16_t:`uint16`,int32_t:`int32`,uint32_t:`uint32`,int64_t:`int64`,uint64_t:`uint64`,void_ptr:`pointer`,char_ptr:`string_ptr`};function l(e){if(typeof e!=`string`||e.length===0)return`unknown`;let t=e.toLowerCase().replace(/\s+/g,`_`).replace(/\*/g,`_ptr`);return c[t]??t}function u(e){if(!e||typeof e!=`object`)throw Error(`structure must be a JSON object`);let t=e,n=(Array.isArray(t.fields)?t.fields:[]).map((e,t)=>{let n=e;return{offset:typeof n.offset==`number`?n.offset:0,size:typeof n.size==`number`?n.size:1,type:l(n.type),name:typeof n.name==`string`&&n.name.length>0?n.name:`field_${t}`,value:typeof n.value==`string`?n.value:``,confidence:typeof n.confidence==`number`?n.confidence:1,notes:typeof n.notes==`string`?n.notes:void 0}}),r=n.reduce((e,t)=>Math.max(e,t.offset+t.size),0),i=typeof t.totalSize==`number`?t.totalSize:typeof t.size==`number`?t.size:r;return{baseAddress:typeof t.baseAddress==`string`?t.baseAddress:`0x0`,totalSize:i,fields:n,vtableAddress:typeof t.vtableAddress==`string`?t.vtableAddress:void 0,className:typeof t.className==`string`?t.className:void 0,baseClasses:Array.isArray(t.baseClasses)?t.baseClasses.filter(e=>typeof e==`string`):void 0,timestamp:typeof t.timestamp==`number`?t.timestamp:Date.now()}}var d=class{structAnalyzer;processManager;ctx;constructor(e,t,n){this.structAnalyzer=e,this.processManager=t,this.ctx=n}async resolvePid(e){return this.processManager?await i(e,this.processManager,this.ctx):e}async handleStructureAnalyze(e){return t(async()=>{let t=await this.resolvePid(e.pid),n=await this.structAnalyzer.analyzeStructure(t,e.address,{size:e.size,otherInstances:e.otherInstances,parseRtti:e.parseRtti});return{...n,hint:n.className?`Detected class: ${n.className}${n.baseClasses?.length?` (inherits: ${n.baseClasses.join(` → `)})`:``}`:`Inferred ${n.fields.length} fields. Use memory_structure_export_c to export as C struct.`}})}async handleVtableParse(e){return t(async()=>{let t=await this.resolvePid(e.pid);return{...await this.structAnalyzer.parseVtable(t,e.vtableAddress)}})}async handleStructureExportC(e){return t(async()=>{let t=u(JSON.parse(e.structure));return{...this.structAnalyzer.exportToCStruct(t,e.name)}})}async handleStructureCompare(e){return t(async()=>{let t=await this.resolvePid(e.pid),n=await this.structAnalyzer.compareInstances(t,e.address1,e.address2,e.size);return{matchingFieldCount:n.matching.length,differingFieldCount:n.differing.length,...n}})}},f=class{bpEngine;injector;processManager;ctx;constructor(e,t,n,r){this.bpEngine=e,this.injector=t,this.processManager=n,this.ctx=r}async resolvePid(e){return this.processManager?await i(e,this.processManager,this.ctx):e}async handleBreakpointSet(e){return t(async()=>{let t=await this.resolvePid(e.pid);return{...await this.bpEngine.setBreakpoint(t,e.address,e.access,e.size??4),hint:`Hardware breakpoint set on DR register. Use memory_breakpoint with action='trace' to collect hits.`}})}async handleBreakpointRemove(e){return t(async()=>({removed:await this.bpEngine.removeBreakpoint(e.breakpointId)}))}async handleBreakpointList(e){return t(async()=>{let e=this.bpEngine.listBreakpoints();return{breakpoints:e,count:e.length}})}async handleBreakpointTrace(e){return t(async()=>{let t=await this.resolvePid(e.pid),n=await this.bpEngine.traceAccess(t,e.address,e.access,e.maxHits,e.timeoutMs);return{hits:n,hitCount:n.length,hint:n.length>0?`${n.length} accesses captured. Check instructionAddress to find the code accessing this address.`:`No hits captured within timeout.`}})}async handlePatchBytes(e){return t(async()=>{let t=await this.resolvePid(e.pid),n=await this.injector.patchBytes(t,e.address,e.bytes);return{...n,hint:`Patch applied. Use memory_patch_undo with patchId "${n.id}" to restore.`}})}async handlePatchNop(e){return t(async()=>{let t=await this.resolvePid(e.pid);return{...await this.injector.nopBytes(t,e.address,e.count),hint:`${e.count} bytes NOP'd. Use memory_patch_undo to restore.`}})}async handlePatchUndo(e){return t(async()=>({restored:await this.injector.unpatch(e.patchId)}))}async handleCodeCaves(e){return t(async()=>{let t=await this.resolvePid(e.pid),n=await this.injector.findCodeCaves(t,e.minSize);return{caves:n,count:n.length}})}},p=class{memCtrl;processManager;ctx;constructor(e,t,n){this.memCtrl=e,this.processManager=t,this.ctx=n}async resolvePid(e){return this.processManager?await i(e,this.processManager,this.ctx):e}async handleWriteValue(e){return t(async()=>{let t=await this.resolvePid(e.pid);return{...await this.memCtrl.writeValue(t,e.address,e.value,e.valueType),hint:`Use memory_write_history with action='undo' to revert.`}})}async handleFreeze(e){return t(async()=>{let t=await this.resolvePid(e.pid),n=await this.memCtrl.freeze(t,e.address,e.value,e.valueType,e.intervalMs);return{...n,hint:`Frozen. Use memory_freeze with action="unfreeze" and freezeId "${n.id}" to stop.`}})}async handleUnfreeze(e){return t(async()=>({unfrozen:await this.memCtrl.unfreeze(e.freezeId)}))}async handleDump(e){return t(async()=>{let t=await this.resolvePid(e.pid);return{dump:await this.memCtrl.dumpMemoryHex(t,e.address,e.size??256)}})}async handleWriteUndo(e){return t(async()=>{let e=await this.memCtrl.undo();return{undone:e!==null,entry:e}})}async handleWriteRedo(e){return t(async()=>{let e=await this.memCtrl.redo();return{redone:e!==null,entry:e}})}},m=class{speedhackEngine;heapAnalyzer;peAnalyzer;antiCheatDetector;processManager;ctx;constructor(e,t,n,r,i,a){this.speedhackEngine=e,this.heapAnalyzer=t,this.peAnalyzer=n,this.antiCheatDetector=r,this.processManager=i,this.ctx=a}async resolvePid(e){return this.processManager?await i(e,this.processManager,this.ctx):e}async handleSpeedhackApply(e){return t(async()=>{let t=await this.resolvePid(e.pid);return{...await this.speedhackEngine.apply(t,e.speed),hint:`Speedhack active (${e.speed}x). Use memory_speedhack({ action: 'set' }) to adjust.`}})}async handleSpeedhackSet(e){return t(async()=>{let t=await this.resolvePid(e.pid);return{updated:await this.speedhackEngine.setSpeed(t,e.speed),newSpeed:e.speed}})}async handleHeapEnumerate(e){return t(async()=>{let t=await this.resolvePid(e.pid),n=await this.heapAnalyzer.enumerateHeaps(t);return{...n,hint:`Enumerated ${n.heaps.length} heaps. Use memory_heap_stats for statistics or memory_heap_anomalies to check for issues.`}})}async handleHeapStats(e){return t(async()=>{let t=await this.resolvePid(e.pid);return{...await this.heapAnalyzer.getStats(t)}})}async handleHeapAnomalies(e){return t(async()=>{let t=await this.resolvePid(e.pid),n=await this.heapAnalyzer.detectAnomalies(t);return{anomalies:n,count:n.length,hint:n.length>0?`Found ${n.length} anomalies — inspect types for spray, UAF, or suspicious patterns.`:`No heap anomalies detected.`}})}async handlePEHeaders(e){return t(async()=>{let t=await this.resolvePid(e.pid);return{...await this.peAnalyzer.parseHeaders(t,e.moduleBase)}})}async handlePEImportsExports(e){return t(async()=>{let t=e.table||`both`,n=e.moduleBase,r=await this.resolvePid(e.pid),i={};return(t===`imports`||t===`both`)&&(i.imports=await this.peAnalyzer.parseImports(r,n)),(t===`exports`||t===`both`)&&(i.exports=await this.peAnalyzer.parseExports(r,n)),i})}async handleInlineHookDetect(e){return t(async()=>{let t=await this.resolvePid(e.pid),n=await this.peAnalyzer.detectInlineHooks(t,e.moduleName);return{hooks:n,count:n.length,hint:n.length>0?`Detected ${n.length} inline hooks — check hookType and jumpTarget for each.`:`No inline hooks detected — exports match disk bytes.`}})}async handleAntiCheatDetect(e){return t(async()=>{let t=await this.resolvePid(e.pid),n=await this.antiCheatDetector.detect(t);return{detections:n,count:n.length,hint:n.length>0?`Found ${n.length} anti-debug mechanisms. Each includes a bypassSuggestion.`:`No anti-debug mechanisms detected in imports.`}})}async handleGuardPages(e){return t(async()=>{let t=await this.resolvePid(e.pid),{guardPages:n,stats:r}=await this.antiCheatDetector.scanGuardPages(t);return{guardPages:n,count:n.length,scan:r,hint:r.truncated?`Scan stopped after ${r.scannedRegions} regions in ${r.durationMs}ms to avoid hanging. Results may be partial.`:n.length>0?`Found ${n.length} guard page regions — these may indicate anti-tampering.`:`No guard pages found.`}})}async handleIntegrityCheck(e){return t(async()=>{let t=await this.resolvePid(e.pid),{sections:n,stats:r}=await this.antiCheatDetector.scanIntegrity(t,e.moduleName),i=n.filter(e=>e.isModified);return{sections:n,totalChecked:n.length,modifiedCount:i.length,scan:r,hint:r.truncated?`Checked ${r.scannedSections} executable section(s) across ${r.scannedModules} module(s) before hitting safety limits. Results may be partial.`:i.length>0?`${i.length} section(s) modified — code may have been patched or hooked.`:`All checked sections match disk — no runtime modifications detected.`}})}},h=class{sessions;scans;ptrChains;structures;hooks;readwrite;integrity;constructor(e,t,n,i,a,c,l,u,h,g,_,v,y,b){this.sessions=new r(t),this.scans=new o(e,v,y,b),this.ptrChains=new s(n,y,b),this.structures=new d(i,y,b),this.hooks=new f(a,c,y,b),this.readwrite=new p(l,y,b),this.integrity=new m(u,h,g,_,y,b)}handleScanSessionDispatch(e){switch(String(e.action??``)){case`delete`:return this.sessions.handleScanDelete(e);case`export`:return this.sessions.handleScanExport(e);default:return this.sessions.handleScanList(e)}}handleScanList=e=>this.sessions.handleScanList(e);handleScanDelete=e=>this.sessions.handleScanDelete(e);handleScanExport=e=>this.sessions.handleScanExport(e);handleFirstScan=e=>this.scans.handleFirstScan(e);handleNextScan=e=>this.scans.handleNextScan(e);handleUnknownScan=e=>this.scans.handleUnknownScan(e);handlePointerScan=e=>this.scans.handlePointerScan(e);handleGroupScan=e=>this.scans.handleGroupScan(e);handlePointerChainDispatch(e){switch(String(e.action??``)){case`validate`:return this.ptrChains.handlePointerChainValidate(e);case`resolve`:return this.ptrChains.handlePointerChainResolve(e);case`export`:return this.ptrChains.handlePointerChainExport(e);default:return this.ptrChains.handlePointerChainScan(e)}}handlePointerChainScan=e=>this.ptrChains.handlePointerChainScan(e);handlePointerChainValidate=e=>this.ptrChains.handlePointerChainValidate(e);handlePointerChainResolve=e=>this.ptrChains.handlePointerChainResolve(e);handlePointerChainExport=e=>this.ptrChains.handlePointerChainExport(e);handleStructureAnalyze=e=>this.structures.handleStructureAnalyze(e);handleVtableParse=e=>this.structures.handleVtableParse(e);handleStructureExportC=e=>this.structures.handleStructureExportC(e);handleStructureCompare=e=>this.structures.handleStructureCompare(e);handleBreakpointDispatch(e){switch(String(e.action??``)){case`remove`:return this.hooks.handleBreakpointRemove(e);case`list`:return this.hooks.handleBreakpointList(e);case`trace`:return this.hooks.handleBreakpointTrace(e);default:return this.hooks.handleBreakpointSet(e)}}handleBreakpointSet=e=>this.hooks.handleBreakpointSet(e);handleBreakpointRemove=e=>this.hooks.handleBreakpointRemove(e);handleBreakpointList=e=>this.hooks.handleBreakpointList(e);handleBreakpointTrace=e=>this.hooks.handleBreakpointTrace(e);handlePatchBytes=e=>this.hooks.handlePatchBytes(e);handlePatchNop=e=>this.hooks.handlePatchNop(e);handlePatchUndo=e=>this.hooks.handlePatchUndo(e);handleCodeCaves=e=>this.hooks.handleCodeCaves(e);handleFreezeDispatch(e){return String(e.action??``)===`unfreeze`?this.readwrite.handleUnfreeze(e):this.readwrite.handleFreeze(e)}handleWriteHistoryDispatch(e){return String(e.action??``)===`redo`?this.readwrite.handleWriteRedo(e):this.readwrite.handleWriteUndo(e)}handleWriteValue=e=>this.readwrite.handleWriteValue(e);handleFreeze=e=>this.readwrite.handleFreeze(e);handleUnfreeze=e=>this.readwrite.handleUnfreeze(e);handleDump=e=>this.readwrite.handleDump(e);handleWriteUndo=e=>this.readwrite.handleWriteUndo(e);handleWriteRedo=e=>this.readwrite.handleWriteRedo(e);handleSpeedhackDispatch(e){return String(e.action??``)===`set`?this.integrity.handleSpeedhackSet(e):this.integrity.handleSpeedhackApply(e)}handleSpeedhackApply=e=>this.integrity.handleSpeedhackApply(e);handleSpeedhackSet=e=>this.integrity.handleSpeedhackSet(e);handleHeapEnumerate=e=>this.integrity.handleHeapEnumerate(e);handleHeapStats=e=>this.integrity.handleHeapStats(e);handleHeapAnomalies=e=>this.integrity.handleHeapAnomalies(e);handlePEHeaders=e=>this.integrity.handlePEHeaders(e);handlePEImportsExports=e=>this.integrity.handlePEImportsExports(e);handleInlineHookDetect=e=>this.integrity.handleInlineHookDetect(e);handleAntiCheatDetect=e=>this.integrity.handleAntiCheatDetect(e);handleGuardPages=e=>this.integrity.handleGuardPages(e);handleIntegrityCheck=e=>this.integrity.handleIntegrityCheck(e)};export{h as MemoryScanHandlers};
@@ -0,0 +1,600 @@
1
+ import{t as e}from"./logger-sBC6IdRT.mjs";import{a as t,o as n,s as r,t as i}from"./parse-args-Bw413PlW.mjs";import{o as a,s as o}from"./PageController-Dfsm1_o7.mjs";import"./definitions-OeLvmlQy.mjs";var s=class{pageController;injectedHooks=new Map;constructor(e){this.pageController=e}hasAttachedTargetSession(){return this.pageController.hasAttachedTargetSession()}async evaluateInAttachedTarget(e){return await this.pageController.evaluateAttachedTarget(e,{returnByValue:!0,awaitPromise:!0})}async addPersistentScriptToManagedTargets(e,t){await this.pageController.addScriptToPageEvaluateOnNewDocument(t,{id:`ai-hook:${e}`}),await this.pageController.addPersistentScriptToManagedTargets(t,{id:`ai-hook:${e}`,evaluateNow:!0,targetTypes:[`page`,`iframe`]})}async handleAIHookInject(n){try{let i=r(n,`hookId`),s=r(n,`code`),c=t(n,`method`,`evaluate`);if(this.hasAttachedTargetSession())c===`evaluateOnNewDocument`?(await this.addPersistentScriptToManagedTargets(i,s),e.info(`Hook injected into attached target (evaluateOnNewDocument): ${i}`)):(await this.evaluateInAttachedTarget(s),e.info(`Hook injected into attached target (evaluate): ${i}`));else{let t=await this.pageController.getPage();c===`evaluateOnNewDocument`?(await a(t,s),e.info(`Hook injected (evaluateOnNewDocument): ${i}`)):(await o(t,s),e.info(`Hook injected (evaluate): ${i}`))}return this.injectedHooks.set(i,{code:s,injectionTime:Date.now()}),{content:[{type:`text`,text:JSON.stringify({success:!0,hookId:i,message:`Hook (: ${c})`,injectionTime:new Date().toISOString()},null,2)}]}}catch(t){return e.error(`Hook injection failed`,t),{content:[{type:`text`,text:JSON.stringify({success:!1,error:t instanceof Error?t.message:String(t)},null,2)}]}}}async handleAIHookGetData(t){try{let e=r(t,`hookId`),n=this.hasAttachedTargetSession()?await this.evaluateInAttachedTarget(`(() => {
2
+ const hookId = ${JSON.stringify(e)};
3
+ const hooks = globalThis.__aiHooks;
4
+ if (!hooks?.[hookId]) {
5
+ return null;
6
+ }
7
+ return {
8
+ hookId,
9
+ metadata: globalThis.__aiHookMetadata?.[hookId],
10
+ records: hooks[hookId],
11
+ totalRecords: hooks[hookId].length,
12
+ };
13
+ })()`):await o(await this.pageController.getPage(),e=>window.__aiHooks?.[e]?{hookId:e,metadata:window.__aiHookMetadata?.[e],records:window.__aiHooks[e],totalRecords:window.__aiHooks[e].length}:null,e);return n?{content:[{type:`text`,text:JSON.stringify({success:!0,...n},null,2)}]}:{content:[{type:`text`,text:JSON.stringify({success:!1,message:`Hook: ${e}`},null,2)}]}}catch(t){return e.error(`Failed to get hook data`,t),{content:[{type:`text`,text:JSON.stringify({success:!1,error:t instanceof Error?t.message:String(t)},null,2)}]}}}async handleAIHookList(t){try{let e=this.hasAttachedTargetSession()?await this.evaluateInAttachedTarget(`(() => {
14
+ const metadata = globalThis.__aiHookMetadata;
15
+ const hooks = globalThis.__aiHooks;
16
+ if (!metadata) {
17
+ return [];
18
+ }
19
+ return Object.keys(metadata).map((hookId) => ({
20
+ hookId,
21
+ metadata: metadata[hookId],
22
+ recordCount: hooks?.[hookId]?.length || 0,
23
+ }));
24
+ })()`):await o(await this.pageController.getPage(),()=>window.__aiHookMetadata?Object.keys(window.__aiHookMetadata).map(e=>({hookId:e,metadata:window.__aiHookMetadata[e],recordCount:window.__aiHooks?.[e]?.length||0})):[]);return{content:[{type:`text`,text:JSON.stringify({success:!0,totalHooks:e.length,hooks:e},null,2)}]}}catch(t){return e.error(`Failed to list hooks`,t),{content:[{type:`text`,text:JSON.stringify({success:!1,error:t instanceof Error?t.message:String(t)},null,2)}]}}}async handleAIHookClear(n){try{let e=t(n,`hookId`);return e?(this.hasAttachedTargetSession()?await this.evaluateInAttachedTarget(`(() => {
25
+ const hookId = ${JSON.stringify(e)};
26
+ if (globalThis.__aiHooks?.[hookId]) {
27
+ globalThis.__aiHooks[hookId] = [];
28
+ }
29
+ return true;
30
+ })()`):await o(await this.pageController.getPage(),e=>{window.__aiHooks?.[e]&&(window.__aiHooks[e]=[])},e),{content:[{type:`text`,text:JSON.stringify({success:!0,message:`Hook: ${e}`},null,2)}]}):(this.hasAttachedTargetSession()?await this.evaluateInAttachedTarget(`(() => {
31
+ if (globalThis.__aiHooks) {
32
+ for (const key in globalThis.__aiHooks) {
33
+ globalThis.__aiHooks[key] = [];
34
+ }
35
+ }
36
+ return true;
37
+ })()`):await o(await this.pageController.getPage(),()=>{if(window.__aiHooks)for(let e in window.__aiHooks)window.__aiHooks[e]=[]}),{content:[{type:`text`,text:JSON.stringify({success:!0,message:`Hook`},null,2)}]})}catch(t){return e.error(`Failed to clear hook data`,t),{content:[{type:`text`,text:JSON.stringify({success:!1,error:t instanceof Error?t.message:String(t)},null,2)}]}}}async handleAIHookToggle(t){try{let e=r(t,`hookId`),n=i(t,`enabled`);return this.hasAttachedTargetSession()?await this.evaluateInAttachedTarget(`(() => {
38
+ const hookId = ${JSON.stringify(e)};
39
+ const enabled = ${JSON.stringify(n)};
40
+ if (globalThis.__aiHookMetadata?.[hookId]) {
41
+ globalThis.__aiHookMetadata[hookId].enabled = enabled;
42
+ }
43
+ return true;
44
+ })()`):await o(await this.pageController.getPage(),(e,t)=>{window.__aiHookMetadata?.[e]&&(window.__aiHookMetadata[e].enabled=t)},e,n),{content:[{type:`text`,text:JSON.stringify({success:!0,hookId:e,enabled:n,message:`Hook`},null,2)}]}}catch(t){return e.error(`Failed to toggle hook`,t),{content:[{type:`text`,text:JSON.stringify({success:!1,error:t instanceof Error?t.message:String(t)},null,2)}]}}}async handleAIHookExport(n){try{let e=t(n,`hookId`),r=t(n,`format`,`json`),i=this.hasAttachedTargetSession()?await this.evaluateInAttachedTarget(`(() => {
45
+ const hookId = ${JSON.stringify(e)};
46
+ if (hookId) {
47
+ return {
48
+ hookId,
49
+ metadata: globalThis.__aiHookMetadata?.[hookId],
50
+ records: globalThis.__aiHooks?.[hookId] || [],
51
+ };
52
+ }
53
+ return {
54
+ metadata: globalThis.__aiHookMetadata || {},
55
+ records: globalThis.__aiHooks || {},
56
+ };
57
+ })()`):await o(await this.pageController.getPage(),e=>e?{hookId:e,metadata:window.__aiHookMetadata?.[e],records:window.__aiHooks?.[e]||[]}:{metadata:window.__aiHookMetadata||{},records:window.__aiHooks||{}},e);return{content:[{type:`text`,text:JSON.stringify({success:!0,format:r,data:i,exportTime:new Date().toISOString()},null,2)}]}}catch(t){return e.error(`Failed to export hook data`,t),{content:[{type:`text`,text:JSON.stringify({success:!1,error:t instanceof Error?t.message:String(t)},null,2)}]}}}async handleAIHook(e){let t=String(e.action??``);switch(t){case`inject`:return this.handleAIHookInject(e);case`get_data`:return this.handleAIHookGetData(e);case`list`:return this.handleAIHookList(e);case`clear`:return this.handleAIHookClear(e);case`toggle`:return this.handleAIHookToggle(e);case`export`:return this.handleAIHookExport(e);default:return{content:[{type:`text`,text:JSON.stringify({success:!1,error:`Unknown action: ${t}. Valid actions: inject, get_data, list, clear, toggle, export`})}]}}}};function c(e,t,n,r){let i=n?`const __stack = new Error().stack?.split('\\n').slice(1,4).join(' | ') || '';`:`const __stack = '';`,a=r?`console.log(__msg + (__stack ? ' | Stack: ' + __stack : ''));`:``;return`
58
+ (function() {
59
+ if (window.__hookPresets === undefined) window.__hookPresets = {};
60
+ if (window.__hookPresets['${e}']) return;
61
+ ${t.replace(/\{\{STACK_CODE\}\}/g,i).replace(/\{\{LOG_FN\}\}/g,a)}
62
+ window.__hookPresets['${e}'] = true;
63
+ window.__aiHooks = window.__aiHooks || {};
64
+ window.__aiHooks['preset-${e}'] = window.__aiHooks['preset-${e}'] || [];
65
+ })();`}const l={eval:{description:` Hook eval() to capture dynamic code execution`,buildCode:(e,t)=>c(`eval`,`
66
+ const _orig = window.eval;
67
+ window.eval = function(code) {
68
+ {{STACK_CODE}}
69
+ const __msg = '[Hook:eval] code=' + String(code).substring(0, 200);
70
+ {{LOG_FN}}
71
+ window.__aiHooks['preset-eval'].push({ code: String(code).substring(0, 500), stack: __stack, ts: Date.now() });
72
+ return _orig.call(this, code);
73
+ };`,e,t)},"function-constructor":{description:` Hook new Function() to capture dynamic function creation`,buildCode:(e,t)=>c(`function-constructor`,`
74
+ const _orig = Function;
75
+ window.Function = function(...args) {
76
+ {{STACK_CODE}}
77
+ const __msg = '[Hook:Function] args=' + JSON.stringify(args).substring(0, 200);
78
+ {{LOG_FN}}
79
+ window.__aiHooks['preset-function-constructor'].push(
80
+ {
81
+ args: args.map(a => String(a).substring(0,200)),
82
+ stack: __stack,
83
+ ts: Date.now(),
84
+ });
85
+ return _orig(...args);
86
+ };
87
+ window.Function.prototype = _orig.prototype;`,e,t)},"atob-btoa":{description:` Hook atob/btoa to capture Base64 encode/decode operations`,buildCode:(e,t)=>c(`atob-btoa`,`
88
+ const _atob = window.atob.bind(window);
89
+ const _btoa = window.btoa.bind(window);
90
+ window.atob = function(s) {
91
+ {{STACK_CODE}}
92
+ const result = _atob(s);
93
+ const __msg = '[Hook:atob] in=' + String(s).substring(0,100) + ' out=' + result.substring(0,100);
94
+ {{LOG_FN}}
95
+ window.__aiHooks['preset-atob-btoa'].push(
96
+ {
97
+ fn:'atob',
98
+ input: String(s).substring(0,200),
99
+ output: result.substring(0,200),
100
+ stack: __stack,
101
+ ts: Date.now(),
102
+ });
103
+ return result;
104
+ };
105
+ window.btoa = function(s) {
106
+ {{STACK_CODE}}
107
+ const result = _btoa(s);
108
+ const __msg = '[Hook:btoa] in=' + String(s).substring(0,100) + ' out=' + result;
109
+ {{LOG_FN}}
110
+ window.__aiHooks['preset-atob-btoa'].push(
111
+ {
112
+ fn:'btoa',
113
+ input: String(s).substring(0,200),
114
+ output: result,
115
+ stack: __stack,
116
+ ts: Date.now(),
117
+ });
118
+ return result;
119
+ };`,e,t)},"crypto-subtle":{description:` Hook crypto.subtle.encrypt/decrypt to intercept WebCrypto operations`,buildCode:(e,t)=>c(`crypto-subtle`,`
120
+ if (window.crypto && window.crypto.subtle) {
121
+ const _enc = window.crypto.subtle.encrypt.bind(window.crypto.subtle);
122
+ const _dec = window.crypto.subtle.decrypt.bind(window.crypto.subtle);
123
+ window.crypto.subtle.encrypt = function(algo, key, data) {
124
+ {{STACK_CODE}}
125
+ const __msg = '[Hook:crypto.encrypt] algo=' + JSON.stringify(algo);
126
+ {{LOG_FN}}
127
+ window.__aiHooks['preset-crypto-subtle'].push(
128
+ {
129
+ fn:'encrypt',
130
+ algo: JSON.stringify(algo),
131
+ stack: __stack,
132
+ ts: Date.now(),
133
+ });
134
+ return _enc(algo, key, data);
135
+ };
136
+ window.crypto.subtle.decrypt = function(algo, key, data) {
137
+ {{STACK_CODE}}
138
+ const __msg = '[Hook:crypto.decrypt] algo=' + JSON.stringify(algo);
139
+ {{LOG_FN}}
140
+ window.__aiHooks['preset-crypto-subtle'].push(
141
+ {
142
+ fn:'decrypt',
143
+ algo: JSON.stringify(algo),
144
+ stack: __stack,
145
+ ts: Date.now(),
146
+ });
147
+ return _dec(algo, key, data);
148
+ };
149
+ }`,e,t)},"json-stringify":{description:` Hook JSON.stringify/parse to capture serialization activity`,buildCode:(e,t)=>c(`json-stringify`,`
150
+ const _stringify = JSON.stringify;
151
+ const _parse = JSON.parse;
152
+ JSON.stringify = function(v, r, s) {
153
+ {{STACK_CODE}}
154
+ const result = _stringify(v, r, s);
155
+ const __msg = '[Hook:JSON.stringify] out=' + (result||'').substring(0,100);
156
+ {{LOG_FN}}
157
+ window.__aiHooks['preset-json-stringify'].push(
158
+ {
159
+ fn:'stringify',
160
+ output: (result||'').substring(0,300),
161
+ stack: __stack,
162
+ ts: Date.now(),
163
+ });
164
+ return result;
165
+ };
166
+ JSON.parse = function(text, r) {
167
+ {{STACK_CODE}}
168
+ const result = _parse(text, r);
169
+ const __msg = '[Hook:JSON.parse] in=' + String(text).substring(0,100);
170
+ {{LOG_FN}}
171
+ window.__aiHooks['preset-json-stringify'].push(
172
+ {
173
+ fn:'parse',
174
+ input: String(text).substring(0,300),
175
+ stack: __stack,
176
+ ts: Date.now(),
177
+ });
178
+ return result;
179
+ };`,e,t)},"object-defineproperty":{description:` Hook Object.defineProperty to monitor property definitions`,buildCode:(e,t)=>c(`object-defineproperty`,`
180
+ const _define = Object.defineProperty;
181
+ Object.defineProperty = function(obj, prop, descriptor) {
182
+ {{STACK_CODE}}
183
+ const __msg = '[Hook:Object.defineProperty] prop=' + String(prop);
184
+ {{LOG_FN}}
185
+ window.__aiHooks['preset-object-defineproperty'].push(
186
+ {
187
+ prop: String(prop),
188
+ descriptor: JSON.stringify(descriptor||{}).substring(0,200),
189
+ stack: __stack,
190
+ ts: Date.now(),
191
+ });
192
+ return _define(obj, prop, descriptor);
193
+ };`,e,t)},settimeout:{description:` Hook setTimeout to capture timer callbacks and delays`,buildCode:(e,t)=>c(`settimeout`,`
194
+ const _orig = window.setTimeout;
195
+ window.setTimeout = function(fn, delay, ...args) {
196
+ {{STACK_CODE}}
197
+ const fnStr = typeof fn === 'string' ? fn : fn?.toString().substring(0,100);
198
+ const __msg = '[Hook:setTimeout] delay=' + delay + ' fn=' + fnStr;
199
+ {{LOG_FN}}
200
+ window.__aiHooks['preset-settimeout'].push({ delay, fn: fnStr, stack: __stack, ts: Date.now() });
201
+ return _orig(fn, delay, ...args);
202
+ };`,e,t)},setinterval:{description:` Hook setInterval to capture repeating timer callbacks`,buildCode:(e,t)=>c(`setinterval`,`
203
+ const _orig = window.setInterval;
204
+ window.setInterval = function(fn, delay, ...args) {
205
+ {{STACK_CODE}}
206
+ const fnStr = typeof fn === 'string' ? fn : fn?.toString().substring(0,100);
207
+ const __msg = '[Hook:setInterval] delay=' + delay + ' fn=' + fnStr;
208
+ {{LOG_FN}}
209
+ window.__aiHooks['preset-setinterval'].push({ delay, fn: fnStr, stack: __stack, ts: Date.now() });
210
+ return _orig(fn, delay, ...args);
211
+ };`,e,t)},addeventlistener:{description:` Hook addEventListener to trace event listener registrations`,buildCode:(e,t)=>c(`addeventlistener`,`
212
+ const _orig = EventTarget.prototype.addEventListener;
213
+ EventTarget.prototype.addEventListener = function(type, listener, options) {
214
+ {{STACK_CODE}}
215
+ const __msg = '[Hook:addEventListener] type=' + type;
216
+ {{LOG_FN}}
217
+ window.__aiHooks['preset-addeventlistener'].push(
218
+ {
219
+ type,
220
+ target: this?.tagName || String(this).substring(0,50),
221
+ stack: __stack,
222
+ ts: Date.now(),
223
+ });
224
+ return _orig.call(this, type, listener, options);
225
+ };`,e,t)},postmessage:{description:` Hook postMessage to capture cross-origin and iframe messages`,buildCode:(e,t)=>c(`postmessage`,`
226
+ const _orig = window.postMessage.bind(window);
227
+ window.postMessage = function(data, origin, transfer) {
228
+ {{STACK_CODE}}
229
+ const __msg = '[Hook:postMessage] origin=' + origin + ' data=' + JSON.stringify(data).substring(0,100);
230
+ {{LOG_FN}}
231
+ window.__aiHooks['preset-postmessage'].push(
232
+ {
233
+ origin,
234
+ data: JSON.stringify(data||{}).substring(0,300),
235
+ stack: __stack,
236
+ ts: Date.now(),
237
+ });
238
+ return _orig(data, origin, transfer);
239
+ };
240
+ window.addEventListener('message', function(e) {
241
+ window.__aiHooks['preset-postmessage'].push(
242
+ {
243
+ direction:'received',
244
+ origin: e.origin,
245
+ data: JSON.stringify(e.data||{}).substring(0,300),
246
+ ts: Date.now(),
247
+ });
248
+ });`,e,t)},webassembly:{description:` Hook WebAssembly.instantiate/compile to detect WASM module loading`,buildCode:(e,t)=>c(`webassembly`,`
249
+ if (typeof WebAssembly !== 'undefined') {
250
+ const _inst = WebAssembly.instantiate;
251
+ WebAssembly.instantiate = function(bufferSource, importObject) {
252
+ {{STACK_CODE}}
253
+ const size = bufferSource?.byteLength || bufferSource?.length || 0;
254
+ const __msg = '[Hook:WebAssembly.instantiate] size=' + size;
255
+ {{LOG_FN}}
256
+ window.__aiHooks['preset-webassembly'].push({ fn:'instantiate', size, stack: __stack, ts: Date.now() });
257
+ return _inst(bufferSource, importObject);
258
+ };
259
+ }`,e,t)},proxy:{description:` Hook Proxy constructor to detect proxy-based anti-debugging`,buildCode:(e,t)=>c(`proxy`,`
260
+ const _Proxy = window.Proxy;
261
+ window.Proxy = function(target, handler) {
262
+ {{STACK_CODE}}
263
+ const __msg = '[Hook:Proxy] target=' + String(target).substring(0,50);
264
+ {{LOG_FN}}
265
+ window.__aiHooks['preset-proxy'].push(
266
+ {
267
+ target: String(target).substring(0,100),
268
+ handlerKeys: Object.keys(handler||{}),
269
+ stack: __stack,
270
+ ts: Date.now(),
271
+ });
272
+ return new _Proxy(target, handler);
273
+ };
274
+ window.Proxy.prototype = _Proxy.prototype;
275
+ window.Proxy.revocable = _Proxy.revocable;`,e,t)},reflect:{description:` Hook Reflect.apply to capture indirect function calls`,buildCode:(e,t)=>c(`reflect`,`
276
+ const _apply = Reflect.apply;
277
+ Reflect.apply = function(target, thisArg, args) {
278
+ {{STACK_CODE}}
279
+ const __msg = '[Hook:Reflect.apply] fn=' + (target?.name || 'anonymous');
280
+ {{LOG_FN}}
281
+ window.__aiHooks['preset-reflect'].push(
282
+ {
283
+ fn: target?.name || 'anonymous',
284
+ argsCount: (args||[]).length,
285
+ stack: __stack,
286
+ ts: Date.now(),
287
+ });
288
+ return _apply(target, thisArg, args);
289
+ };`,e,t)},"history-pushstate":{description:` Hook history.pushState/replaceState to trace SPA navigation`,buildCode:(e,t)=>c(`history-pushstate`,`
290
+ const _push = history.pushState.bind(history);
291
+ const _replace = history.replaceState.bind(history);
292
+ history.pushState = function(state, title, url) {
293
+ {{STACK_CODE}}
294
+ const __msg = '[Hook:history.pushState] url=' + url;
295
+ {{LOG_FN}}
296
+ window.__aiHooks['preset-history-pushstate'].push(
297
+ {
298
+ fn:'pushState',
299
+ url: String(url),
300
+ state: JSON.stringify(state||{}).substring(0,100),
301
+ stack: __stack,
302
+ ts: Date.now(),
303
+ });
304
+ return _push(state, title, url);
305
+ };
306
+ history.replaceState = function(state, title, url) {
307
+ {{STACK_CODE}}
308
+ const __msg = '[Hook:history.replaceState] url=' + url;
309
+ {{LOG_FN}}
310
+ window.__aiHooks['preset-history-pushstate'].push(
311
+ {
312
+ fn:'replaceState',
313
+ url: String(url),
314
+ state: JSON.stringify(state||{}).substring(0,100),
315
+ stack: __stack,
316
+ ts: Date.now(),
317
+ });
318
+ return _replace(state, title, url);
319
+ };`,e,t)},"location-href":{description:` Hook location.href setter to intercept URL redirects`,buildCode:(e,t)=>c(`location-href`,`
320
+ const _desc = Object.getOwnPropertyDescriptor(window.location, 'href') ||
321
+ Object.getOwnPropertyDescriptor(Location.prototype, 'href');
322
+ if (_desc && _desc.set) {
323
+ const _origSet = _desc.set;
324
+ Object.defineProperty(window.location, 'href', {
325
+ get: _desc.get,
326
+ set: function(url) {
327
+ {{STACK_CODE}}
328
+ const __msg = '[Hook:location.href] url=' + url;
329
+ {{LOG_FN}}
330
+ window.__aiHooks['preset-location-href'].push({ url: String(url), stack: __stack, ts: Date.now() });
331
+ return _origSet.call(this, url);
332
+ },
333
+ configurable: true,
334
+ });
335
+ }`,e,t)},"navigator-useragent":{description:` Hook navigator.userAgent getter to detect UA fingerprinting`,buildCode:(e,t)=>c(`navigator-useragent`,`
336
+ const _desc = Object.getOwnPropertyDescriptor(Navigator.prototype, 'userAgent');
337
+ if (_desc && _desc.get) {
338
+ const _origGet = _desc.get;
339
+ Object.defineProperty(Navigator.prototype, 'userAgent', {
340
+ get: function() {
341
+ {{STACK_CODE}}
342
+ const result = _origGet.call(this);
343
+ const __msg = '[Hook:navigator.userAgent] ua=' + result.substring(0,80);
344
+ {{LOG_FN}}
345
+ window.__aiHooks['preset-navigator-useragent'].push(
346
+ {
347
+ ua: result.substring(0,200),
348
+ stack: __stack,
349
+ ts: Date.now(),
350
+ });
351
+ return result;
352
+ },
353
+ configurable: true,
354
+ });
355
+ }`,e,t)},eventsource:{description:` Hook EventSource to capture SSE connections`,buildCode:(e,t)=>c(`eventsource`,`
356
+ if (typeof EventSource !== 'undefined') {
357
+ const _ES = EventSource;
358
+ window.EventSource = function(url, opts) {
359
+ {{STACK_CODE}}
360
+ const __msg = '[Hook:EventSource] url=' + url;
361
+ {{LOG_FN}}
362
+ window.__aiHooks['preset-eventsource'].push({ url: String(url), stack: __stack, ts: Date.now() });
363
+ return new _ES(url, opts);
364
+ };
365
+ window.EventSource.prototype = _ES.prototype;
366
+ }`,e,t)},"window-open":{description:` Hook window.open to capture popup and new tab creation`,buildCode:(e,t)=>c(`window-open`,`
367
+ const _orig = window.open.bind(window);
368
+ window.open = function(url, target, features) {
369
+ {{STACK_CODE}}
370
+ const __msg = '[Hook:window.open] url=' + url + ' target=' + target;
371
+ {{LOG_FN}}
372
+ window.__aiHooks['preset-window-open'].push(
373
+ {
374
+ url: String(url),
375
+ target: String(target||''),
376
+ stack: __stack,
377
+ ts: Date.now(),
378
+ });
379
+ return _orig(url, target, features);
380
+ };`,e,t)},mutationobserver:{description:` Hook MutationObserver to track dynamic DOM mutation watchers`,buildCode:(e,t)=>c(`mutationobserver`,`
381
+ const _MO = MutationObserver;
382
+ window.MutationObserver = function(callback) {
383
+ {{STACK_CODE}}
384
+ const __msg = '[Hook:MutationObserver] created';
385
+ {{LOG_FN}}
386
+ window.__aiHooks['preset-mutationobserver'].push({ stack: __stack, ts: Date.now() });
387
+ return new _MO(callback);
388
+ };
389
+ window.MutationObserver.prototype = _MO.prototype;`,e,t)},formdata:{description:` Hook FormData.append to capture form data before submission`,buildCode:(e,t)=>c(`formdata`,`
390
+ const _orig = FormData.prototype.append;
391
+ FormData.prototype.append = function(name, value, filename) {
392
+ {{STACK_CODE}}
393
+ const __msg = '[Hook:FormData.append] name=' + name + ' value=' + String(value).substring(0,100);
394
+ {{LOG_FN}}
395
+ window.__aiHooks['preset-formdata'].push(
396
+ {
397
+ name: String(name),
398
+ value: String(value).substring(0,200),
399
+ stack: __stack,
400
+ ts: Date.now(),
401
+ });
402
+ return _orig.call(this, name, value, filename);
403
+ };`,e,t)}},u={"anti-debug-bypass":{description:` Block anti-debugging: setInterval/setTimeout debugger traps, console.clear spam, timing attacks (performance.now freeze), outerWidth/outerHeight devtools detection`,buildCode:(e,t)=>c(`anti-debug-bypass`,`
404
+ window.__aiHooks['preset-anti-debug-bypass'] = window.__aiHooks['preset-anti-debug-bypass'] || [];
405
+ // 1. Block setInterval/setTimeout containing debugger/devtools
406
+ const _si = window.setInterval;
407
+ window.setInterval = function(fn, delay) {
408
+ const rest = Array.prototype.slice.call(arguments, 2);
409
+ const fnStr = typeof fn === 'function' ? fn.toString() : String(fn);
410
+ if (fnStr.includes('debugger') || fnStr.includes('devtools') || fnStr.includes('disable-devtool')) {
411
+ window.__aiHooks['preset-anti-debug-bypass'].push(
412
+ {
413
+ blocked: 'setInterval',
414
+ fn: fnStr.substring(0, 200),
415
+ ts: Date.now(),
416
+ });
417
+ return -1;
418
+ }
419
+ return _si.apply(this, [fn, delay].concat(rest));
420
+ };
421
+ const _st = window.setTimeout;
422
+ window.setTimeout = function(fn, delay) {
423
+ const rest = Array.prototype.slice.call(arguments, 2);
424
+ const fnStr = typeof fn === 'function' ? fn.toString() : String(fn);
425
+ if (fnStr.includes('debugger') || fnStr.includes('devtools')) {
426
+ window.__aiHooks['preset-anti-debug-bypass'].push(
427
+ {
428
+ blocked: 'setTimeout',
429
+ fn: fnStr.substring(0, 200),
430
+ ts: Date.now(),
431
+ });
432
+ return -1;
433
+ }
434
+ return _st.apply(this, [fn, delay].concat(rest));
435
+ };
436
+ // 2. Suppress console.clear spam
437
+ console.clear = function() {
438
+ window.__aiHooks['preset-anti-debug-bypass'].push({ blocked: 'console.clear', ts: Date.now() });
439
+ };
440
+ // 3. Freeze performance.now to defeat timing attacks
441
+ const _pn = performance.now.bind(performance);
442
+ let _t = _pn();
443
+ performance.now = function() { return (_t += 0.001); };
444
+ // 4. Fix outerWidth/outerHeight DevTools size detection
445
+ Object.defineProperty(window, 'outerWidth', { get: function() { return window.innerWidth; }, configurable: true });
446
+ Object.defineProperty(window, 'outerHeight',
447
+ { get: function() { return window.innerHeight; }, configurable: true });`,e,t)},"crypto-key-capture":{description:` Force extractable:true on all WebCrypto importKey calls and capture plaintext/ciphertext + key material for encrypt/decrypt/sign/verify`,buildCode:(e,t)=>c(`crypto-key-capture`,`
448
+ if (window.crypto && window.crypto.subtle) {
449
+ const _subtle = window.crypto.subtle;
450
+ const _importKey = _subtle.importKey.bind(_subtle);
451
+ const _encrypt = _subtle.encrypt.bind(_subtle);
452
+ const _decrypt = _subtle.decrypt.bind(_subtle);
453
+ const _sign = _subtle.sign.bind(_subtle);
454
+ const _verify = _subtle.verify.bind(_subtle);
455
+ const _exportKey = _subtle.exportKey.bind(_subtle);
456
+ const toHex = function(buf) {
457
+ return Array.from(new Uint8Array(buf instanceof ArrayBuffer ? buf : buf.buffer || buf))
458
+ .map(function(b) { return b.toString(16).padStart(2,'0'); }).join('');
459
+ };
460
+ const tryExport = async function(key) {
461
+ try { return await _exportKey('jwk', key); } catch(e) { return null; }
462
+ };
463
+ _subtle.importKey = async function(format, keyData, algorithm, extractable, usages) {
464
+ {{STACK_CODE}}
465
+ const keyHex = (keyData instanceof ArrayBuffer || ArrayBuffer.isView(keyData)) ?
466
+ toHex(keyData) :
467
+ JSON.stringify(keyData);
468
+ const __msg = '[Hook:importKey] format=' + format + ' algo=' + JSON.stringify(algorithm) +
469
+ ' key=' + keyHex.substring(0,64);
470
+ {{LOG_FN}}
471
+ const key = await _importKey(format, keyData, algorithm, true, usages);
472
+ window.__aiHooks['preset-crypto-key-capture'].push(
473
+ {
474
+ fn:'importKey',
475
+ format,
476
+ algorithm: JSON.stringify(algorithm),
477
+ keyHex,
478
+ stack: __stack,
479
+ ts: Date.now(),
480
+ });
481
+ return key;
482
+ };
483
+ _subtle.encrypt = async function(algo, key, data) {
484
+ {{STACK_CODE}}
485
+ const plainHex = toHex(data);
486
+ const result = await _encrypt(algo, key, data);
487
+ const cipherHex = toHex(result);
488
+ const keyJwk = await tryExport(key);
489
+ const __msg = '[Hook:encrypt] algo=' + JSON.stringify(algo) + ' plain=' + plainHex.substring(0,64);
490
+ {{LOG_FN}}
491
+ window.__aiHooks['preset-crypto-key-capture'].push(
492
+ {
493
+ fn:'encrypt',
494
+ algo: JSON.stringify(algo),
495
+ plainHex,
496
+ cipherHex,
497
+ key: keyJwk,
498
+ stack: __stack,
499
+ ts: Date.now(),
500
+ });
501
+ return result;
502
+ };
503
+ _subtle.decrypt = async function(algo, key, data) {
504
+ {{STACK_CODE}}
505
+ const result = await _decrypt(algo, key, data);
506
+ const plainHex = toHex(result);
507
+ const keyJwk = await tryExport(key);
508
+ const __msg = '[Hook:decrypt] algo=' + JSON.stringify(algo) + ' plain=' +
509
+ new TextDecoder().decode(new Uint8Array(result instanceof ArrayBuffer ? result : result.buffer,
510
+ 0, Math.min(100, (result.byteLength || result.length || 0))));
511
+ {{LOG_FN}}
512
+ window.__aiHooks['preset-crypto-key-capture'].push(
513
+ {
514
+ fn:'decrypt',
515
+ algo: JSON.stringify(algo),
516
+ plainHex,
517
+ key: keyJwk,
518
+ stack: __stack,
519
+ ts: Date.now(),
520
+ });
521
+ return result;
522
+ };
523
+ _subtle.sign = async function(algo, key, data) {
524
+ {{STACK_CODE}}
525
+ const result = await _sign(algo, key, data);
526
+ const keyJwk = await tryExport(key);
527
+ const __msg = '[Hook:sign] algo=' + JSON.stringify(algo);
528
+ {{LOG_FN}}
529
+ window.__aiHooks['preset-crypto-key-capture'].push(
530
+ {
531
+ fn:'sign',
532
+ algo: JSON.stringify(algo),
533
+ sigHex: toHex(result),
534
+ key: keyJwk,
535
+ stack: __stack,
536
+ ts: Date.now(),
537
+ });
538
+ return result;
539
+ };
540
+ }`,e,t)},"webassembly-full":{description:` Hook WebAssembly.instantiate to log all import calls, export names, and memory creation`,buildCode:(e,t)=>c(`webassembly-full`,`
541
+ if (typeof WebAssembly !== 'undefined') {
542
+ const _inst = WebAssembly.instantiate;
543
+ WebAssembly.instantiate = async function(bufferSource, importObject) {
544
+ {{STACK_CODE}}
545
+ const size = bufferSource && (bufferSource.byteLength || bufferSource.length) || 0;
546
+ const __msg = '[Hook:WASM.instantiate] size=' + size;
547
+ {{LOG_FN}}
548
+ // Wrap all imported functions to trace calls
549
+ if (importObject && typeof importObject === 'object') {
550
+ Object.keys(importObject).forEach(function(modName) {
551
+ const mod = importObject[modName];
552
+ if (mod && typeof mod === 'object') {
553
+ Object.keys(mod).forEach(function(fnName) {
554
+ if (typeof mod[fnName] === 'function') {
555
+ const _fn = mod[fnName];
556
+ mod[fnName] = function() {
557
+ const args = Array.prototype.slice.call(arguments);
558
+ window.__aiHooks['preset-webassembly-full'].push(
559
+ {
560
+ type:'import_call',
561
+ mod: modName,
562
+ fn: fnName,
563
+ args: args.map(function(a){ return typeof a === 'number' ? a : '?'; }),
564
+ ts: Date.now(),
565
+ });
566
+ return _fn.apply(this, args);
567
+ };
568
+ }
569
+ });
570
+ }
571
+ });
572
+ }
573
+ const result = await _inst(bufferSource, importObject);
574
+ const exports = result && result.instance ? Object.keys(result.instance.exports) : [];
575
+ window.__aiHooks['preset-webassembly-full'].push(
576
+ {
577
+ type:'instantiated',
578
+ size,
579
+ exports,
580
+ importMods: importObject ? Object.keys(importObject) : [],
581
+ stack: __stack,
582
+ ts: Date.now(),
583
+ });
584
+ return result;
585
+ };
586
+ // Also hook WebAssembly.Memory creation
587
+ const _Memory = WebAssembly.Memory;
588
+ WebAssembly.Memory = function(descriptor) {
589
+ window.__aiHooks['preset-webassembly-full'].push(
590
+ {
591
+ type:'memory_created',
592
+ initial: descriptor && descriptor.initial,
593
+ maximum: descriptor && descriptor.maximum,
594
+ shared: descriptor && descriptor.shared,
595
+ ts: Date.now(),
596
+ });
597
+ return new _Memory(descriptor);
598
+ };
599
+ WebAssembly.Memory.prototype = _Memory.prototype;
600
+ }`,e,t)}},d={...l,...u},f=Object.entries(d).map(([e,t])=>({id:e,description:t.description}));var p=class{pageController;constructor(e){this.pageController=e}async handleHookPreset(r){try{let a=this.buildCustomPresetMap(r),o={...d,...a},s=[...f,...Object.entries(a).map(([e,t])=>({id:e,description:`${t.description} (custom)`}))];if(r.listPresets===!0)return{content:[{type:`text`,text:JSON.stringify({success:!0,totalPresets:s.length,presets:s},null,2)}]};let c=i(r,`captureStack`,!1),l=i(r,`logToConsole`,!0),u=t(r,`method`,`evaluate`),p=[];if(r.preset)p=[t(r,`preset`)];else if(Array.isArray(r.presets))p=n(r,`presets`);else return{content:[{type:`text`,text:JSON.stringify({success:!1,error:` Provide either preset (single) or presets (multiple), or set listPresets=true to list available presets`},null,2)}]};let m=p.filter(e=>!o[e]);if(m.length>0)return{content:[{type:`text`,text:JSON.stringify({success:!1,error:`: ${m.join(`, `)}`,availablePresets:s.map(e=>e.id)},null,2)}]};let h=await this.pageController.getPage(),g=[],_=[];for(let t of p)try{let n=o[t].buildCode(c,l);u===`evaluateOnNewDocument`?await h.evaluateOnNewDocument(n):await h.evaluate(n),g.push(t),e.info(` Hook preset injected: ${t}`)}catch(n){let r=n instanceof Error?n.message:String(n);_.push({preset:t,error:r}),e.error(` Failed to inject preset ${t}:`,n)}return{content:[{type:`text`,text:JSON.stringify({success:_.length===0,injected:g,failed:_,method:u,captureStack:c,message:` ${g.length}/${p.length} Hook`,usage:` ai_hook_get_data(hookId: "preset-<>") `},null,2)}]}}catch(t){return e.error(`Hook preset injection failed`,t),{content:[{type:`text`,text:JSON.stringify({success:!1,error:t instanceof Error?t.message:String(t)},null,2)}]}}}buildCustomPresetMap(e){let t=[];e.customTemplate&&typeof e.customTemplate==`object`&&t.push(e.customTemplate),Array.isArray(e.customTemplates)&&t.push(...e.customTemplates);let n={};for(let e of t){let t=e.id?.trim(),r=e.body?.trim();if(!t||!r)throw Error(`Each custom template requires non-empty id and body`);if(d[t])throw Error(`Custom template id conflicts with built-in preset: ${t}`);n[t]={description:e.description?.trim()||`Custom inline preset: ${t}`,buildCode:(e,n)=>c(t,r,e,n)}}return n}};export{s as AIHookToolHandlers,p as HookPresetToolHandlers};