@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
@@ -1,971 +0,0 @@
1
- import { t as __exportAll } from "./chunk-CjcI7cDX.mjs";
2
- import { t as logger } from "./logger-Dh_xb7_2.mjs";
3
- import { Q as FRIDA_TIMEOUT_MS, et as GHIDRA_TIMEOUT_MS, xr as UNIDBG_TIMEOUT_MS } from "./constants-CDZLOoVv.mjs";
4
- import { t as probeCommand } from "./ToolProbe-DbCFGyrg.mjs";
5
- import { tmpdir } from "node:os";
6
- import { randomUUID } from "node:crypto";
7
- import { basename, dirname, join } from "node:path";
8
- import { access, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
9
- import { execFile } from "node:child_process";
10
- //#region src/modules/binary-instrument/FridaSession.ts
11
- const FRIDA_MAX_BUFFER_BYTES = 5 * 1024 * 1024;
12
- var FridaSession = class {
13
- sessions = /* @__PURE__ */ new Map();
14
- activeSessionId;
15
- fridaProbe;
16
- probePromise;
17
- async attach(target) {
18
- const availability = await this.getAvailability();
19
- if (!availability.available) throw new Error(availability.reason ?? "Frida CLI is not available");
20
- const probe = await this.runFridaCommand(target, "console.log(\"__frida_attach_ok__\");");
21
- if (probe.error) throw new Error(probe.error);
22
- const sessionId = randomUUID();
23
- const record = {
24
- id: sessionId,
25
- target,
26
- pid: this.resolvePid(target),
27
- status: "attached",
28
- attachedAt: (/* @__PURE__ */ new Date()).toISOString()
29
- };
30
- this.sessions.set(sessionId, record);
31
- this.activeSessionId = sessionId;
32
- return sessionId;
33
- }
34
- async detach() {
35
- const active = this.getActiveSessionRecord();
36
- if (!active) return;
37
- active.status = "detached";
38
- this.activeSessionId = void 0;
39
- }
40
- async executeScript(script) {
41
- const session = this.requireActiveSession();
42
- const result = await this.runFridaCommand(session.target, script);
43
- if (result.error) {
44
- session.status = "error";
45
- session.lastError = result.error;
46
- }
47
- return result;
48
- }
49
- async enumerateModules() {
50
- const session = this.requireActiveSession();
51
- const result = await this.runFridaCommand(session.target, "console.log(JSON.stringify(Process.enumerateModules()));");
52
- const parsed = this.parseModuleList(result.output);
53
- if (parsed.length > 0) return parsed;
54
- if (result.error) {
55
- session.status = "error";
56
- session.lastError = result.error;
57
- }
58
- return [];
59
- }
60
- async enumerateFunctions(moduleName) {
61
- const session = this.requireActiveSession();
62
- const safeModuleName = JSON.stringify(moduleName);
63
- const result = await this.runFridaCommand(session.target, [
64
- `const entries = Process.getModuleByName(${safeModuleName}).enumerateExports()`,
65
- ".filter(function (entry) { return entry.type === \"function\"; })",
66
- ".map(function (entry) {",
67
- " return { name: entry.name, address: String(entry.address), size: 0 };",
68
- "});",
69
- "console.log(JSON.stringify(entries));"
70
- ].join(""));
71
- const parsed = this.parseFunctionList(result.output);
72
- if (parsed.length > 0) return parsed;
73
- if (result.error) {
74
- session.status = "error";
75
- session.lastError = result.error;
76
- }
77
- return [];
78
- }
79
- async findSymbols(pattern) {
80
- const session = this.requireActiveSession();
81
- const trimmedPattern = pattern.trim();
82
- const resolvedPattern = trimmedPattern.includes(":") ? trimmedPattern : trimmedPattern.includes("!") ? `exports:${trimmedPattern}` : `exports:*!${trimmedPattern}*`;
83
- const matchPattern = JSON.stringify(resolvedPattern);
84
- const result = await this.runFridaCommand(session.target, [
85
- "const resolver = new ApiResolver(\"module\");",
86
- `const matches = resolver.enumerateMatches(${matchPattern});`,
87
- "const mapped = matches.map(function (entry) {",
88
- " const resolvedName = typeof entry.name === \"string\" ? entry.name : \"unknown\";",
89
- " const resolvedAddress = entry.address ? String(entry.address) : \"0x0\";",
90
- " return { name: resolvedName, address: resolvedAddress, demangled: resolvedName };",
91
- "});",
92
- "console.log(JSON.stringify(mapped));"
93
- ].join(""));
94
- const parsed = this.parseSymbolList(result.output);
95
- if (parsed.length > 0) return parsed;
96
- if (result.error) {
97
- session.status = "error";
98
- session.lastError = result.error;
99
- }
100
- return [];
101
- }
102
- listSessions() {
103
- return Array.from(this.sessions.values()).map((session) => ({
104
- id: session.id,
105
- target: session.target,
106
- pid: session.pid,
107
- status: session.status
108
- }));
109
- }
110
- async isAvailable() {
111
- return (await this.getAvailability()).available;
112
- }
113
- async getAvailability() {
114
- if (this.fridaProbe) return this.fridaProbe;
115
- if (!this.probePromise) this.probePromise = probeCommand("frida");
116
- const resolved = await this.probePromise;
117
- this.fridaProbe = resolved;
118
- this.probePromise = void 0;
119
- return resolved;
120
- }
121
- useSession(sessionId) {
122
- if (!this.sessions.has(sessionId)) return false;
123
- this.activeSessionId = sessionId;
124
- return true;
125
- }
126
- hasSession(sessionId) {
127
- return this.sessions.has(sessionId);
128
- }
129
- getSessionDiagnostics(sessionId) {
130
- const session = this.sessions.get(sessionId);
131
- if (!session) return;
132
- return {
133
- status: session.status,
134
- lastError: session.lastError
135
- };
136
- }
137
- getActiveSessionRecord() {
138
- if (!this.activeSessionId) return;
139
- return this.sessions.get(this.activeSessionId);
140
- }
141
- requireActiveSession() {
142
- const session = this.getActiveSessionRecord();
143
- if (!session) throw new Error("No active Frida session. Call attach() first.");
144
- return session;
145
- }
146
- resolvePid(target) {
147
- if (!/^\d+$/.test(target)) return null;
148
- const parsed = Number.parseInt(target, 10);
149
- return Number.isNaN(parsed) ? null : parsed;
150
- }
151
- async runFridaCommand(target, script) {
152
- const availability = await this.getAvailability();
153
- if (!availability.available) return {
154
- output: "",
155
- error: availability.reason ?? "Frida CLI is not available"
156
- };
157
- const command = availability.path ?? "frida";
158
- const args = [
159
- ...this.buildTargetArgs(target),
160
- "--runtime=v8",
161
- "-q",
162
- "-e",
163
- script
164
- ];
165
- try {
166
- const result = await this.execFileUtf8(command, args, FRIDA_TIMEOUT_MS);
167
- const output = result.stdout.trim();
168
- const error = result.stderr.trim();
169
- return error ? {
170
- output,
171
- error
172
- } : { output };
173
- } catch (error) {
174
- const message = error instanceof Error ? error.message : String(error);
175
- logger.warn("[binary-instrument] Frida command failed", {
176
- target,
177
- message
178
- });
179
- return {
180
- output: "",
181
- error: message
182
- };
183
- }
184
- }
185
- buildTargetArgs(target) {
186
- if (/^\d+$/.test(target)) return ["-p", target];
187
- if (target.includes("/") || target.includes("\\")) return ["-f", target];
188
- return ["-n", target];
189
- }
190
- parseModuleList(output) {
191
- const payload = this.extractJsonPayload(output);
192
- if (!Array.isArray(payload)) return [];
193
- const modules = [];
194
- for (const entry of payload) {
195
- if (!this.isRecord(entry)) continue;
196
- const name = this.readStringField(entry, "name");
197
- const path = this.readStringField(entry, "path");
198
- const base = this.normalizeHex(entry["base"]);
199
- const size = this.readNumberField(entry, "size");
200
- if (!name || !path || !base || size === void 0) continue;
201
- modules.push({
202
- name,
203
- base,
204
- size,
205
- path
206
- });
207
- }
208
- return modules;
209
- }
210
- parseFunctionList(output) {
211
- const payload = this.extractJsonPayload(output);
212
- if (!Array.isArray(payload)) return [];
213
- const functions = [];
214
- for (const entry of payload) {
215
- if (!this.isRecord(entry)) continue;
216
- const name = this.readStringField(entry, "name");
217
- const address = this.normalizeHex(entry["address"]);
218
- const size = this.readNumberField(entry, "size") ?? 0;
219
- if (!name || !address) continue;
220
- functions.push({
221
- name,
222
- address,
223
- size
224
- });
225
- }
226
- return functions;
227
- }
228
- parseSymbolList(output) {
229
- const payload = this.extractJsonPayload(output);
230
- if (!Array.isArray(payload)) return [];
231
- const symbols = [];
232
- for (const entry of payload) {
233
- if (!this.isRecord(entry)) continue;
234
- const name = this.readStringField(entry, "name");
235
- const address = this.normalizeHex(entry["address"]);
236
- const demangled = this.readStringField(entry, "demangled");
237
- if (!name || !address) continue;
238
- if (demangled) symbols.push({
239
- name,
240
- address,
241
- demangled
242
- });
243
- else symbols.push({
244
- name,
245
- address
246
- });
247
- }
248
- return symbols;
249
- }
250
- extractJsonPayload(output) {
251
- const candidates = output.split(/\r?\n/).map((line) => line.trim()).filter((line) => line.startsWith("{") || line.startsWith("[")).toReversed();
252
- for (const line of candidates) try {
253
- return JSON.parse(line);
254
- } catch {
255
- continue;
256
- }
257
- }
258
- readStringField(record, key) {
259
- const value = record[key];
260
- return typeof value === "string" && value.length > 0 ? value : void 0;
261
- }
262
- readNumberField(record, key) {
263
- const value = record[key];
264
- return typeof value === "number" && Number.isFinite(value) ? value : void 0;
265
- }
266
- normalizeHex(value) {
267
- if (typeof value === "number" && Number.isFinite(value)) return `0x${value.toString(16)}`;
268
- if (typeof value === "string" && value.length > 0) return value.startsWith("0x") ? value : `0x${value}`;
269
- }
270
- isRecord(value) {
271
- return typeof value === "object" && value !== null;
272
- }
273
- execFileUtf8(file, args, timeoutMs) {
274
- return new Promise((resolve, reject) => {
275
- execFile(file, args, {
276
- timeout: timeoutMs,
277
- windowsHide: true,
278
- maxBuffer: FRIDA_MAX_BUFFER_BYTES,
279
- encoding: "utf8"
280
- }, (error, stdout, stderr) => {
281
- if (error) {
282
- reject(error);
283
- return;
284
- }
285
- resolve({
286
- stdout: typeof stdout === "string" ? stdout : "",
287
- stderr: typeof stderr === "string" ? stderr : ""
288
- });
289
- });
290
- });
291
- }
292
- };
293
- //#endregion
294
- //#region src/modules/binary-instrument/GhidraAnalyzer.ts
295
- const GHIDRA_MAX_BUFFER_BYTES = 16 * 1024 * 1024;
296
- var GhidraAnalyzer = class {
297
- ghidraProbe;
298
- probePromise;
299
- async analyze(binaryPath, options) {
300
- await access(binaryPath);
301
- const fileBuffer = await readFile(binaryPath);
302
- const strings = this.extractPrintableStrings(fileBuffer);
303
- const imports = this.deriveImports(strings);
304
- const exports = this.deriveExports(strings);
305
- if (!(await this.getAvailability()).available) return {
306
- functions: [],
307
- imports,
308
- exports,
309
- strings
310
- };
311
- const timeoutMs = typeof options?.timeout === "number" && Number.isFinite(options.timeout) ? options.timeout : GHIDRA_TIMEOUT_MS;
312
- const scriptDirectory = await mkdtemp(join(tmpdir(), "jshook-ghidra-script-"));
313
- const scriptPath = join(scriptDirectory, "BinaryInstrumentDump.py");
314
- try {
315
- await writeFile(scriptPath, this.buildDefaultScript(), "utf8");
316
- const output = await this.headlessAnalyze(scriptPath, binaryPath, timeoutMs);
317
- return {
318
- functions: this.parseDecompiledOutput(output),
319
- imports,
320
- exports,
321
- strings
322
- };
323
- } catch (error) {
324
- const message = error instanceof Error ? error.message : String(error);
325
- logger.warn("[binary-instrument] Ghidra analyze fallback", {
326
- binaryPath,
327
- message
328
- });
329
- return {
330
- functions: [],
331
- imports,
332
- exports,
333
- strings
334
- };
335
- } finally {
336
- await rm(scriptDirectory, {
337
- recursive: true,
338
- force: true
339
- });
340
- }
341
- }
342
- async headlessAnalyze(scriptPath, binaryPath, timeoutMs = GHIDRA_TIMEOUT_MS) {
343
- const availability = await this.getAvailability();
344
- if (!availability.available) throw new Error(availability.reason ?? "Ghidra analyzeHeadless is not available");
345
- await access(binaryPath);
346
- await access(scriptPath);
347
- const command = availability.path ?? "analyzeHeadless";
348
- const projectDirectory = await mkdtemp(join(tmpdir(), "jshook-ghidra-project-"));
349
- const projectName = "binary-instrument";
350
- try {
351
- const result = await this.execFileUtf8(command, [
352
- projectDirectory,
353
- projectName,
354
- "-import",
355
- binaryPath,
356
- "-scriptPath",
357
- dirname(scriptPath),
358
- "-postScript",
359
- basename(scriptPath)
360
- ], timeoutMs);
361
- return [result.stdout.trim(), result.stderr.trim()].filter((entry) => entry.length > 0).join("\n");
362
- } finally {
363
- await rm(projectDirectory, {
364
- recursive: true,
365
- force: true
366
- });
367
- }
368
- }
369
- parseDecompiledOutput(output) {
370
- const functions = [];
371
- const blockPattern = /FUNCTION_START\s*[\r\n]+NAME:(.+?)\s*[\r\n]+ADDRESS:(.+?)\s*[\r\n]+SIGNATURE:(.+?)\s*[\r\n]+DECOMPILED_START\s*[\r\n]+([\s\S]*?)\s*[\r\n]+DECOMPILED_END\s*[\r\n]+FUNCTION_END/g;
372
- let match = blockPattern.exec(output);
373
- while (match) {
374
- const rawName = match[1] ?? "";
375
- const rawAddress = match[2] ?? "";
376
- const rawSignature = match[3] ?? "";
377
- const rawBody = match[4] ?? "";
378
- const name = rawName.trim();
379
- const address = this.normalizeHex(rawAddress.trim());
380
- const signature = rawSignature.trim();
381
- const decompiled = rawBody.trim();
382
- if (name.length > 0 && address.length > 0 && signature.length > 0) functions.push({
383
- name,
384
- address,
385
- signature,
386
- decompiled
387
- });
388
- match = blockPattern.exec(output);
389
- }
390
- return functions;
391
- }
392
- async isAvailable() {
393
- return (await this.getAvailability()).available;
394
- }
395
- async getAvailability() {
396
- if (this.ghidraProbe) return this.ghidraProbe;
397
- if (!this.probePromise) this.probePromise = probeCommand("analyzeHeadless", ["-help"]);
398
- const resolved = await this.probePromise;
399
- this.ghidraProbe = resolved;
400
- this.probePromise = void 0;
401
- return resolved;
402
- }
403
- buildDefaultScript() {
404
- return [
405
- "# @category BinaryInstrument",
406
- "from ghidra.app.decompiler import DecompInterface",
407
- "",
408
- "program = currentProgram",
409
- "interface = DecompInterface()",
410
- "interface.openProgram(program)",
411
- "function_manager = program.getFunctionManager()",
412
- "functions = function_manager.getFunctions(True)",
413
- "",
414
- "for function in functions:",
415
- " print(\"FUNCTION_START\")",
416
- " print(\"NAME:\" + str(function.getName()))",
417
- " print(\"ADDRESS:\" + str(function.getEntryPoint()))",
418
- " try:",
419
- " signature = str(function.getSignature())",
420
- " except:",
421
- " signature = str(function.getName()) + \"()\"",
422
- " print(\"SIGNATURE:\" + signature)",
423
- " print(\"DECOMPILED_START\")",
424
- " try:",
425
- " decompiled = interface.decompileFunction(function, 30, monitor).getDecompiledFunction()",
426
- " if decompiled:",
427
- " print(str(decompiled.getC()))",
428
- " else:",
429
- " print(\"// no decompiled output\")",
430
- " except:",
431
- " print(\"// decompile failed\")",
432
- " print(\"DECOMPILED_END\")",
433
- " print(\"FUNCTION_END\")"
434
- ].join("\n");
435
- }
436
- extractPrintableStrings(buffer) {
437
- const results = [];
438
- let current = "";
439
- for (const byte of buffer.values()) {
440
- if (byte >= 32 && byte <= 126) {
441
- current += String.fromCharCode(byte);
442
- continue;
443
- }
444
- if (current.length >= 4) results.push(current);
445
- current = "";
446
- }
447
- if (current.length >= 4) results.push(current);
448
- return Array.from(new Set(results)).slice(0, 1e3);
449
- }
450
- deriveImports(strings) {
451
- return strings.filter((entry) => /(?:\.dll|\.so|\.dylib|kernel32|user32|libc|printf|malloc|LoadLibrary)/i.test(entry)).slice(0, 100);
452
- }
453
- deriveExports(strings) {
454
- return strings.filter((entry) => /^[A-Za-z_][A-Za-z0-9_@?$]{2,}$/.test(entry)).slice(0, 100);
455
- }
456
- normalizeHex(value) {
457
- return value.startsWith("0x") ? value : `0x${value}`;
458
- }
459
- execFileUtf8(file, args, timeoutMs) {
460
- return new Promise((resolve, reject) => {
461
- execFile(file, args, {
462
- timeout: timeoutMs,
463
- windowsHide: true,
464
- maxBuffer: GHIDRA_MAX_BUFFER_BYTES,
465
- encoding: "utf8"
466
- }, (error, stdout, stderr) => {
467
- if (error) {
468
- reject(error);
469
- return;
470
- }
471
- resolve({
472
- stdout: typeof stdout === "string" ? stdout : "",
473
- stderr: typeof stderr === "string" ? stderr : ""
474
- });
475
- });
476
- });
477
- }
478
- };
479
- //#endregion
480
- //#region src/modules/binary-instrument/HookCodeGenerator.ts
481
- var HookCodeGenerator = class {
482
- generateHooks(input) {
483
- const templates = [];
484
- for (const fn of input.functions) {
485
- const category = this.classifyFunction(fn, input);
486
- if (category === "unknown") continue;
487
- templates.push({
488
- functionName: fn.name,
489
- description: this.describeCategory(category, input),
490
- hookCode: this.buildHookCode(fn, category),
491
- parameters: this.buildParameters(fn)
492
- });
493
- }
494
- return templates;
495
- }
496
- exportScript(templates, format) {
497
- if (format !== "frida") throw new Error("Unsupported export format");
498
- const lines = [
499
- "// Frida hook script",
500
- "// auto-generated by HookCodeGenerator",
501
- `// Hook count: ${templates.length}`,
502
- ""
503
- ];
504
- for (const template of templates) {
505
- lines.push(`// ${template.functionName}: ${template.description}`);
506
- lines.push(template.hookCode);
507
- lines.push("");
508
- }
509
- return lines.join("\n");
510
- }
511
- classifyFunction(fn, input) {
512
- const name = fn.name.toLowerCase();
513
- const imports = input.imports.map((entry) => entry.toLowerCase());
514
- const strings = input.strings.map((entry) => entry.toLowerCase());
515
- if (fn.name.startsWith("Java_")) return "jni";
516
- if (name.includes("aes")) return "aes";
517
- if (name.includes("md5")) return "md5";
518
- if (name.includes("sha")) return "sha";
519
- if (name.includes("rsa")) return "rsa";
520
- if (name.includes("base64")) return "base64";
521
- if (name.includes("send") || name.includes("recv") || name.includes("socket") || name.includes("http")) return "network";
522
- if (name.includes("open") || name.includes("read") || name.includes("write") || name.includes("fopen")) return "file-io";
523
- if ((name.includes("decrypt") || name.includes("encrypt")) && strings.some((entry) => entry.includes("obfuscation") || entry.includes("encryption"))) return "obfuscation";
524
- if (name.includes("memcpy") || name.includes("strcpy") || name.includes("memmove") || name.includes("string")) return "string";
525
- if (imports.some((entry) => entry.includes("aes"))) return "aes";
526
- return "unknown";
527
- }
528
- describeCategory(category, input) {
529
- switch (category) {
530
- case "jni": return "JNI bridge hook for Java/native boundary inspection";
531
- case "aes": return "AES crypto hook for key/plaintext capture";
532
- case "md5": return "MD5 crypto hook for digest inspection";
533
- case "sha": return "SHA crypto hook for digest inspection";
534
- case "rsa": return "RSA crypto hook for key operation tracing";
535
- case "base64": return "Base64 transform hook for encoded payload tracing";
536
- case "network": return "Network hook for request and payload tracing";
537
- case "file-io": return "File I/O hook for filesystem access tracing";
538
- case "string": return "String operation hook for buffer tracing";
539
- case "obfuscation": return input.strings.some((entry) => entry.toLowerCase().includes("obfuscation")) ? "Potential obfuscation hook for runtime string decryption tracing" : "Potential obfuscation hook";
540
- case "unknown": return "Unknown hook";
541
- }
542
- }
543
- buildHookCode(fn, category) {
544
- if (category === "jni") return [
545
- "Java.perform(function () {",
546
- ` const target = ptr("${fn.address}");`,
547
- " Interceptor.attach(target, {",
548
- " onEnter(args) {",
549
- ` console.log("[jni] ${fn.name}");`,
550
- " },",
551
- " });",
552
- "});"
553
- ].join("\n");
554
- const extraLine = category === "aes" || category === "md5" || category === "sha" || category === "rsa" || category === "base64" ? " console.log(hexdump(args[0]));" : " console.log(\"[trace] entering\");";
555
- const targetName = fn.name.replace(/[^A-Za-z0-9_]/g, "_");
556
- return [
557
- `const target_${targetName} = ptr("${fn.address}");`,
558
- `Interceptor.attach(target_${targetName}, {`,
559
- " onEnter(args) {",
560
- ` console.log("[hook] ${fn.name}");`,
561
- extraLine,
562
- " },",
563
- "});"
564
- ].join("\n");
565
- }
566
- buildParameters(fn) {
567
- if (fn.parameters.length > 0) return fn.parameters.map((parameter, index) => ({
568
- name: parameter.name || `arg${index}`,
569
- type: parameter.type || "pointer",
570
- description: `Captured parameter ${index}`
571
- }));
572
- return [{
573
- name: "arg0",
574
- type: "pointer",
575
- description: "Captured parameter 0"
576
- }];
577
- }
578
- };
579
- //#endregion
580
- //#region src/modules/binary-instrument/ExtensionBridge.ts
581
- async function invokePlugin(ctx, config) {
582
- const available = getAvailablePlugins(ctx);
583
- const normalizedRequested = normalizePluginId(config.pluginId);
584
- const actualPluginId = resolvePluginId(normalizedRequested, available);
585
- if (!actualPluginId) return {
586
- success: false,
587
- tool: "binary-instrument",
588
- action: config.toolName,
589
- error: `Plugin ${normalizedRequested} is not installed`
590
- };
591
- const runtime = findRuntime(ctx, actualPluginId);
592
- if (!runtime?.lifecycleContext) return {
593
- success: false,
594
- tool: "binary-instrument",
595
- action: config.toolName,
596
- error: `Plugin ${actualPluginId} is installed but has no runtime`
597
- };
598
- try {
599
- const firstText = (await runtime.lifecycleContext.invokeTool(config.toolName, config.args)).content?.find((item) => item.type === "text")?.text;
600
- if (!firstText) return {
601
- success: false,
602
- tool: "binary-instrument",
603
- action: config.toolName,
604
- error: "Plugin returned no text content"
605
- };
606
- try {
607
- const parsed = JSON.parse(firstText);
608
- if (isResultRecord(parsed)) return {
609
- tool: "binary-instrument",
610
- action: config.toolName,
611
- success: readBoolean(parsed, "success") ?? true,
612
- data: parsed["data"],
613
- error: readString(parsed, "error")
614
- };
615
- } catch {
616
- return {
617
- success: true,
618
- tool: "binary-instrument",
619
- action: config.toolName,
620
- data: firstText
621
- };
622
- }
623
- return {
624
- success: true,
625
- tool: "binary-instrument",
626
- action: config.toolName,
627
- data: firstText
628
- };
629
- } catch (error) {
630
- return {
631
- success: false,
632
- tool: "binary-instrument",
633
- action: config.toolName,
634
- error: error instanceof Error ? error.message : String(error)
635
- };
636
- }
637
- }
638
- function getAvailablePlugins(ctx) {
639
- return Array.from(ctx.extensionPluginsById.keys()).map(normalizePluginId);
640
- }
641
- function normalizePluginId(pluginId) {
642
- return pluginId.replaceAll("_", "-");
643
- }
644
- function resolvePluginId(requested, installed) {
645
- const requestedWithoutPrefix = requested.replace(/^plugin-/, "");
646
- for (const installedId of installed) {
647
- const installedWithoutPrefix = installedId.replace(/^plugin-/, "");
648
- if (installedId === requested || installedWithoutPrefix === requestedWithoutPrefix) return installedId;
649
- }
650
- }
651
- function findRuntime(ctx, normalizedPluginId) {
652
- for (const [pluginId, runtime] of ctx.extensionPluginRuntimeById.entries()) if (normalizePluginId(pluginId) === normalizedPluginId) return isPluginRuntime(runtime) ? runtime : void 0;
653
- }
654
- function isPluginRuntime(value) {
655
- return typeof value === "object" && value !== null;
656
- }
657
- function isResultRecord(value) {
658
- return typeof value === "object" && value !== null;
659
- }
660
- function readBoolean(record, key) {
661
- const value = record[key];
662
- return typeof value === "boolean" ? value : void 0;
663
- }
664
- function readString(record, key) {
665
- const value = record[key];
666
- return typeof value === "string" ? value : void 0;
667
- }
668
- //#endregion
669
- //#region src/modules/binary-instrument/HookGenerator.ts
670
- var HookGenerator = class {
671
- generateFridaHookScript(symbols, options) {
672
- const includeArgs = options?.includeArgs ?? true;
673
- const includeRetAddr = options?.includeRetAddr ?? false;
674
- const lines = [
675
- "'use strict';",
676
- "",
677
- "function resolveTarget(name) {",
678
- " try {",
679
- " const exported = Module.findExportByName(null, name);",
680
- " if (exported) {",
681
- " return exported;",
682
- " }",
683
- " } catch (error) {}",
684
- " try {",
685
- " const symbol = DebugSymbol.fromName(name);",
686
- " if (symbol && symbol.address) {",
687
- " return symbol.address;",
688
- " }",
689
- " } catch (error) {}",
690
- " return null;",
691
- "}",
692
- "",
693
- "const installedHooks = [];"
694
- ];
695
- for (let index = 0; index < symbols.length; index += 1) {
696
- const descriptor = this.toDescriptor(symbols[index]);
697
- const varName = `target_${index}`;
698
- const label = descriptor.demangled ?? descriptor.name;
699
- const addressLine = descriptor.address ? `const ${varName} = ptr("${this.escapeForDoubleQuotes(descriptor.address)}");` : `const ${varName} = resolveTarget("${this.escapeForDoubleQuotes(descriptor.name)}");`;
700
- lines.push(addressLine);
701
- lines.push(`if (${varName}) {`);
702
- lines.push(` Interceptor.attach(${varName}, {`);
703
- lines.push(" onEnter(args) {");
704
- if (includeRetAddr) lines.push(` console.log("[binary-instrument] enter ${this.escapeForDoubleQuotes(label)} ret=" + this.returnAddress);`);
705
- else lines.push(` console.log("[binary-instrument] enter ${this.escapeForDoubleQuotes(label)}");`);
706
- if (includeArgs) {
707
- lines.push(" const renderedArgs = [];");
708
- lines.push(" for (let i = 0; i < 6; i += 1) {");
709
- lines.push(" try {");
710
- lines.push(" renderedArgs.push(String(args[i]));");
711
- lines.push(" } catch (error) {");
712
- lines.push(" renderedArgs.push(\"<unreadable>\");");
713
- lines.push(" }");
714
- lines.push(" }");
715
- lines.push(" console.log(\"[binary-instrument] args \" + JSON.stringify(renderedArgs));");
716
- }
717
- lines.push(" },");
718
- lines.push(" onLeave(retval) {");
719
- lines.push(` console.log("[binary-instrument] leave ${this.escapeForDoubleQuotes(label)} retval=" + retval);`);
720
- lines.push(" },");
721
- lines.push(" });");
722
- lines.push(` installedHooks.push({ name: "${this.escapeForDoubleQuotes(label)}", address: String(${varName}) });`);
723
- lines.push("} else {");
724
- lines.push(` console.log("[binary-instrument] unresolved ${this.escapeForDoubleQuotes(label)}");`);
725
- lines.push("}");
726
- lines.push("");
727
- }
728
- lines.push("console.log(\"[binary-instrument] hooks=\" + JSON.stringify(installedHooks));");
729
- return lines.join("\n");
730
- }
731
- generateInterceptorScript(targetFuncs) {
732
- return this.generateFridaHookScript(targetFuncs, {
733
- includeArgs: true,
734
- includeRetAddr: false
735
- });
736
- }
737
- toDescriptor(symbol) {
738
- if (typeof symbol === "string") return { name: symbol };
739
- return symbol;
740
- }
741
- escapeForDoubleQuotes(value) {
742
- return value.replaceAll("\\", "\\\\").replaceAll("\"", "\\\"");
743
- }
744
- };
745
- //#endregion
746
- //#region src/modules/binary-instrument/UnidbgRunner.ts
747
- const UNIDBG_MAX_BUFFER_BYTES = 8 * 1024 * 1024;
748
- var UnidbgRunner = class {
749
- sessions = /* @__PURE__ */ new Map();
750
- close() {
751
- for (const session of this.sessions.values()) if (session.childProcess) try {
752
- process.kill(session.childProcess.pid, "SIGTERM");
753
- } catch {}
754
- this.sessions.clear();
755
- }
756
- /**
757
- * Launch a .so library in the Unidbg emulator via JVM subprocess.
758
- * Returns a sessionId for subsequent call/trace operations.
759
- */
760
- async launch(soPath, arch = "arm", jarPath) {
761
- const resolvedJar = jarPath ?? process.env["UNIDBG_JAR"];
762
- if (!resolvedJar) throw new Error("UNIDBG_JAR is not configured. Set the UNIDBG_JAR env var or pass jarPath.");
763
- try {
764
- await access(resolvedJar);
765
- } catch {
766
- throw new Error(`Unidbg JAR not found: ${resolvedJar}`);
767
- }
768
- try {
769
- await access(soPath);
770
- } catch {
771
- throw new Error(`Shared library not found: ${soPath}`);
772
- }
773
- const sessionId = randomUUID();
774
- const command = this.getJavaCommand();
775
- const args = [
776
- "-jar",
777
- resolvedJar,
778
- "--so",
779
- soPath,
780
- "--arch",
781
- arch,
782
- "--server"
783
- ];
784
- try {
785
- const result = await this.execFileUtf8(command, args, UNIDBG_TIMEOUT_MS);
786
- const sessionInfo = this.parseLaunchOutput(result.stdout, sessionId);
787
- const session = {
788
- id: sessionInfo.id,
789
- soPath,
790
- arch,
791
- startedAt: (/* @__PURE__ */ new Date()).toISOString(),
792
- childProcess: sessionInfo.pid ? { pid: sessionInfo.pid } : void 0
793
- };
794
- this.sessions.set(sessionId, session);
795
- return {
796
- sessionId,
797
- soPath,
798
- arch
799
- };
800
- } catch (error) {
801
- const message = error instanceof Error ? error.message : String(error);
802
- logger.warn("[binary-instrument] Unidbg launch failed, registering stub session", {
803
- soPath,
804
- message
805
- });
806
- const session = {
807
- id: sessionId,
808
- soPath,
809
- arch,
810
- startedAt: (/* @__PURE__ */ new Date()).toISOString()
811
- };
812
- this.sessions.set(sessionId, session);
813
- return {
814
- sessionId,
815
- soPath,
816
- arch
817
- };
818
- }
819
- }
820
- async callFunction(sessionId, functionName, args = {}) {
821
- if (!this.sessions.get(sessionId)) throw new Error(`No unidbg session found for ${sessionId}`);
822
- const jarPath = process.env["UNIDBG_JAR"];
823
- if (!jarPath) return {
824
- sessionId,
825
- functionName,
826
- args,
827
- returnValue: "0x0",
828
- stdout: "",
829
- stderr: "",
830
- trace: ["mock-unidbg-unavailable"],
831
- _note: "Unidbg emulation requires UNIDBG_JAR to be configured"
832
- };
833
- const command = this.getJavaCommand();
834
- const callArgs = [
835
- "-jar",
836
- jarPath,
837
- "--session",
838
- sessionId,
839
- "--call",
840
- functionName,
841
- "--args",
842
- JSON.stringify(args)
843
- ];
844
- try {
845
- const result = await this.execFileUtf8(command, callArgs, UNIDBG_TIMEOUT_MS);
846
- return {
847
- sessionId,
848
- functionName,
849
- args,
850
- returnValue: this.extractReturnValue(result.stdout),
851
- stdout: result.stdout.trim(),
852
- stderr: result.stderr.trim(),
853
- trace: []
854
- };
855
- } catch (error) {
856
- return {
857
- sessionId,
858
- functionName,
859
- args,
860
- returnValue: "0x0",
861
- stdout: "",
862
- stderr: error instanceof Error ? error.message : String(error),
863
- trace: ["error"]
864
- };
865
- }
866
- }
867
- async trace(sessionId) {
868
- if (!this.sessions.get(sessionId)) throw new Error(`No unidbg session found for ${sessionId}`);
869
- const jarPath = process.env["UNIDBG_JAR"];
870
- if (!jarPath) return {
871
- sessionId,
872
- trace: ["mock-unidbg-unavailable"],
873
- _note: "Unidbg tracing requires UNIDBG_JAR to be configured"
874
- };
875
- const command = this.getJavaCommand();
876
- const traceArgs = [
877
- "-jar",
878
- jarPath,
879
- "--session",
880
- sessionId,
881
- "--trace"
882
- ];
883
- try {
884
- const result = await this.execFileUtf8(command, traceArgs, UNIDBG_TIMEOUT_MS);
885
- return {
886
- sessionId,
887
- trace: this.parseTraceOutput(result.stdout),
888
- instructionCount: this.countInstructions(result.stdout)
889
- };
890
- } catch (error) {
891
- return {
892
- sessionId,
893
- trace: ["error"],
894
- error: error instanceof Error ? error.message : String(error)
895
- };
896
- }
897
- }
898
- /**
899
- * Get info about an active Unidbg session.
900
- */
901
- getSessionInfo(sessionId) {
902
- return this.sessions.get(sessionId);
903
- }
904
- /**
905
- * List all active Unidbg sessions.
906
- */
907
- listSessions() {
908
- return Array.from(this.sessions.values()).map((s) => ({
909
- id: s.id,
910
- soPath: s.soPath,
911
- arch: s.arch,
912
- startedAt: s.startedAt
913
- }));
914
- }
915
- getJavaCommand() {
916
- return process.env["JAVA_HOME"] ? `${process.env["JAVA_HOME"]}/bin/java` : "java";
917
- }
918
- parseLaunchOutput(stdout, fallbackId) {
919
- const lines = stdout.split(/\r?\n/).filter((l) => l.trim().length > 0);
920
- for (const line of lines.toReversed()) try {
921
- const parsed = JSON.parse(line);
922
- if (typeof parsed["id"] === "string") return {
923
- id: parsed["id"],
924
- pid: typeof parsed["pid"] === "number" ? parsed["pid"] : null
925
- };
926
- } catch {}
927
- return {
928
- id: fallbackId,
929
- pid: null
930
- };
931
- }
932
- extractReturnValue(stdout) {
933
- const match = /return[=:\s]+(0x[0-9a-fA-F]+|-?\d+)/.exec(stdout);
934
- if (match?.[1]) return match[1];
935
- return "0x0";
936
- }
937
- parseTraceOutput(stdout) {
938
- return stdout.split(/\r?\n/).filter((line) => line.trim().length > 0 && !line.startsWith("{")).slice(0, 1e4);
939
- }
940
- countInstructions(stdout) {
941
- return stdout.split(/\r?\n/).filter((line) => line.trim().length > 0 && !line.startsWith("{") && /\b(ldr|str|mov|bl|b|add|sub)\b/i.test(line)).length;
942
- }
943
- async execFileUtf8(file, args, timeoutMs) {
944
- return new Promise((resolve, reject) => {
945
- execFile(file, args, {
946
- timeout: timeoutMs,
947
- windowsHide: true,
948
- maxBuffer: UNIDBG_MAX_BUFFER_BYTES,
949
- encoding: "utf8"
950
- }, (error, stdout, stderr) => {
951
- if (error) {
952
- reject(error);
953
- return;
954
- }
955
- resolve({
956
- stdout: typeof stdout === "string" ? stdout : "",
957
- stderr: typeof stderr === "string" ? stderr : "",
958
- exitCode: 0
959
- });
960
- });
961
- });
962
- }
963
- };
964
- //#endregion
965
- //#region src/modules/binary-instrument/index.ts
966
- var binary_instrument_exports = /* @__PURE__ */ __exportAll({
967
- GhidraAnalyzer: () => GhidraAnalyzer,
968
- HookGenerator: () => HookGenerator
969
- });
970
- //#endregion
971
- export { invokePlugin as a, FridaSession as c, getAvailablePlugins as i, UnidbgRunner as n, HookCodeGenerator as o, HookGenerator as r, GhidraAnalyzer as s, binary_instrument_exports as t };