@jshookmcp/jshook 0.2.9 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/README.zh.md +2 -2
- package/dist/{AntiCheatDetector-BNk-EoBt.mjs → AntiCheatDetector-CqGDXmfc.mjs} +159 -53
- package/dist/{CodeInjector-Cq8q01kp.mjs → CodeInjector-BdjRfNx7.mjs} +5 -5
- package/dist/{ConsoleMonitor-CPVQW1Y-.mjs → ConsoleMonitor-DykL3IAw.mjs} +85 -17
- package/dist/{DetailedDataManager-BQQcxh64.mjs → DetailedDataManager-HT49OrvF.mjs} +1 -1
- package/dist/{ExtensionManager-CWYgw0YW.mjs → ExtensionManager-BDMsY2Dz.mjs} +15 -8
- package/dist/{HardwareBreakpoint-B9gZCdFP.mjs → HardwareBreakpoint-Cc2AFq1Y.mjs} +3 -3
- package/dist/{HeapAnalyzer-BLDH0dCv.mjs → HeapAnalyzer-DruMgsgj.mjs} +20 -20
- package/dist/{HookGeneratorBuilders.core.generators.storage-CtcdK78Q.mjs → HookGeneratorBuilders.core.generators.storage-CTbB4Lcx.mjs} +1 -74
- package/dist/{InstrumentationSession-CvPC7Jwy.mjs → InstrumentationSession-DLH0vd-z.mjs} +2 -2
- package/dist/{MemoryController-CbVdCIJF.mjs → MemoryController-CMtviNW_.mjs} +3 -3
- package/dist/{MemoryScanSession-BsDZbLYm.mjs → MemoryScanSession-ITgb_NMi.mjs} +2 -2
- package/dist/{MemoryScanner-Bcpml6II.mjs → MemoryScanner-CiL7Z3ey.mjs} +12 -9
- package/dist/{NativeMemoryManager.impl-dZtA1ZGn.mjs → NativeMemoryManager.impl-D9Lkovvn.mjs} +13 -10
- package/dist/{NativeMemoryManager.utils-B-FjA2mJ.mjs → NativeMemoryManager.utils-BBlAixF5.mjs} +1 -1
- package/dist/{PEAnalyzer-D1lzJ_VG.mjs → PEAnalyzer-DMQ44gen.mjs} +15 -15
- package/dist/{PageController-Bqm2kZ_X.mjs → PageController-BPJNqqBN.mjs} +18 -4
- package/dist/{PointerChainEngine-BOhyVsjx.mjs → PointerChainEngine-K7wN8Z-w.mjs} +10 -7
- package/dist/ProcessRegistry-zGg12QbE.mjs +74 -0
- package/dist/{ResponseBuilder-D3iFYx2N.mjs → ResponseBuilder-CJXWmWNw.mjs} +10 -10
- package/dist/{ScriptManager-aHHq0X7U.mjs → ScriptManager-ZuWD-0Jg.mjs} +195 -192
- package/dist/{Speedhack-CqdIFlQl.mjs → Speedhack-D-z0umeT.mjs} +2 -2
- package/dist/{StructureAnalyzer-DhFaPvRO.mjs → StructureAnalyzer-Cav5AVSL.mjs} +9 -6
- package/dist/{ToolCatalog-C0JGZoOm.mjs → ToolCatalog-5OJdMiF0.mjs} +81 -81
- package/dist/{ToolProbe-oC7aPrkv.mjs → ToolProbe-DbCFGyrg.mjs} +1 -1
- package/dist/{ToolRegistry-BjaF4oNz.mjs → ToolRegistry-B9krbTtI.mjs} +51 -2
- package/dist/{ToolRouter.policy-BWV67ZK-.mjs → ToolRouter.policy-BGDAGyeH.mjs} +60 -20
- package/dist/TraceRecorder-B41Z5XBj.mjs +1286 -0
- package/dist/{Win32API-CePkipZY.mjs → Win32API-C2kjj0ze.mjs} +18 -12
- package/dist/{Win32Debug-BvKs-gxc.mjs → Win32Debug-CKrGOTpo.mjs} +2 -2
- package/dist/{WorkflowEngine-CuvkZtWu.mjs → WorkflowEngine-DJ6M4opp.mjs} +226 -255
- package/dist/analysis-BHeJW2Nb.mjs +1234 -0
- package/dist/{antidebug-CqDTB_uk.mjs → antidebug-BRKeyt27.mjs} +3 -3
- package/dist/{artifactRetention-CFEprwPw.mjs → artifactRetention-CPXkUJXp.mjs} +13 -6
- package/dist/{artifacts-Bk2-_uPq.mjs → artifacts-DkfosXH3.mjs} +1 -1
- package/dist/authorization-schema-DRqyJMSk.mjs +31 -0
- package/dist/{binary-instrument-CXfpx6fT.mjs → binary-instrument--V3MAhJ4.mjs} +19 -27
- package/dist/bind-helpers-ClV34xdn.mjs +42 -0
- package/dist/{boringssl-inspector-BH2D3VKc.mjs → boringssl-inspector-Bo_LOLaS.mjs} +1 -1
- package/dist/{browser-BpOr5PEx.mjs → browser-Dx3_S2cG.mjs} +324 -37
- package/dist/capabilities-CcHlvWgK.mjs +33 -0
- package/dist/{constants-B0OANIBL.mjs → constants-CDZLOoVv.mjs} +18 -3
- package/dist/{coordination-qUbyF8KU.mjs → coordination-DgItD9DL.mjs} +2 -2
- package/dist/{debugger-gnKxRSN0.mjs → debugger-RS3RSAqs.mjs} +30 -13
- package/dist/definitions-BEoYofW5.mjs +47 -0
- package/dist/{definitions-bAhHQJq9.mjs → definitions-BRaefg3u.mjs} +11 -5
- package/dist/{definitions-DVGfrn7y.mjs → definitions-BbkvZkiv.mjs} +2 -2
- package/dist/definitions-BtWSHJ3o.mjs +17 -0
- package/dist/{definitions-BMfYXoNC.mjs → definitions-C1gCHO0i.mjs} +1 -1
- package/dist/{definitions-C1UvM5Iy.mjs → definitions-CDOg_b-l.mjs} +14 -2
- package/dist/definitions-CVPD9hzZ.mjs +54 -0
- package/dist/{definitions-Cke7zEb8.mjs → definitions-Cea8Lgl7.mjs} +1 -1
- package/dist/definitions-DAgIyjxM.mjs +10 -0
- package/dist/{definitions-B4rAvHNZ.mjs → definitions-DJA27nsL.mjs} +12 -9
- package/dist/{definitions-ClJLzsJQ.mjs → definitions-DKPFU3LW.mjs} +1 -1
- package/dist/{definitions-D3VsGcvz.mjs → definitions-DPRpZQ96.mjs} +7 -7
- package/dist/{definitions-B18eyf0B.mjs → definitions-DUE5gmdn.mjs} +1 -1
- package/dist/definitions-DYVjOtxa.mjs +26 -0
- package/dist/{definitions-BB_4jnmy.mjs → definitions-DcYLVLCo.mjs} +1 -1
- package/dist/{definitions-Beid2EB3.mjs → definitions-Pp5LI2H4.mjs} +1 -1
- package/dist/definitions-j9KdHVNR.mjs +14 -0
- package/dist/definitions-uzkjBwa7.mjs +258 -0
- package/dist/{definitions-Cq-zroAU.mjs → definitions-va-AnLuQ.mjs} +4 -4
- package/dist/{encoding-Bvz5jLRv.mjs → encoding-DJeqHmpd.mjs} +18 -4
- package/dist/{evidence-graph-bridge-C_fv9PuC.mjs → evidence-graph-bridge-DcYizFk2.mjs} +1 -0
- package/dist/{factory-DxlGh9Xf.mjs → factory-C90tBff6.mjs} +6 -6
- package/dist/flat-target-session-Dgax2Cy3.mjs +29 -0
- package/dist/{graphql-DYWzJ29s.mjs → graphql-CoHrhweh.mjs} +205 -34
- package/dist/{handlers-C67ktuRN.mjs → handlers-4jmR0nMs.mjs} +220 -32
- package/dist/{handlers-DlCJN4Td.mjs → handlers-BAHPxcch.mjs} +122 -90
- package/dist/{handlers-9sAbfIg-.mjs → handlers-BOs9b907.mjs} +849 -801
- package/dist/{handlers-DxGIq15_2.mjs → handlers-BWXEy6ef.mjs} +16 -16
- package/dist/{handlers-tB9Mp9ZK.mjs → handlers-Bndn6QvE.mjs} +31 -4
- package/dist/{handlers-CTsDAO6p.mjs → handlers-BqC4bD4s.mjs} +1 -1
- package/dist/{handlers-C87g8oCe.mjs → handlers-BtYq60bM2.mjs} +1 -1
- package/dist/{handlers-DeLOCd5m.mjs → handlers-BzgcB4iv.mjs} +17 -17
- package/dist/{handlers-Cgyg6c0U.mjs → handlers-CRyRWj2b.mjs} +237 -23
- package/dist/{handlers-U6L4xhuF.mjs → handlers-CVv2H1uq.mjs} +24 -17
- package/dist/{handlers-tiy7EIBp.mjs → handlers-Dl5a7JS4.mjs} +3 -3
- package/dist/{handlers-D6j6yka7.mjs → handlers-Dx2d7jt7.mjs} +1893 -1480
- package/dist/{handlers-Bl8zkwz1.mjs → handlers-Dz9PYsCa.mjs} +95 -6
- package/dist/handlers-HujRKC3b.mjs +661 -0
- package/dist/{handlers.impl-DS0d9fUw.mjs → handlers.impl-XWXkQfyi.mjs} +70 -24
- package/dist/{hooks-CzCWByww.mjs → hooks-B1B8NRHL.mjs} +3 -3
- package/dist/index.mjs +154 -144
- package/dist/{maintenance-P7ePRXQC.mjs → maintenance-PRMkLVRW.mjs} +35 -30
- package/dist/manifest-67Bok-Si.mjs +58 -0
- package/dist/{manifest-B3QVVeBS.mjs → manifest-6lNTMZAB2.mjs} +33 -28
- package/dist/manifest-B2duEHiH.mjs +90 -0
- package/dist/manifest-B6EY9Vm8.mjs +57 -0
- package/dist/{manifest-gZ4s_UtG.mjs → manifest-B6nKSbyY.mjs} +32 -33
- package/dist/{manifest-2ToTpjv8.mjs → manifest-BL8AQNPF.mjs} +31 -31
- package/dist/{manifest-DzwvxPJX.mjs → manifest-BSZvJJmV.mjs} +23 -14
- package/dist/{manifest-Sc_0JQ13.mjs → manifest-BU7qzUyX.mjs} +23 -23
- package/dist/{manifest-CT7zZBV1.mjs → manifest-Bl62e8WK.mjs} +24 -23
- package/dist/manifest-Bo5cXjdt.mjs +82 -0
- package/dist/manifest-BpS4gtUK.mjs +1347 -0
- package/dist/manifest-Bv65_e2W.mjs +101 -0
- package/dist/manifest-BytNIF4Z.mjs +117 -0
- package/dist/{manifest-BqrQ4Tpj.mjs → manifest-C-xtsjS3.mjs} +23 -23
- package/dist/{manifest-NXctwWQq.mjs → manifest-CDYl7OhA.mjs} +36 -38
- package/dist/manifest-CRZ3xmkD.mjs +61 -0
- package/dist/manifest-CoW6u4Tp.mjs +132 -0
- package/dist/manifest-Cq5zN_8A.mjs +50 -0
- package/dist/{manifest-CAhOuvSl.mjs → manifest-D7YZM_2e.mjs} +75 -85
- package/dist/{manifest-DCyjf4n2.mjs → manifest-DE_VrAeQ.mjs} +27 -7
- package/dist/manifest-DGsXSCpT.mjs +39 -0
- package/dist/{manifest-BB2J8IMJ.mjs → manifest-DJ2vfEuW.mjs} +48 -41
- package/dist/{manifest-3g71z6Bg.mjs → manifest-DPXDYhEu.mjs} +26 -25
- package/dist/manifest-Dd4fQb0a.mjs +322 -0
- package/dist/{manifest-CXsRWjjI.mjs → manifest-Deq6opGg.mjs} +95 -96
- package/dist/{manifest-C9RT5nk32.mjs → manifest-DfJTafJK.mjs} +14 -11
- package/dist/manifest-DgOdgN_j.mjs +50 -0
- package/dist/{manifest-BmtZzQiQ2.mjs → manifest-DlbMW4v4.mjs} +17 -15
- package/dist/{manifest-DrbmZcFl2.mjs → manifest-DmVfbH0w.mjs} +212 -91
- package/dist/manifest-Dog6Ddjr.mjs +109 -0
- package/dist/manifest-DvgU5FWb.mjs +58 -0
- package/dist/manifest-HsfDBs7j.mjs +50 -0
- package/dist/manifest-I8oQHvCG.mjs +186 -0
- package/dist/manifest-NvH_a-av.mjs +786 -0
- package/dist/{manifest-Dh8WBmEW.mjs → manifest-cEJU1v0Z.mjs} +24 -24
- package/dist/manifest-wOl5XLB12.mjs +112 -0
- package/dist/{modules-C184v-S9.mjs → modules-tZozf0LQ.mjs} +130 -860
- package/dist/{mojo-ipc-B_H61Afw.mjs → mojo-ipc-DXNEXEqb.mjs} +141 -26
- package/dist/{network-671Cw6hV.mjs → network-CPVvwvFg.mjs} +1329 -823
- package/dist/{outputPaths-B1uGmrWZ.mjs → outputPaths-um7lCRY3.mjs} +4 -8
- package/dist/{platform-WmNn8Sxb.mjs → platform-CYeFoTWp.mjs} +101 -10
- package/dist/{process-QcbIy5Zq.mjs → process-BTbgcVc6.mjs} +251 -346
- package/dist/{proxy-DqNs0bAd.mjs → proxy-r8YN6nP1.mjs} +30 -8
- package/dist/{registry-D-6e18lB.mjs → registry-Bl8ZQW61.mjs} +3 -3
- package/dist/{response-BQVP-xUn.mjs → response-CWhh2aLo.mjs} +7 -1
- package/dist/{shared-state-board-DV-dpHFJ.mjs → shared-state-board-BoZnSoj-.mjs} +2 -2
- package/dist/{sourcemap-Dq8ez8vS.mjs → sourcemap-BIDHUVXy.mjs} +350 -66
- package/dist/{streaming-BUQ0VJsg.mjs → streaming-Dal6utPp.mjs} +13 -13
- package/dist/{tool-builder-DCbIC5Eo.mjs → tool-builder-BHJp32mV.mjs} +1 -1
- package/dist/{transform-CiYJfNX0.mjs → transform-DRVgGG90.mjs} +18 -14
- package/dist/wasm-BYx5UOeG.mjs +1044 -0
- package/dist/webcrack-Be0_FccV.mjs +747 -0
- package/dist/{workflow-f3xJOcjx.mjs → workflow-BpuKEtvn.mjs} +8 -8
- package/package.json +76 -43
- package/dist/TraceRecorder-DgxyVbdQ.mjs +0 -519
- package/dist/analysis-CL9uACt9.mjs +0 -463
- package/dist/bind-helpers-xFfRF-qm.mjs +0 -22
- package/dist/definitions-6M-eejaT.mjs +0 -53
- package/dist/definitions-B3QdlrHv.mjs +0 -34
- package/dist/definitions-CXEI7QC72.mjs +0 -216
- package/dist/definitions-C_4r7Fo-2.mjs +0 -14
- package/dist/definitions-CkFDALoa.mjs +0 -26
- package/dist/definitions-Cy3Sl6gV.mjs +0 -34
- package/dist/definitions-LKpC3-nL.mjs +0 -9
- package/dist/handlers-DdFzXLvF.mjs +0 -446
- package/dist/manifest-82baTv4U.mjs +0 -45
- package/dist/manifest-BKbgbSiY.mjs +0 -60
- package/dist/manifest-Bcf-TJzH.mjs +0 -848
- package/dist/manifest-Bnd7kqEY.mjs +0 -55
- package/dist/manifest-BqQX6OQC2.mjs +0 -65
- package/dist/manifest-Br4RPFt5.mjs +0 -370
- package/dist/manifest-C5qDjysN.mjs +0 -107
- package/dist/manifest-CBYWCUBJ.mjs +0 -51
- package/dist/manifest-CFADCRa1.mjs +0 -37
- package/dist/manifest-CQVhavRF.mjs +0 -114
- package/dist/manifest-CV12bcrF.mjs +0 -121
- package/dist/manifest-CZLUCfG02.mjs +0 -95
- package/dist/manifest-D6phHKFd.mjs +0 -131
- package/dist/manifest-DHsnKgP6.mjs +0 -60
- package/dist/manifest-Df_dliIe.mjs +0 -55
- package/dist/manifest-DhKRAT8_.mjs +0 -92
- package/dist/manifest-DlpTj4ic2.mjs +0 -193
- package/dist/manifest-DuwHjUa5.mjs +0 -70
- package/dist/manifest-qSleDqdO.mjs +0 -1023
- package/dist/wasm-DQTnHDs4.mjs +0 -531
- /package/dist/{CacheAdapters-CDe5WPSV.mjs → CacheAdapters-jJFy20G-.mjs} +0 -0
- /package/dist/{DarwinAPI-BNPxu0RH.mjs → DarwinAPI-ETyy0xyo.mjs} +0 -0
- /package/dist/{EventBus-DgPmwpeu.mjs → EventBus-DFKvADm3.mjs} +0 -0
- /package/dist/{EvidenceGraphBridge-SFesNera.mjs → EvidenceGraphBridge-318Oi0Lf.mjs} +0 -0
- /package/dist/{FingerprintManager-gzWtkKuf.mjs → FingerprintManager-BN4UQWnX.mjs} +0 -0
- /package/dist/{PrerequisiteError-Dl33Svkz.mjs → PrerequisiteError-TuyZIs6n.mjs} +0 -0
- /package/dist/{ReverseEvidenceGraph-Dlsk94LC.mjs → ReverseEvidenceGraph-C02-gXOh.mjs} +0 -0
- /package/dist/{StealthVerifier-Bo4T3bz8.mjs → StealthVerifier-BWmPgQsv.mjs} +0 -0
- /package/dist/{VersionDetector-CwVLVdDM.mjs → VersionDetector-K3V4vGsw.mjs} +0 -0
- /package/dist/{betterSqlite3-0pqusHHH.mjs → betterSqlite3-DLSBZodi.mjs} +0 -0
- /package/dist/{concurrency-Bt0yv1kJ.mjs → concurrency-Drev_Vz9.mjs} +0 -0
- /package/dist/{formatAddress-DVkj9kpI.mjs → formatAddress-nnMvEohD.mjs} +0 -0
- /package/dist/{parse-args-BlRjqlkL.mjs → parse-args-B4cY5Vx5.mjs} +0 -0
- /package/dist/{ssrf-policy-ZaUfvhq7.mjs → ssrf-policy-Dsqd-DTX.mjs} +0 -0
- /package/dist/{types-CPhOReNX.mjs → types-DDBWs9UP.mjs} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as logger } from "./logger-Dh_xb7_2.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { b as openProcessForMemory, d as ReadProcessMemory, t as CloseHandle } from "./Win32API-
|
|
4
|
-
import { m as TH32CS } from "./Win32Debug-
|
|
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
5
|
import koffi from "koffi";
|
|
6
6
|
//#region src/native/HeapAnalyzer.types.ts
|
|
7
7
|
/** Heap block flags */
|
|
@@ -25,7 +25,7 @@ const HF32 = {
|
|
|
25
25
|
*
|
|
26
26
|
* @module HeapAnalyzer
|
|
27
27
|
*/
|
|
28
|
-
let
|
|
28
|
+
let heapApisCache = null;
|
|
29
29
|
function loadHeapApis() {
|
|
30
30
|
const k32 = koffi.load("kernel32.dll");
|
|
31
31
|
return {
|
|
@@ -44,8 +44,8 @@ function loadHeapApis() {
|
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
46
|
function getHeapApis() {
|
|
47
|
-
if (!
|
|
48
|
-
return
|
|
47
|
+
if (!heapApisCache) heapApisCache = loadHeapApis();
|
|
48
|
+
return heapApisCache;
|
|
49
49
|
}
|
|
50
50
|
const SIZE_RANGES = [
|
|
51
51
|
[
|
|
@@ -113,7 +113,7 @@ var HeapAnalyzer = class {
|
|
|
113
113
|
const processId = hlBuf.readUInt32LE(8);
|
|
114
114
|
const heapId = hlBuf.readBigUInt64LE(12);
|
|
115
115
|
const flags = hlBuf.readUInt32LE(20);
|
|
116
|
-
const blocks = await this.
|
|
116
|
+
const blocks = await this.enumerateBlocksInternal(pid, heapId, HEAP_ENUMERATE_MAX_BLOCKS);
|
|
117
117
|
heaps.push({
|
|
118
118
|
heapId: `0x${heapId.toString(16)}`,
|
|
119
119
|
processId,
|
|
@@ -130,7 +130,7 @@ var HeapAnalyzer = class {
|
|
|
130
130
|
}
|
|
131
131
|
return {
|
|
132
132
|
heaps,
|
|
133
|
-
stats: this.
|
|
133
|
+
stats: this.computeStats(heaps, [])
|
|
134
134
|
};
|
|
135
135
|
}
|
|
136
136
|
/**
|
|
@@ -139,7 +139,7 @@ var HeapAnalyzer = class {
|
|
|
139
139
|
async enumerateBlocks(pid, heapId, options) {
|
|
140
140
|
const id = BigInt(heapId);
|
|
141
141
|
const max = options?.maxBlocks ?? HEAP_ENUMERATE_MAX_BLOCKS;
|
|
142
|
-
return this.
|
|
142
|
+
return this.enumerateBlocksInternal(pid, id, max);
|
|
143
143
|
}
|
|
144
144
|
/**
|
|
145
145
|
* Get full statistical breakdown for all heaps.
|
|
@@ -148,10 +148,10 @@ var HeapAnalyzer = class {
|
|
|
148
148
|
const { heaps } = await this.enumerateHeaps(pid);
|
|
149
149
|
const allBlocks = [];
|
|
150
150
|
for (const heap of heaps) {
|
|
151
|
-
const blocks = await this.
|
|
151
|
+
const blocks = await this.enumerateBlocksInternal(pid, BigInt(heap.heapId), HEAP_ENUMERATE_MAX_BLOCKS);
|
|
152
152
|
allBlocks.push(...blocks);
|
|
153
153
|
}
|
|
154
|
-
return this.
|
|
154
|
+
return this.computeStats(heaps, allBlocks);
|
|
155
155
|
}
|
|
156
156
|
/**
|
|
157
157
|
* Detect heap anomalies: spray, UAF heuristic, suspicious sizes.
|
|
@@ -160,14 +160,14 @@ var HeapAnalyzer = class {
|
|
|
160
160
|
const anomalies = [];
|
|
161
161
|
const { heaps } = await this.enumerateHeaps(pid);
|
|
162
162
|
for (const heap of heaps) {
|
|
163
|
-
const blocks = await this.
|
|
164
|
-
this.
|
|
165
|
-
this.
|
|
166
|
-
await this.
|
|
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
167
|
}
|
|
168
168
|
return anomalies;
|
|
169
169
|
}
|
|
170
|
-
async
|
|
170
|
+
async enumerateBlocksInternal(pid, heapId, maxBlocks) {
|
|
171
171
|
const apis = getHeapApis();
|
|
172
172
|
const blocks = [];
|
|
173
173
|
const heBuf = Buffer.alloc(apis.HEAPENTRY32_SIZE);
|
|
@@ -189,7 +189,7 @@ var HeapAnalyzer = class {
|
|
|
189
189
|
}
|
|
190
190
|
return blocks;
|
|
191
191
|
}
|
|
192
|
-
|
|
192
|
+
computeStats(heaps, blocks) {
|
|
193
193
|
const buckets = SIZE_RANGES.map(([range]) => ({
|
|
194
194
|
range,
|
|
195
195
|
count: 0,
|
|
@@ -223,7 +223,7 @@ var HeapAnalyzer = class {
|
|
|
223
223
|
fragmentationRatio: totalSize > 0 ? freeSize / totalSize : 0
|
|
224
224
|
};
|
|
225
225
|
}
|
|
226
|
-
|
|
226
|
+
detectSpray(blocks, heapId, anomalies) {
|
|
227
227
|
const sizeGroups = /* @__PURE__ */ new Map();
|
|
228
228
|
for (const block of blocks) {
|
|
229
229
|
if (block.isFree) continue;
|
|
@@ -240,7 +240,7 @@ var HeapAnalyzer = class {
|
|
|
240
240
|
heapId
|
|
241
241
|
});
|
|
242
242
|
}
|
|
243
|
-
|
|
243
|
+
detectSuspiciousSizes(blocks, heapId, anomalies) {
|
|
244
244
|
for (const block of blocks) if (block.size === 0) anomalies.push({
|
|
245
245
|
type: "suspicious_size",
|
|
246
246
|
severity: "medium",
|
|
@@ -256,7 +256,7 @@ var HeapAnalyzer = class {
|
|
|
256
256
|
heapId
|
|
257
257
|
});
|
|
258
258
|
}
|
|
259
|
-
async
|
|
259
|
+
async detectPossibleUaf(pid, blocks, heapId, anomalies) {
|
|
260
260
|
const sampled = blocks.filter((b) => b.isFree && b.size >= 8).slice(0, 100);
|
|
261
261
|
let hProcess = null;
|
|
262
262
|
try {
|
|
@@ -1,76 +1,3 @@
|
|
|
1
|
-
import { t as logger } from "./logger-Dh_xb7_2.mjs";
|
|
2
|
-
import { W as EXTERNAL_TOOL_FORCE_KILL_GRACE_MS } from "./constants-B0OANIBL.mjs";
|
|
3
|
-
//#region src/utils/ProcessRegistry.ts
|
|
4
|
-
/**
|
|
5
|
-
* Global singleton registry to track and safely terminate orphaned child
|
|
6
|
-
* processes and worker threads upon server shutdown.
|
|
7
|
-
*/
|
|
8
|
-
var ProcessRegistrySingleton = class {
|
|
9
|
-
processes = /* @__PURE__ */ new Set();
|
|
10
|
-
/**
|
|
11
|
-
* Register a ChildProcess or Worker for automatic cleanup on shutdown.
|
|
12
|
-
*/
|
|
13
|
-
register(proc) {
|
|
14
|
-
if (!proc) return;
|
|
15
|
-
this.processes.add(proc);
|
|
16
|
-
if ("kill" in proc) proc.once("close", () => this.unregister(proc));
|
|
17
|
-
else if ("terminate" in proc) {
|
|
18
|
-
if (typeof proc.once === "function") proc.once("exit", () => this.unregister(proc));
|
|
19
|
-
else if (typeof proc.on === "function") proc.on("exit", () => this.unregister(proc));
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Unregister a process/worker.
|
|
24
|
-
*/
|
|
25
|
-
unregister(proc) {
|
|
26
|
-
if (!proc) return;
|
|
27
|
-
this.processes.delete(proc);
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Terminate all tracked processes and workers.
|
|
31
|
-
* Sends SIGTERM, then after a grace period sends SIGKILL.
|
|
32
|
-
*/
|
|
33
|
-
async terminateAll() {
|
|
34
|
-
if (this.processes.size === 0) return;
|
|
35
|
-
logger.debug(`[ProcessRegistry] Attempting to terminate ${this.processes.size} active processes/workers...`);
|
|
36
|
-
const terminationPromises = [];
|
|
37
|
-
for (const proc of this.processes) if ("terminate" in proc) terminationPromises.push(proc.terminate().then(() => {
|
|
38
|
-
this.processes.delete(proc);
|
|
39
|
-
}).catch((err) => {
|
|
40
|
-
logger.warn(`[ProcessRegistry] Error terminating worker: ${err.message}`);
|
|
41
|
-
}));
|
|
42
|
-
else if ("kill" in proc) terminationPromises.push(new Promise((resolve) => {
|
|
43
|
-
if (proc.killed || proc.exitCode !== null || proc.signalCode !== null) {
|
|
44
|
-
this.processes.delete(proc);
|
|
45
|
-
return resolve();
|
|
46
|
-
}
|
|
47
|
-
proc.kill("SIGTERM");
|
|
48
|
-
let settled = false;
|
|
49
|
-
const handleExit = () => {
|
|
50
|
-
if (settled) return;
|
|
51
|
-
settled = true;
|
|
52
|
-
this.processes.delete(proc);
|
|
53
|
-
resolve();
|
|
54
|
-
};
|
|
55
|
-
proc.once("exit", handleExit);
|
|
56
|
-
proc.once("close", handleExit);
|
|
57
|
-
setTimeout(() => {
|
|
58
|
-
if (!settled && !proc.killed && proc.exitCode === null) {
|
|
59
|
-
logger.debug(`[ProcessRegistry] Force killing child process PID ${proc.pid}`);
|
|
60
|
-
try {
|
|
61
|
-
proc.kill("SIGKILL");
|
|
62
|
-
} catch {}
|
|
63
|
-
handleExit();
|
|
64
|
-
}
|
|
65
|
-
}, EXTERNAL_TOOL_FORCE_KILL_GRACE_MS).unref();
|
|
66
|
-
}));
|
|
67
|
-
await Promise.race([Promise.all(terminationPromises), new Promise((resolve) => setTimeout(resolve, EXTERNAL_TOOL_FORCE_KILL_GRACE_MS + 1e3).unref())]);
|
|
68
|
-
this.processes.clear();
|
|
69
|
-
logger.debug(`[ProcessRegistry] Termination sweep complete.`);
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
const ProcessRegistry = new ProcessRegistrySingleton();
|
|
73
|
-
//#endregion
|
|
74
1
|
//#region src/modules/hook/HookGeneratorBuilders.core.generators.runtime.ts
|
|
75
2
|
function generateFunctionHook(target, action, customCode, condition, performance = false) {
|
|
76
3
|
return `
|
|
@@ -636,4 +563,4 @@ function getInjectionInstructions(type) {
|
|
|
636
563
|
return `This hook script monitors ${type} operations. Inject it into the target page via page_evaluate or console_execute to activate.`;
|
|
637
564
|
}
|
|
638
565
|
//#endregion
|
|
639
|
-
export { generateEvalHook as a, generateObjectMethodHook as c, generateAntiDebugBypass as i,
|
|
566
|
+
export { generateEvalHook as a, generateObjectMethodHook as c, generateAntiDebugBypass as i, generateLocalStorageHook as n, generateFunctionHook as o, getInjectionInstructions as r, generateHookTemplate as s, generateCookieHook as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
//#region src/server/instrumentation/InstrumentationSession.ts
|
|
2
|
-
let
|
|
2
|
+
let nextId = 0;
|
|
3
3
|
function uid(prefix) {
|
|
4
|
-
return `${prefix}-${Date.now().toString(36)}-${(++
|
|
4
|
+
return `${prefix}-${Date.now().toString(36)}-${(++nextId).toString(36)}`;
|
|
5
5
|
}
|
|
6
6
|
function isRecord(value) {
|
|
7
7
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { _ as WriteProcessMemory, b as openProcessForMemory, d as ReadProcessMemory, m as VirtualProtectEx, t as CloseHandle, u as PAGE } from "./Win32API-
|
|
3
|
-
import { i as parsePattern } from "./NativeMemoryManager.utils-
|
|
1
|
+
import { Vr as WRITE_HISTORY_MAX, Z as FREEZE_DEFAULT_INTERVAL_MS } from "./constants-CDZLOoVv.mjs";
|
|
2
|
+
import { _ as WriteProcessMemory, b as openProcessForMemory, d as ReadProcessMemory, m as VirtualProtectEx, t as CloseHandle, u as PAGE } from "./Win32API-C2kjj0ze.mjs";
|
|
3
|
+
import { i as parsePattern } from "./NativeMemoryManager.utils-BBlAixF5.mjs";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
5
|
//#region src/native/MemoryController.ts
|
|
6
6
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as parseAddress, t as formatAddress } from "./formatAddress-
|
|
1
|
+
import { Sn as SCAN_SESSION_TTL_MS, xn as SCAN_SESSION_MAX_COUNT } from "./constants-CDZLOoVv.mjs";
|
|
2
|
+
import { n as parseAddress, t as formatAddress } from "./formatAddress-nnMvEohD.mjs";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
4
|
//#region src/native/ScanComparators.ts
|
|
5
5
|
const FLOAT_EPSILON = 1e-6;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as createPlatformProvider } from "./factory-
|
|
3
|
-
import { i as parsePattern } from "./NativeMemoryManager.utils-
|
|
4
|
-
import { t as nativeMemoryManager } from "./NativeMemoryManager.impl-
|
|
5
|
-
import { n as parseAddress, t as formatAddress } from "./formatAddress-
|
|
6
|
-
import { n as getDefaultAlignment, r as getValueSize, scanSessionManager, t as compareScanValues } from "./MemoryScanSession-
|
|
1
|
+
import { Cn as SCAN_UNKNOWN_INITIAL_MAX_ADDRESSES, _n as SCAN_DISPLAY_RESULTS_LIMIT, bn as SCAN_POINTER_MAX_RESULTS, vn as SCAN_GROUP_MAX_PATTERN_SIZE, yn as SCAN_MAX_RESULTS_PER_SCAN } from "./constants-CDZLOoVv.mjs";
|
|
2
|
+
import { t as createPlatformProvider } from "./factory-C90tBff6.mjs";
|
|
3
|
+
import { i as parsePattern } from "./NativeMemoryManager.utils-BBlAixF5.mjs";
|
|
4
|
+
import { t as nativeMemoryManager } from "./NativeMemoryManager.impl-D9Lkovvn.mjs";
|
|
5
|
+
import { n as parseAddress, t as formatAddress } from "./formatAddress-nnMvEohD.mjs";
|
|
6
|
+
import { n as getDefaultAlignment, r as getValueSize, scanSessionManager, t as compareScanValues } from "./MemoryScanSession-ITgb_NMi.mjs";
|
|
7
7
|
//#region src/native/MemoryScanner.ts
|
|
8
8
|
/**
|
|
9
9
|
* Memory Scanner — orchestrates iterative scan workflows.
|
|
@@ -21,10 +21,13 @@ import { n as getDefaultAlignment, r as getValueSize, scanSessionManager, t as c
|
|
|
21
21
|
*/
|
|
22
22
|
var MemoryScanner = class {
|
|
23
23
|
nmm;
|
|
24
|
-
|
|
24
|
+
providerCache = null;
|
|
25
25
|
get provider() {
|
|
26
|
-
if (!this.
|
|
27
|
-
return this.
|
|
26
|
+
if (!this.providerCache) this.providerCache = createPlatformProvider();
|
|
27
|
+
return this.providerCache;
|
|
28
|
+
}
|
|
29
|
+
set provider(value) {
|
|
30
|
+
this.providerCache = value;
|
|
28
31
|
}
|
|
29
32
|
constructor(nmm) {
|
|
30
33
|
this.nmm = nmm;
|
package/dist/{NativeMemoryManager.impl-dZtA1ZGn.mjs → NativeMemoryManager.impl-D9Lkovvn.mjs}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as logger } from "./logger-Dh_xb7_2.mjs";
|
|
2
|
-
import { v as isKoffiAvailable, y as isWindows } from "./Win32API-
|
|
3
|
-
import { n as cpuLimit } from "./concurrency-
|
|
4
|
-
import { t as createPlatformProvider } from "./factory-
|
|
5
|
-
import { i as parsePattern, t as findPatternInBuffer } from "./NativeMemoryManager.utils-
|
|
2
|
+
import { v as isKoffiAvailable, y as isWindows } from "./Win32API-C2kjj0ze.mjs";
|
|
3
|
+
import { n as cpuLimit } from "./concurrency-Drev_Vz9.mjs";
|
|
4
|
+
import { t as createPlatformProvider } from "./factory-C90tBff6.mjs";
|
|
5
|
+
import { i as parsePattern, t as findPatternInBuffer } from "./NativeMemoryManager.utils-BBlAixF5.mjs";
|
|
6
6
|
import { exec } from "node:child_process";
|
|
7
7
|
import { promisify } from "node:util";
|
|
8
8
|
//#region src/native/NativeMemoryManager.availability.ts
|
|
@@ -96,11 +96,14 @@ function scanRegionInChunks(region, patternBytes, mask, readChunk, chunkSize = S
|
|
|
96
96
|
* Win32-only methods (injection, debug) are guarded by platform checks.
|
|
97
97
|
*/
|
|
98
98
|
var NativeMemoryManager = class {
|
|
99
|
-
|
|
99
|
+
providerCache = null;
|
|
100
100
|
/** Lazily create the platform memory provider */
|
|
101
101
|
get provider() {
|
|
102
|
-
if (!this.
|
|
103
|
-
return this.
|
|
102
|
+
if (!this.providerCache) this.providerCache = createPlatformProvider();
|
|
103
|
+
return this.providerCache;
|
|
104
|
+
}
|
|
105
|
+
set provider(value) {
|
|
106
|
+
this.providerCache = value;
|
|
104
107
|
}
|
|
105
108
|
async checkAvailability() {
|
|
106
109
|
return checkNativeMemoryAvailability(execAsync);
|
|
@@ -324,7 +327,7 @@ var NativeMemoryManager = class {
|
|
|
324
327
|
error: "DLL injection is only supported on Windows"
|
|
325
328
|
};
|
|
326
329
|
try {
|
|
327
|
-
const { openProcessForMemory, CloseHandle, WriteProcessMemory, VirtualAllocEx, CreateRemoteThread, GetModuleHandle, GetProcAddress, PAGE, MEM } = await import("./Win32API-
|
|
330
|
+
const { openProcessForMemory, CloseHandle, WriteProcessMemory, VirtualAllocEx, CreateRemoteThread, GetModuleHandle, GetProcAddress, PAGE, MEM } = await import("./Win32API-C2kjj0ze.mjs").then((n) => n.g);
|
|
328
331
|
const handle = openProcessForMemory(pid, true);
|
|
329
332
|
try {
|
|
330
333
|
const loadLibraryAddr = GetProcAddress(GetModuleHandle("kernel32.dll"), "LoadLibraryA");
|
|
@@ -374,7 +377,7 @@ var NativeMemoryManager = class {
|
|
|
374
377
|
let buffer;
|
|
375
378
|
if (encoding === "base64") buffer = Buffer.from(shellcode, "base64");
|
|
376
379
|
else buffer = Buffer.from(shellcode.replace(/\s/g, ""), "hex");
|
|
377
|
-
const { openProcessForMemory, CloseHandle, WriteProcessMemory, VirtualAllocEx, VirtualProtectEx, CreateRemoteThread, PAGE, MEM } = await import("./Win32API-
|
|
380
|
+
const { openProcessForMemory, CloseHandle, WriteProcessMemory, VirtualAllocEx, VirtualProtectEx, CreateRemoteThread, PAGE, MEM } = await import("./Win32API-C2kjj0ze.mjs").then((n) => n.g);
|
|
378
381
|
const handle = openProcessForMemory(pid, true);
|
|
379
382
|
try {
|
|
380
383
|
const remoteMem = VirtualAllocEx(handle, 0n, buffer.length, MEM.COMMIT | MEM.RESERVE, PAGE.READWRITE);
|
|
@@ -421,7 +424,7 @@ var NativeMemoryManager = class {
|
|
|
421
424
|
error: "Debug port check is only supported on Windows"
|
|
422
425
|
};
|
|
423
426
|
try {
|
|
424
|
-
const { openProcessForMemory, CloseHandle, NtQueryInformationProcess } = await import("./Win32API-
|
|
427
|
+
const { openProcessForMemory, CloseHandle, NtQueryInformationProcess } = await import("./Win32API-C2kjj0ze.mjs").then((n) => n.g);
|
|
425
428
|
const handle = openProcessForMemory(pid, false);
|
|
426
429
|
try {
|
|
427
430
|
const { status, debugPort } = NtQueryInformationProcess(handle, 7);
|
package/dist/{NativeMemoryManager.utils-B-FjA2mJ.mjs → NativeMemoryManager.utils-BBlAixF5.mjs}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { u as PAGE, v as isKoffiAvailable$1 } from "./Win32API-
|
|
1
|
+
import { u as PAGE, v as isKoffiAvailable$1 } from "./Win32API-C2kjj0ze.mjs";
|
|
2
2
|
//#region src/native/NativeMemoryManager.utils.ts
|
|
3
3
|
function isKoffiAvailable() {
|
|
4
4
|
return isKoffiAvailable$1();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as logger } from "./logger-Dh_xb7_2.mjs";
|
|
2
|
-
import { a as GetModuleFileNameEx, b as openProcessForMemory, d as ReadProcessMemory, i as GetModuleBaseName, n as EnumProcessModules, s as GetModuleInformation, t as CloseHandle } from "./Win32API-
|
|
2
|
+
import { a as GetModuleFileNameEx, b as openProcessForMemory, d as ReadProcessMemory, i as GetModuleBaseName, n as EnumProcessModules, s as GetModuleInformation, t as CloseHandle } from "./Win32API-C2kjj0ze.mjs";
|
|
3
3
|
import { promises } from "node:fs";
|
|
4
4
|
//#region src/native/PEAnalyzer.types.ts
|
|
5
5
|
/** PE section characteristic flags */
|
|
@@ -104,7 +104,7 @@ var PEAnalyzer = class {
|
|
|
104
104
|
const base = BigInt(moduleBase);
|
|
105
105
|
const hProcess = openProcessForMemory(pid);
|
|
106
106
|
try {
|
|
107
|
-
const headers = await this.
|
|
107
|
+
const headers = await this.readCoreHeaders(hProcess, base);
|
|
108
108
|
const sections = [];
|
|
109
109
|
for (let i = 0; i < headers.numSections; i++) {
|
|
110
110
|
const off = headers.firstSectionOffset + i * SECTION_HEADER_SIZE;
|
|
@@ -138,7 +138,7 @@ var PEAnalyzer = class {
|
|
|
138
138
|
const base = BigInt(moduleBase);
|
|
139
139
|
const hProcess = openProcessForMemory(pid);
|
|
140
140
|
try {
|
|
141
|
-
const headers = await this.
|
|
141
|
+
const headers = await this.readCoreHeaders(hProcess, base);
|
|
142
142
|
const importRva = headers.dataDirectories[IMAGE_DIRECTORY_ENTRY.IMPORT];
|
|
143
143
|
if (!importRva || importRva.rva === 0) return [];
|
|
144
144
|
const imports = [];
|
|
@@ -151,7 +151,7 @@ var PEAnalyzer = class {
|
|
|
151
151
|
const nullIdx = nameData.indexOf(0);
|
|
152
152
|
const dllName = nameData.subarray(0, nullIdx > 0 ? nullIdx : 256).toString("ascii");
|
|
153
153
|
const originalFirstThunkRva = desc.readUInt32LE(0) || desc.readUInt32LE(16);
|
|
154
|
-
const functions = this.
|
|
154
|
+
const functions = this.readThunkArray(hProcess, base, originalFirstThunkRva, headers.isPE32Plus);
|
|
155
155
|
imports.push({
|
|
156
156
|
dllName,
|
|
157
157
|
functions
|
|
@@ -170,7 +170,7 @@ var PEAnalyzer = class {
|
|
|
170
170
|
const base = BigInt(moduleBase);
|
|
171
171
|
const hProcess = openProcessForMemory(pid);
|
|
172
172
|
try {
|
|
173
|
-
const exportDir = (await this.
|
|
173
|
+
const exportDir = (await this.readCoreHeaders(hProcess, base)).dataDirectories[IMAGE_DIRECTORY_ENTRY.EXPORT];
|
|
174
174
|
if (!exportDir || exportDir.rva === 0) return [];
|
|
175
175
|
const expData = ReadProcessMemory(hProcess, base + BigInt(exportDir.rva), 40);
|
|
176
176
|
const numberOfNames = expData.readUInt32LE(24);
|
|
@@ -213,7 +213,7 @@ var PEAnalyzer = class {
|
|
|
213
213
|
const hProcess = openProcessForMemory(pid);
|
|
214
214
|
const detections = [];
|
|
215
215
|
try {
|
|
216
|
-
const modules = this.
|
|
216
|
+
const modules = this.enumerateModulesInternal(hProcess);
|
|
217
217
|
const targets = moduleName ? modules.filter((m) => m.name.toLowerCase().includes(moduleName.toLowerCase())) : modules;
|
|
218
218
|
for (const mod of targets) try {
|
|
219
219
|
const diskData = await promises.readFile(mod.path);
|
|
@@ -222,12 +222,12 @@ var PEAnalyzer = class {
|
|
|
222
222
|
const funcRva = parseInt(exp.rva, 16);
|
|
223
223
|
if (funcRva === 0 || exp.forwardedTo) continue;
|
|
224
224
|
const memBytes = ReadProcessMemory(hProcess, BigInt(mod.base) + BigInt(funcRva), COMPARE_BYTES);
|
|
225
|
-
const diskOffset = this.
|
|
225
|
+
const diskOffset = this.rvaToFileOffset(diskData, funcRva);
|
|
226
226
|
if (diskOffset < 0 || diskOffset + COMPARE_BYTES > diskData.length) continue;
|
|
227
227
|
const diskBytes = diskData.subarray(diskOffset, diskOffset + COMPARE_BYTES);
|
|
228
228
|
if (!memBytes.equals(diskBytes)) {
|
|
229
|
-
const hookType = this.
|
|
230
|
-
const jumpTarget = this.
|
|
229
|
+
const hookType = this.classifyHook(memBytes);
|
|
230
|
+
const jumpTarget = this.decodeJumpTarget(memBytes, BigInt(mod.base) + BigInt(funcRva));
|
|
231
231
|
detections.push({
|
|
232
232
|
address: `0x${(BigInt(mod.base) + BigInt(funcRva)).toString(16)}`,
|
|
233
233
|
moduleName: mod.name,
|
|
@@ -273,7 +273,7 @@ var PEAnalyzer = class {
|
|
|
273
273
|
});
|
|
274
274
|
return anomalies;
|
|
275
275
|
}
|
|
276
|
-
async
|
|
276
|
+
async readCoreHeaders(hProcess, base) {
|
|
277
277
|
const e_lfanew = ReadProcessMemory(hProcess, base, 64).readUInt32LE(60);
|
|
278
278
|
const ntData = ReadProcessMemory(hProcess, base + BigInt(e_lfanew), 264);
|
|
279
279
|
const numSections = ntData.readUInt16LE(6);
|
|
@@ -296,7 +296,7 @@ var PEAnalyzer = class {
|
|
|
296
296
|
dataDirectories
|
|
297
297
|
};
|
|
298
298
|
}
|
|
299
|
-
|
|
299
|
+
readThunkArray(hProcess, base, thunkRva, isPE32Plus) {
|
|
300
300
|
const thunkSize = isPE32Plus ? 8 : 4;
|
|
301
301
|
const functions = [];
|
|
302
302
|
const IMAGE_ORDINAL_FLAG = isPE32Plus ? 9223372036854775808n : 2147483648n;
|
|
@@ -326,7 +326,7 @@ var PEAnalyzer = class {
|
|
|
326
326
|
}
|
|
327
327
|
return functions;
|
|
328
328
|
}
|
|
329
|
-
|
|
329
|
+
enumerateModulesInternal(hProcess) {
|
|
330
330
|
const modules = [];
|
|
331
331
|
try {
|
|
332
332
|
const { modules: modHandles, count } = EnumProcessModules(hProcess);
|
|
@@ -347,7 +347,7 @@ var PEAnalyzer = class {
|
|
|
347
347
|
}
|
|
348
348
|
return modules;
|
|
349
349
|
}
|
|
350
|
-
|
|
350
|
+
rvaToFileOffset(peData, rva) {
|
|
351
351
|
const e_lfanew = peData.readUInt32LE(60);
|
|
352
352
|
const numSections = peData.readUInt16LE(e_lfanew + 6);
|
|
353
353
|
const sizeOfOptionalHeader = peData.readUInt16LE(e_lfanew + 20);
|
|
@@ -362,13 +362,13 @@ var PEAnalyzer = class {
|
|
|
362
362
|
}
|
|
363
363
|
return -1;
|
|
364
364
|
}
|
|
365
|
-
|
|
365
|
+
classifyHook(memBytes) {
|
|
366
366
|
if (memBytes[0] === 233) return "jmp_rel32";
|
|
367
367
|
if (memBytes[0] === 255 && memBytes[1] === 37) return "jmp_abs64";
|
|
368
368
|
if (memBytes[0] === 104 && memBytes[5] === 195) return "push_ret";
|
|
369
369
|
return "unknown";
|
|
370
370
|
}
|
|
371
|
-
|
|
371
|
+
decodeJumpTarget(memBytes, funcAddr) {
|
|
372
372
|
if (memBytes[0] === 233) {
|
|
373
373
|
const rel32 = memBytes.readInt32LE(1);
|
|
374
374
|
return `0x${(funcAddr + 5n + BigInt(rel32)).toString(16)}`;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { t as logger } from "./logger-Dh_xb7_2.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { Jt as PAGE_NETWORK_IDLE_TIMEOUT_MS, qt as PAGE_FRAME_SELECTOR_TIMEOUT_MS } from "./constants-CDZLOoVv.mjs";
|
|
3
3
|
import { setTimeout as setTimeout$1 } from "node:timers/promises";
|
|
4
4
|
//#region src/modules/collector/PageController.ts
|
|
5
5
|
var PageController = class {
|
|
6
6
|
constructor(collector) {
|
|
7
7
|
this.collector = collector;
|
|
8
8
|
}
|
|
9
|
+
async getBrowser() {
|
|
10
|
+
return this.collector.getBrowser();
|
|
11
|
+
}
|
|
9
12
|
hasAttachedTargetSession() {
|
|
10
13
|
return this.collector.getAttachedTargetSession() !== null;
|
|
11
14
|
}
|
|
@@ -58,11 +61,22 @@ var PageController = class {
|
|
|
58
61
|
}
|
|
59
62
|
async click(selector, options, frameOptions) {
|
|
60
63
|
const page = await this.collector.getActivePage();
|
|
61
|
-
|
|
64
|
+
const context = await this.resolveFrame(page, frameOptions);
|
|
65
|
+
const timeout = options?.timeout;
|
|
66
|
+
const clickOptions = {
|
|
62
67
|
button: options?.button || "left",
|
|
63
68
|
clickCount: options?.clickCount || 1,
|
|
64
69
|
delay: options?.delay
|
|
65
|
-
}
|
|
70
|
+
};
|
|
71
|
+
if (options?.offset) clickOptions.offset = options.offset;
|
|
72
|
+
if (typeof timeout === "number" && Number.isFinite(timeout) && timeout > 0) {
|
|
73
|
+
page.setDefaultTimeout(timeout);
|
|
74
|
+
try {
|
|
75
|
+
await context.click(selector, clickOptions);
|
|
76
|
+
} finally {
|
|
77
|
+
page.setDefaultTimeout(this.collector["config"]?.timeout ?? 3e4);
|
|
78
|
+
}
|
|
79
|
+
} else await context.click(selector, clickOptions);
|
|
66
80
|
logger.info(`Clicked: ${selector}${frameOptions?.frameUrl || frameOptions?.frameSelector ? " (in frame)" : ""}`);
|
|
67
81
|
}
|
|
68
82
|
async type(selector, text, options, frameOptions) {
|
|
@@ -168,7 +182,7 @@ var PageController = class {
|
|
|
168
182
|
return page.frames().map((frame) => ({
|
|
169
183
|
url: frame.url(),
|
|
170
184
|
name: frame.name() || "",
|
|
171
|
-
id: frame
|
|
185
|
+
id: frame["_id"] || "",
|
|
172
186
|
isMainFrame: frame === mainFrame
|
|
173
187
|
}));
|
|
174
188
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as createPlatformProvider } from "./factory-
|
|
3
|
-
import { t as nativeMemoryManager } from "./NativeMemoryManager.impl-
|
|
4
|
-
import { n as parseAddress, t as formatAddress } from "./formatAddress-
|
|
1
|
+
import { Qt as POINTER_CHAIN_SCAN_CHUNK_SIZE, Xt as POINTER_CHAIN_MAX_OFFSET, Yt as POINTER_CHAIN_MAX_DEPTH, Zt as POINTER_CHAIN_MAX_RESULTS } from "./constants-CDZLOoVv.mjs";
|
|
2
|
+
import { t as createPlatformProvider } from "./factory-C90tBff6.mjs";
|
|
3
|
+
import { t as nativeMemoryManager } from "./NativeMemoryManager.impl-D9Lkovvn.mjs";
|
|
4
|
+
import { n as parseAddress, t as formatAddress } from "./formatAddress-nnMvEohD.mjs";
|
|
5
5
|
import { randomUUID } from "node:crypto";
|
|
6
6
|
//#region src/native/PointerChainEngine.ts
|
|
7
7
|
/**
|
|
@@ -15,10 +15,13 @@ import { randomUUID } from "node:crypto";
|
|
|
15
15
|
* @module PointerChainEngine
|
|
16
16
|
*/
|
|
17
17
|
var PointerChainEngine = class {
|
|
18
|
-
|
|
18
|
+
providerCache = null;
|
|
19
19
|
get provider() {
|
|
20
|
-
if (!this.
|
|
21
|
-
return this.
|
|
20
|
+
if (!this.providerCache) this.providerCache = createPlatformProvider();
|
|
21
|
+
return this.providerCache;
|
|
22
|
+
}
|
|
23
|
+
set provider(value) {
|
|
24
|
+
this.providerCache = value;
|
|
22
25
|
}
|
|
23
26
|
/**
|
|
24
27
|
* Multi-level BFS pointer scan.
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { t as logger } from "./logger-Dh_xb7_2.mjs";
|
|
2
|
+
import { G as EXTERNAL_TOOL_FORCE_KILL_GRACE_MS } from "./constants-CDZLOoVv.mjs";
|
|
3
|
+
//#region src/utils/ProcessRegistry.ts
|
|
4
|
+
/**
|
|
5
|
+
* Global singleton registry to track and safely terminate orphaned child
|
|
6
|
+
* processes and worker threads upon server shutdown.
|
|
7
|
+
*/
|
|
8
|
+
var ProcessRegistrySingleton = class {
|
|
9
|
+
processes = /* @__PURE__ */ new Set();
|
|
10
|
+
/**
|
|
11
|
+
* Register a ChildProcess or Worker for automatic cleanup on shutdown.
|
|
12
|
+
*/
|
|
13
|
+
register(proc) {
|
|
14
|
+
if (!proc) return;
|
|
15
|
+
this.processes.add(proc);
|
|
16
|
+
if ("kill" in proc) proc.once("close", () => this.unregister(proc));
|
|
17
|
+
else if ("terminate" in proc) {
|
|
18
|
+
if (typeof proc.once === "function") proc.once("exit", () => this.unregister(proc));
|
|
19
|
+
else if (typeof proc.on === "function") proc.on("exit", () => this.unregister(proc));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Unregister a process/worker.
|
|
24
|
+
*/
|
|
25
|
+
unregister(proc) {
|
|
26
|
+
if (!proc) return;
|
|
27
|
+
this.processes.delete(proc);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Terminate all tracked processes and workers.
|
|
31
|
+
* Sends SIGTERM, then after a grace period sends SIGKILL.
|
|
32
|
+
*/
|
|
33
|
+
async terminateAll() {
|
|
34
|
+
if (this.processes.size === 0) return;
|
|
35
|
+
logger.debug(`[ProcessRegistry] Attempting to terminate ${this.processes.size} active processes/workers...`);
|
|
36
|
+
const terminationPromises = [];
|
|
37
|
+
for (const proc of this.processes) if ("terminate" in proc) terminationPromises.push(proc.terminate().then(() => {
|
|
38
|
+
this.processes.delete(proc);
|
|
39
|
+
}).catch((err) => {
|
|
40
|
+
logger.warn(`[ProcessRegistry] Error terminating worker: ${err.message}`);
|
|
41
|
+
}));
|
|
42
|
+
else if ("kill" in proc) terminationPromises.push(new Promise((resolve) => {
|
|
43
|
+
if (proc.killed || proc.exitCode !== null || proc.signalCode !== null) {
|
|
44
|
+
this.processes.delete(proc);
|
|
45
|
+
return resolve();
|
|
46
|
+
}
|
|
47
|
+
proc.kill("SIGTERM");
|
|
48
|
+
let settled = false;
|
|
49
|
+
const handleExit = () => {
|
|
50
|
+
if (settled) return;
|
|
51
|
+
settled = true;
|
|
52
|
+
this.processes.delete(proc);
|
|
53
|
+
resolve();
|
|
54
|
+
};
|
|
55
|
+
proc.once("exit", handleExit);
|
|
56
|
+
proc.once("close", handleExit);
|
|
57
|
+
setTimeout(() => {
|
|
58
|
+
if (!settled && !proc.killed && proc.exitCode === null) {
|
|
59
|
+
logger.debug(`[ProcessRegistry] Force killing child process PID ${proc.pid}`);
|
|
60
|
+
try {
|
|
61
|
+
proc.kill("SIGKILL");
|
|
62
|
+
} catch {}
|
|
63
|
+
handleExit();
|
|
64
|
+
}
|
|
65
|
+
}, EXTERNAL_TOOL_FORCE_KILL_GRACE_MS).unref();
|
|
66
|
+
}));
|
|
67
|
+
await Promise.race([Promise.all(terminationPromises), new Promise((resolve) => setTimeout(resolve, EXTERNAL_TOOL_FORCE_KILL_GRACE_MS + 1e3).unref())]);
|
|
68
|
+
this.processes.clear();
|
|
69
|
+
logger.debug(`[ProcessRegistry] Termination sweep complete.`);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
const ProcessRegistry = new ProcessRegistrySingleton();
|
|
73
|
+
//#endregion
|
|
74
|
+
export { ProcessRegistry as t };
|