@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,96 +0,0 @@
1
- import { n as __require } from "./chunk-CjcI7cDX.mjs";
2
- import { t as logger } from "./logger-Dh_xb7_2.mjs";
3
- //#region src/modules/stealth/FingerprintManager.ts
4
- var FingerprintManager = class FingerprintManager {
5
- static instance = null;
6
- activeProfile = null;
7
- available = null;
8
- constructor() {}
9
- static getInstance() {
10
- if (!FingerprintManager.instance) FingerprintManager.instance = new FingerprintManager();
11
- return FingerprintManager.instance;
12
- }
13
- /**
14
- * Check if fingerprint-generator and fingerprint-injector packages are installed.
15
- */
16
- isAvailable() {
17
- if (this.available !== null) return this.available;
18
- try {
19
- __require.resolve("fingerprint-generator");
20
- __require.resolve("fingerprint-injector");
21
- this.available = true;
22
- } catch {
23
- this.available = false;
24
- }
25
- return this.available;
26
- }
27
- /**
28
- * Generate a fingerprint profile using real-world datasets.
29
- * Returns null if packages are not installed.
30
- */
31
- async generateFingerprint(options) {
32
- if (!this.isAvailable()) {
33
- logger.warn("fingerprint-generator not installed. Run: pnpm add fingerprint-generator fingerprint-injector");
34
- return null;
35
- }
36
- try {
37
- const { FingerprintGenerator } = await import("fingerprint-generator");
38
- const generator = new FingerprintGenerator();
39
- const fpOptions = {};
40
- if (options?.os) fpOptions.operatingSystems = [{
41
- windows: "windows",
42
- macos: "macos",
43
- linux: "linux"
44
- }[options.os] ?? "windows"];
45
- if (options?.browser) fpOptions.browsers = [options.browser];
46
- if (options?.locale) fpOptions.locales = [options.locale];
47
- if (options?.screen) fpOptions.screen = options.screen;
48
- const result = generator.getFingerprint(fpOptions);
49
- this.activeProfile = {
50
- fingerprint: result.fingerprint,
51
- headers: result.headers ?? {},
52
- generatedAt: Date.now(),
53
- os: options?.os ?? "windows",
54
- browser: options?.browser ?? "chrome"
55
- };
56
- logger.info(`Fingerprint generated for ${this.activeProfile.os}/${this.activeProfile.browser}`);
57
- return this.activeProfile;
58
- } catch (err) {
59
- logger.error("Failed to generate fingerprint:", err);
60
- return null;
61
- }
62
- }
63
- /**
64
- * Inject the given fingerprint profile into a page.
65
- * Must be called BEFORE StealthScripts.injectAll().
66
- */
67
- async injectFingerprint(page, profile) {
68
- if (!this.isAvailable()) throw new Error("fingerprint-injector not installed");
69
- try {
70
- const { newInjectedPage } = await import("fingerprint-injector");
71
- await newInjectedPage(page, { fingerprint: "fingerprint" in profile ? profile.fingerprint : profile });
72
- logger.info("Fingerprint injected into page");
73
- } catch (err) {
74
- logger.error("Failed to inject fingerprint:", err);
75
- throw err;
76
- }
77
- }
78
- /**
79
- * Get the currently cached fingerprint profile.
80
- */
81
- getActiveProfile() {
82
- return this.activeProfile;
83
- }
84
- /**
85
- * Clear the cached fingerprint profile.
86
- */
87
- clearProfile() {
88
- this.activeProfile = null;
89
- }
90
- /** Reset singleton for testing purposes. */
91
- static resetInstance() {
92
- FingerprintManager.instance = null;
93
- }
94
- };
95
- //#endregion
96
- export { FingerprintManager };
@@ -1,239 +0,0 @@
1
- import { _ as BREAKPOINT_HIT_TIMEOUT_MS, v as BREAKPOINT_TRACE_MAX_HITS } from "./constants-CDZLOoVv.mjs";
2
- import { t as CloseHandle } from "./Win32API-C2kjj0ze.mjs";
3
- import { _ as openThreadForDebug, a as DebugActiveProcessStop, c as EnumerateProcessThreads, d as ResumeThread, f as SetThreadContext, g as encodeDR7, h as WaitForDebugEvent, i as DebugActiveProcess, n as ContinueDebugEvent, o as DebugSetProcessKillOnExit, p as SuspendThread, r as DBG, s as EXCEPTION_CODE, t as CONTEXT_FLAGS, u as GetThreadContext, v as parseContext, y as writeContext } from "./Win32Debug-CKrGOTpo.mjs";
4
- import { randomUUID } from "node:crypto";
5
- //#region src/native/HardwareBreakpoint.ts
6
- /**
7
- * Hardware Breakpoint Engine — x64 debug register management.
8
- *
9
- * Sets/clears hardware breakpoints using DR0–DR3, monitors for hits,
10
- * and returns access context (instruction address, thread, register state).
11
- *
12
- * @module HardwareBreakpoint
13
- */
14
- const toHex = (v) => `0x${v.toString(16).toUpperCase()}`;
15
- var HardwareBreakpointEngine = class {
16
- breakpoints = /* @__PURE__ */ new Map();
17
- attachedPids = /* @__PURE__ */ new Set();
18
- drAllocation = [
19
- false,
20
- false,
21
- false,
22
- false
23
- ];
24
- /** Attach to process as debugger (required before setting breakpoints) */
25
- async attach(pid) {
26
- if (this.attachedPids.has(pid)) return;
27
- DebugActiveProcess(pid);
28
- DebugSetProcessKillOnExit(false);
29
- this.attachedPids.add(pid);
30
- for (let i = 0; i < 100; i++) {
31
- const evt = WaitForDebugEvent(100);
32
- if (!evt) break;
33
- ContinueDebugEvent(evt.processId, evt.threadId, DBG.CONTINUE);
34
- }
35
- }
36
- /** Detach from process */
37
- async detach(pid) {
38
- for (const [id, bp] of this.breakpoints) if (bp.pid === pid) {
39
- this.clearDR(pid, bp.drIndex);
40
- this.drAllocation[bp.drIndex] = false;
41
- this.breakpoints.delete(id);
42
- }
43
- if (this.attachedPids.has(pid)) {
44
- try {
45
- DebugActiveProcessStop(pid);
46
- } catch {}
47
- this.attachedPids.delete(pid);
48
- }
49
- }
50
- /** Set a hardware breakpoint using an available DR register */
51
- async setBreakpoint(pid, address, access, size = 4) {
52
- if (!this.attachedPids.has(pid)) await this.attach(pid);
53
- const drIndex = this.allocateDR();
54
- const targetAddr = BigInt(address.startsWith("0x") ? address : `0x${address}`);
55
- this.applyDRToAllThreads(pid, drIndex, targetAddr, access, size, true);
56
- const config = {
57
- id: randomUUID(),
58
- pid,
59
- address: `0x${targetAddr.toString(16).toUpperCase()}`,
60
- access,
61
- size,
62
- enabled: true,
63
- drIndex,
64
- hitCount: 0
65
- };
66
- this.breakpoints.set(config.id, config);
67
- return config;
68
- }
69
- /** Remove a hardware breakpoint */
70
- async removeBreakpoint(id) {
71
- const bp = this.breakpoints.get(id);
72
- if (!bp) return false;
73
- this.clearDR(bp.pid, bp.drIndex);
74
- this.drAllocation[bp.drIndex] = false;
75
- this.breakpoints.delete(id);
76
- return true;
77
- }
78
- /** List all active breakpoints */
79
- listBreakpoints() {
80
- return Array.from(this.breakpoints.values()).map((bp) => ({
81
- id: bp.id,
82
- address: bp.address,
83
- access: bp.access,
84
- size: bp.size,
85
- enabled: bp.enabled,
86
- hitCount: bp.hitCount,
87
- lastHit: bp.lastHit
88
- }));
89
- }
90
- /** Wait for a breakpoint hit */
91
- async waitForHit(timeoutMs) {
92
- const timeout = timeoutMs ?? BREAKPOINT_HIT_TIMEOUT_MS;
93
- const deadline = Date.now() + timeout;
94
- while (Date.now() < deadline) {
95
- const remaining = Math.max(100, deadline - Date.now());
96
- const evt = WaitForDebugEvent(Math.min(remaining, 500));
97
- if (!evt) continue;
98
- if (evt.exceptionCode === EXCEPTION_CODE.SINGLE_STEP) {
99
- const hit = this.processHit(evt.threadId, evt.processId, evt.exceptionAddress);
100
- ContinueDebugEvent(evt.processId, evt.threadId, DBG.CONTINUE);
101
- if (hit) return hit;
102
- } else ContinueDebugEvent(evt.processId, evt.threadId, DBG.CONTINUE);
103
- }
104
- return null;
105
- }
106
- /** Trace access: collect multiple hits, answers "who reads/writes this address?" */
107
- async traceAccess(pid, address, access, maxHits, timeoutMs) {
108
- const max = maxHits ?? BREAKPOINT_TRACE_MAX_HITS;
109
- const timeout = timeoutMs ?? BREAKPOINT_HIT_TIMEOUT_MS;
110
- const bp = await this.setBreakpoint(pid, address, access);
111
- const hits = [];
112
- const deadline = Date.now() + timeout;
113
- while (hits.length < max && Date.now() < deadline) {
114
- const hit = await this.waitForHit(Math.min(1e3, deadline - Date.now()));
115
- if (hit?.breakpointId === bp.id) hits.push(hit);
116
- }
117
- await this.removeBreakpoint(bp.id);
118
- return hits;
119
- }
120
- allocateDR() {
121
- for (let i = 0; i < 4; i++) if (!this.drAllocation[i]) {
122
- this.drAllocation[i] = true;
123
- return i;
124
- }
125
- throw new Error("All 4 hardware breakpoint registers (DR0-DR3) are in use");
126
- }
127
- applyDRToAllThreads(pid, drIndex, address, access, size, enable) {
128
- const threads = EnumerateProcessThreads(pid);
129
- const drAccessMap = {
130
- execute: "execute",
131
- write: "write",
132
- readwrite: "readwrite",
133
- read: "read"
134
- };
135
- for (const tid of threads) {
136
- let hThread;
137
- try {
138
- hThread = openThreadForDebug(tid);
139
- } catch {
140
- continue;
141
- }
142
- try {
143
- SuspendThread(hThread);
144
- const ctxBuf = GetThreadContext(hThread, CONTEXT_FLAGS.ALL);
145
- const drOffsets = [
146
- 72,
147
- 80,
148
- 88,
149
- 96
150
- ];
151
- if (enable) ctxBuf.writeBigUInt64LE(address, drOffsets[drIndex]);
152
- else ctxBuf.writeBigUInt64LE(0n, drOffsets[drIndex]);
153
- const entries = Array.from(this.breakpoints.values()).filter((bp) => bp.enabled).map((bp) => ({
154
- drIndex: bp.drIndex,
155
- enabled: true,
156
- access: drAccessMap[bp.access],
157
- size: bp.size
158
- }));
159
- if (enable) entries.push({
160
- drIndex,
161
- enabled: true,
162
- access: drAccessMap[access],
163
- size
164
- });
165
- const dr7 = encodeDR7(entries);
166
- ctxBuf.writeBigUInt64LE(dr7, 112);
167
- writeContext(ctxBuf, { contextFlags: CONTEXT_FLAGS.ALL });
168
- SetThreadContext(hThread, ctxBuf);
169
- ResumeThread(hThread);
170
- } catch {
171
- try {
172
- ResumeThread(hThread);
173
- } catch {}
174
- } finally {
175
- CloseHandle(hThread);
176
- }
177
- }
178
- }
179
- clearDR(pid, drIndex) {
180
- this.applyDRToAllThreads(pid, drIndex, 0n, "write", 1, false);
181
- }
182
- processHit(threadId, processId, _exceptionAddress) {
183
- let hThread;
184
- try {
185
- hThread = openThreadForDebug(threadId);
186
- } catch {
187
- return null;
188
- }
189
- try {
190
- const ctxBuf = GetThreadContext(hThread, CONTEXT_FLAGS.ALL);
191
- const ctx = parseContext(ctxBuf);
192
- for (const [id, bp] of this.breakpoints) {
193
- if (bp.pid !== processId) continue;
194
- const drBit = 1n << BigInt(bp.drIndex);
195
- if (ctx.dr6 & drBit) {
196
- bp.hitCount++;
197
- bp.lastHit = Date.now();
198
- ctxBuf.writeBigUInt64LE(0n, 104);
199
- SetThreadContext(hThread, ctxBuf);
200
- return {
201
- breakpointId: id,
202
- address: bp.address,
203
- accessAddress: bp.address,
204
- instructionAddress: toHex(ctx.rip),
205
- threadId,
206
- accessType: bp.access,
207
- timestamp: Date.now(),
208
- registers: {
209
- rax: toHex(ctx.rax),
210
- rbx: toHex(ctx.rbx),
211
- rcx: toHex(ctx.rcx),
212
- rdx: toHex(ctx.rdx),
213
- rsi: toHex(ctx.rsi),
214
- rdi: toHex(ctx.rdi),
215
- rsp: toHex(ctx.rsp),
216
- rbp: toHex(ctx.rbp),
217
- r8: toHex(ctx.r8),
218
- r9: toHex(ctx.r9),
219
- r10: toHex(ctx.r10),
220
- r11: toHex(ctx.r11),
221
- r12: toHex(ctx.r12),
222
- r13: toHex(ctx.r13),
223
- r14: toHex(ctx.r14),
224
- r15: toHex(ctx.r15),
225
- rip: toHex(ctx.rip),
226
- rflags: `0x${ctx.eflags.toString(16).toUpperCase()}`
227
- }
228
- };
229
- }
230
- }
231
- return null;
232
- } finally {
233
- CloseHandle(hThread);
234
- }
235
- }
236
- };
237
- const hardwareBreakpointEngine = new HardwareBreakpointEngine();
238
- //#endregion
239
- export { HardwareBreakpointEngine, hardwareBreakpointEngine };
@@ -1,284 +0,0 @@
1
- import { t as logger } from "./logger-Dh_xb7_2.mjs";
2
- import { ct as HEAP_SPRAY_THRESHOLD, lt as HEAP_SUSPICIOUS_BLOCK_SIZE, ot as HEAP_ENUMERATE_MAX_BLOCKS, st as HEAP_SPRAY_SIZE_TOLERANCE } from "./constants-CDZLOoVv.mjs";
3
- import { b as openProcessForMemory, d as ReadProcessMemory, t as CloseHandle } from "./Win32API-C2kjj0ze.mjs";
4
- import { m as TH32CS } from "./Win32Debug-CKrGOTpo.mjs";
5
- import koffi from "koffi";
6
- //#region src/native/HeapAnalyzer.types.ts
7
- /** Heap block flags */
8
- const LF32 = {
9
- FIXED: 1,
10
- FREE: 2,
11
- MOVEABLE: 4
12
- };
13
- /** Heap flags */
14
- const HF32 = {
15
- DEFAULT: 1,
16
- SHARED: 2
17
- };
18
- //#endregion
19
- //#region src/native/HeapAnalyzer.ts
20
- /**
21
- * Heap Analysis Engine.
22
- *
23
- * Enumerates process heaps and blocks via Toolhelp32 Snapshot APIs,
24
- * provides statistical analysis and anomaly detection (spray, UAF heuristic).
25
- *
26
- * @module HeapAnalyzer
27
- */
28
- let heapApisCache = null;
29
- function loadHeapApis() {
30
- const k32 = koffi.load("kernel32.dll");
31
- return {
32
- CreateToolhelp32Snapshot: k32.func("CreateToolhelp32Snapshot", "intptr", ["uint32", "uint32"]),
33
- Heap32ListFirst: k32.func("Heap32ListFirst", "bool", ["intptr", "_Inout_ uint8_t *"]),
34
- Heap32ListNext: k32.func("Heap32ListNext", "bool", ["intptr", "_Inout_ uint8_t *"]),
35
- Heap32First: k32.func("Heap32First", "bool", [
36
- "_Inout_ uint8_t *",
37
- "uint32",
38
- "uintptr_t"
39
- ]),
40
- Heap32Next: k32.func("Heap32Next", "bool", ["_Inout_ uint8_t *"]),
41
- CloseHandle: k32.func("int CloseHandle(intptr)"),
42
- HEAPLIST32_SIZE: 36,
43
- HEAPENTRY32_SIZE: 56
44
- };
45
- }
46
- function getHeapApis() {
47
- if (!heapApisCache) heapApisCache = loadHeapApis();
48
- return heapApisCache;
49
- }
50
- const SIZE_RANGES = [
51
- [
52
- "0-64B",
53
- 0,
54
- 64
55
- ],
56
- [
57
- "64-256B",
58
- 64,
59
- 256
60
- ],
61
- [
62
- "256B-1KB",
63
- 256,
64
- 1024
65
- ],
66
- [
67
- "1-4KB",
68
- 1024,
69
- 4096
70
- ],
71
- [
72
- "4-16KB",
73
- 4096,
74
- 16384
75
- ],
76
- [
77
- "16-64KB",
78
- 16384,
79
- 65536
80
- ],
81
- [
82
- "64KB-1MB",
83
- 65536,
84
- 1048576
85
- ],
86
- [
87
- ">1MB",
88
- 1048576,
89
- Number.MAX_SAFE_INTEGER
90
- ]
91
- ];
92
- function classifyBlock(size) {
93
- for (let i = 0; i < SIZE_RANGES.length; i++) {
94
- const range = SIZE_RANGES[i];
95
- if (size >= range[1] && size < range[2]) return i;
96
- }
97
- return SIZE_RANGES.length - 1;
98
- }
99
- var HeapAnalyzer = class {
100
- /**
101
- * Enumerate all heaps in a process and return info + stats.
102
- */
103
- async enumerateHeaps(pid) {
104
- const apis = getHeapApis();
105
- const hSnap = apis.CreateToolhelp32Snapshot(TH32CS.SNAPHEAPLIST, pid);
106
- if (hSnap === -1n && typeof hSnap === "bigint") throw new Error(`Failed to create heap snapshot for PID ${pid}`);
107
- const heaps = [];
108
- try {
109
- const hlBuf = Buffer.alloc(apis.HEAPLIST32_SIZE);
110
- hlBuf.writeBigUInt64LE(BigInt(apis.HEAPLIST32_SIZE), 0);
111
- let hasHeap = apis.Heap32ListFirst(hSnap, hlBuf);
112
- while (hasHeap) {
113
- const processId = hlBuf.readUInt32LE(8);
114
- const heapId = hlBuf.readBigUInt64LE(12);
115
- const flags = hlBuf.readUInt32LE(20);
116
- const blocks = await this.enumerateBlocksInternal(pid, heapId, HEAP_ENUMERATE_MAX_BLOCKS);
117
- heaps.push({
118
- heapId: `0x${heapId.toString(16)}`,
119
- processId,
120
- flags,
121
- isDefault: (flags & HF32.DEFAULT) !== 0,
122
- blockCount: blocks.length,
123
- totalSize: blocks.reduce((sum, b) => sum + b.size, 0)
124
- });
125
- hlBuf.writeBigUInt64LE(BigInt(apis.HEAPLIST32_SIZE), 0);
126
- hasHeap = apis.Heap32ListNext(hSnap, hlBuf);
127
- }
128
- } finally {
129
- apis.CloseHandle(hSnap);
130
- }
131
- return {
132
- heaps,
133
- stats: this.computeStats(heaps, [])
134
- };
135
- }
136
- /**
137
- * Enumerate blocks within a specific heap.
138
- */
139
- async enumerateBlocks(pid, heapId, options) {
140
- const id = BigInt(heapId);
141
- const max = options?.maxBlocks ?? HEAP_ENUMERATE_MAX_BLOCKS;
142
- return this.enumerateBlocksInternal(pid, id, max);
143
- }
144
- /**
145
- * Get full statistical breakdown for all heaps.
146
- */
147
- async getStats(pid) {
148
- const { heaps } = await this.enumerateHeaps(pid);
149
- const allBlocks = [];
150
- for (const heap of heaps) {
151
- const blocks = await this.enumerateBlocksInternal(pid, BigInt(heap.heapId), HEAP_ENUMERATE_MAX_BLOCKS);
152
- allBlocks.push(...blocks);
153
- }
154
- return this.computeStats(heaps, allBlocks);
155
- }
156
- /**
157
- * Detect heap anomalies: spray, UAF heuristic, suspicious sizes.
158
- */
159
- async detectAnomalies(pid) {
160
- const anomalies = [];
161
- const { heaps } = await this.enumerateHeaps(pid);
162
- for (const heap of heaps) {
163
- const blocks = await this.enumerateBlocksInternal(pid, BigInt(heap.heapId), HEAP_ENUMERATE_MAX_BLOCKS);
164
- this.detectSpray(blocks, heap.heapId, anomalies);
165
- this.detectSuspiciousSizes(blocks, heap.heapId, anomalies);
166
- await this.detectPossibleUaf(pid, blocks, heap.heapId, anomalies);
167
- }
168
- return anomalies;
169
- }
170
- async enumerateBlocksInternal(pid, heapId, maxBlocks) {
171
- const apis = getHeapApis();
172
- const blocks = [];
173
- const heBuf = Buffer.alloc(apis.HEAPENTRY32_SIZE);
174
- heBuf.writeBigUInt64LE(BigInt(apis.HEAPENTRY32_SIZE), 0);
175
- let hasBlock = apis.Heap32First(heBuf, pid, heapId);
176
- while (hasBlock && blocks.length < maxBlocks) {
177
- const address = heBuf.readBigUInt64LE(16);
178
- const blockSize = Number(heBuf.readBigUInt64LE(24));
179
- const flags = heBuf.readUInt32LE(32);
180
- blocks.push({
181
- address: `0x${address.toString(16)}`,
182
- size: blockSize,
183
- flags,
184
- heapId: `0x${heapId.toString(16)}`,
185
- isFree: (flags & LF32.FREE) !== 0
186
- });
187
- heBuf.writeBigUInt64LE(BigInt(apis.HEAPENTRY32_SIZE), 0);
188
- hasBlock = apis.Heap32Next(heBuf);
189
- }
190
- return blocks;
191
- }
192
- computeStats(heaps, blocks) {
193
- const buckets = SIZE_RANGES.map(([range]) => ({
194
- range,
195
- count: 0,
196
- totalBytes: 0
197
- }));
198
- let totalSize = 0;
199
- let freeSize = 0;
200
- let largestBlock = 0;
201
- let smallestBlock = Number.MAX_SAFE_INTEGER;
202
- for (const block of blocks) {
203
- totalSize += block.size;
204
- if (block.isFree) freeSize += block.size;
205
- if (block.size > largestBlock) largestBlock = block.size;
206
- if (!block.isFree && block.size < smallestBlock) smallestBlock = block.size;
207
- const idx = classifyBlock(block.size);
208
- buckets[idx].count++;
209
- buckets[idx].totalBytes += block.size;
210
- }
211
- if (smallestBlock === Number.MAX_SAFE_INTEGER) smallestBlock = 0;
212
- if (totalSize === 0 && heaps.length > 0) totalSize = heaps.reduce((s, h) => s + h.totalSize, 0);
213
- return {
214
- totalHeaps: heaps.length,
215
- totalBlocks: blocks.length || heaps.reduce((s, h) => s + h.blockCount, 0),
216
- totalSize,
217
- freeSize,
218
- usedSize: totalSize - freeSize,
219
- largestBlock,
220
- smallestBlock,
221
- averageBlockSize: blocks.length > 0 ? Math.round(totalSize / blocks.length) : 0,
222
- sizeDistribution: buckets,
223
- fragmentationRatio: totalSize > 0 ? freeSize / totalSize : 0
224
- };
225
- }
226
- detectSpray(blocks, heapId, anomalies) {
227
- const sizeGroups = /* @__PURE__ */ new Map();
228
- for (const block of blocks) {
229
- if (block.isFree) continue;
230
- const rounded = Math.round(block.size / HEAP_SPRAY_SIZE_TOLERANCE) * HEAP_SPRAY_SIZE_TOLERANCE;
231
- const group = sizeGroups.get(rounded) ?? [];
232
- group.push(block);
233
- sizeGroups.set(rounded, group);
234
- }
235
- for (const [size, group] of sizeGroups) if (group.length >= HEAP_SPRAY_THRESHOLD) anomalies.push({
236
- type: "heap_spray_pattern",
237
- severity: "high",
238
- address: group[0].address,
239
- details: `${group.length} blocks of ~${size} bytes detected — possible heap spray`,
240
- heapId
241
- });
242
- }
243
- detectSuspiciousSizes(blocks, heapId, anomalies) {
244
- for (const block of blocks) if (block.size === 0) anomalies.push({
245
- type: "suspicious_size",
246
- severity: "medium",
247
- address: block.address,
248
- details: "Block with zero size",
249
- heapId
250
- });
251
- else if (block.size > HEAP_SUSPICIOUS_BLOCK_SIZE) anomalies.push({
252
- type: "suspicious_size",
253
- severity: "medium",
254
- address: block.address,
255
- details: `Unusually large block: ${(block.size / (1024 * 1024)).toFixed(1)} MB`,
256
- heapId
257
- });
258
- }
259
- async detectPossibleUaf(pid, blocks, heapId, anomalies) {
260
- const sampled = blocks.filter((b) => b.isFree && b.size >= 8).slice(0, 100);
261
- let hProcess = null;
262
- try {
263
- hProcess = openProcessForMemory(pid);
264
- for (const block of sampled) {
265
- const addr = BigInt(block.address);
266
- const data = ReadProcessMemory(hProcess, addr, 8);
267
- if (data && data.readBigUInt64LE(0) !== 0n) anomalies.push({
268
- type: "possible_uaf",
269
- severity: "low",
270
- address: block.address,
271
- details: `Free block has non-zero data: 0x${data.readBigUInt64LE(0).toString(16)}`,
272
- heapId
273
- });
274
- }
275
- } catch (e) {
276
- logger.debug(`UAF check failed for PID ${pid}: ${e}`);
277
- } finally {
278
- if (hProcess) CloseHandle(hProcess);
279
- }
280
- }
281
- };
282
- const heapAnalyzer = new HeapAnalyzer();
283
- //#endregion
284
- export { HeapAnalyzer, heapAnalyzer };