@cheatron/native 1.1.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/README.md +17 -4
  2. package/dist/{src/handle.d.ts → handle.d.ts} +4 -0
  3. package/dist/handle.d.ts.map +1 -0
  4. package/dist/{src/handle.js → handle.js} +3 -3
  5. package/dist/handle.js.map +1 -0
  6. package/dist/{src/index.d.ts → index.d.ts} +8 -3
  7. package/dist/index.d.ts.map +1 -0
  8. package/dist/{src/index.js → index.js} +7 -2
  9. package/dist/index.js.map +1 -0
  10. package/dist/logger.d.ts.map +1 -0
  11. package/dist/logger.js.map +1 -0
  12. package/dist/module.d.ts +38 -0
  13. package/dist/module.d.ts.map +1 -0
  14. package/dist/module.js +106 -0
  15. package/dist/module.js.map +1 -0
  16. package/dist/msvcrt-ext.d.ts +20 -0
  17. package/dist/msvcrt-ext.d.ts.map +1 -0
  18. package/dist/msvcrt-ext.js +120 -0
  19. package/dist/msvcrt-ext.js.map +1 -0
  20. package/dist/native-fn.d.ts +73 -0
  21. package/dist/native-fn.d.ts.map +1 -0
  22. package/dist/native-fn.js +214 -0
  23. package/dist/native-fn.js.map +1 -0
  24. package/dist/pattern.d.ts +36 -0
  25. package/dist/pattern.d.ts.map +1 -0
  26. package/dist/pattern.js +79 -0
  27. package/dist/pattern.js.map +1 -0
  28. package/dist/process.d.ts +104 -0
  29. package/dist/process.d.ts.map +1 -0
  30. package/dist/process.js +402 -0
  31. package/dist/process.js.map +1 -0
  32. package/dist/scan-result.d.ts +54 -0
  33. package/dist/scan-result.d.ts.map +1 -0
  34. package/dist/scan-result.js +128 -0
  35. package/dist/scan-result.js.map +1 -0
  36. package/dist/scanner.d.ts +22 -0
  37. package/dist/scanner.d.ts.map +1 -0
  38. package/dist/scanner.js +116 -0
  39. package/dist/scanner.js.map +1 -0
  40. package/dist/thread.d.ts.map +1 -0
  41. package/dist/{src/thread.js → thread.js} +1 -1
  42. package/dist/thread.js.map +1 -0
  43. package/package.json +3 -2
  44. package/dist/eslint.config.d.ts +0 -3
  45. package/dist/eslint.config.d.ts.map +0 -1
  46. package/dist/eslint.config.js +0 -26
  47. package/dist/eslint.config.js.map +0 -1
  48. package/dist/src/handle.d.ts.map +0 -1
  49. package/dist/src/handle.js.map +0 -1
  50. package/dist/src/index.d.ts.map +0 -1
  51. package/dist/src/index.js.map +0 -1
  52. package/dist/src/logger.d.ts.map +0 -1
  53. package/dist/src/logger.js.map +0 -1
  54. package/dist/src/module.d.ts +0 -22
  55. package/dist/src/module.d.ts.map +0 -1
  56. package/dist/src/module.js +0 -55
  57. package/dist/src/module.js.map +0 -1
  58. package/dist/src/process.d.ts +0 -30
  59. package/dist/src/process.d.ts.map +0 -1
  60. package/dist/src/process.js +0 -104
  61. package/dist/src/process.js.map +0 -1
  62. package/dist/src/thread.d.ts.map +0 -1
  63. package/dist/src/thread.js.map +0 -1
  64. package/dist/tests/integration/memory.test.d.ts +0 -2
  65. package/dist/tests/integration/memory.test.d.ts.map +0 -1
  66. package/dist/tests/integration/memory.test.js +0 -82
  67. package/dist/tests/integration/memory.test.js.map +0 -1
  68. package/dist/tests/integration/thread.test.d.ts +0 -2
  69. package/dist/tests/integration/thread.test.d.ts.map +0 -1
  70. package/dist/tests/integration/thread.test.js +0 -37
  71. package/dist/tests/integration/thread.test.js.map +0 -1
  72. package/dist/tests/setup.d.ts +0 -2
  73. package/dist/tests/setup.d.ts.map +0 -1
  74. package/dist/tests/setup.js +0 -3
  75. package/dist/tests/setup.js.map +0 -1
  76. package/dist/tests/unit/kernel32.test.d.ts +0 -2
  77. package/dist/tests/unit/kernel32.test.d.ts.map +0 -1
  78. package/dist/tests/unit/kernel32.test.js +0 -28
  79. package/dist/tests/unit/kernel32.test.js.map +0 -1
  80. package/dist/tests/unit/logger.test.d.ts +0 -2
  81. package/dist/tests/unit/logger.test.d.ts.map +0 -1
  82. package/dist/tests/unit/logger.test.js +0 -29
  83. package/dist/tests/unit/logger.test.js.map +0 -1
  84. package/dist/tests/unit/msvcrt.test.d.ts +0 -2
  85. package/dist/tests/unit/msvcrt.test.d.ts.map +0 -1
  86. package/dist/tests/unit/msvcrt.test.js +0 -22
  87. package/dist/tests/unit/msvcrt.test.js.map +0 -1
  88. package/dist/tests/unit/process.test.d.ts +0 -2
  89. package/dist/tests/unit/process.test.d.ts.map +0 -1
  90. package/dist/tests/unit/process.test.js +0 -27
  91. package/dist/tests/unit/process.test.js.map +0 -1
  92. package/dist/tests/unit/thread.test.d.ts +0 -2
  93. package/dist/tests/unit/thread.test.d.ts.map +0 -1
  94. package/dist/tests/unit/thread.test.js +0 -35
  95. package/dist/tests/unit/thread.test.js.map +0 -1
  96. package/dist/tests/unit/thread_creation.test.d.ts +0 -2
  97. package/dist/tests/unit/thread_creation.test.d.ts.map +0 -1
  98. package/dist/tests/unit/thread_creation.test.js +0 -31
  99. package/dist/tests/unit/thread_creation.test.js.map +0 -1
  100. /package/dist/{src/logger.d.ts → logger.d.ts} +0 -0
  101. /package/dist/{src/logger.js → logger.js} +0 -0
  102. /package/dist/{src/thread.d.ts → thread.d.ts} +0 -0
@@ -0,0 +1,214 @@
1
+ import { ffi, MsvcrtImpl as msvcrt, MemoryProtection, MemoryState, MemoryFreeType, } from '@cheatron/native-bindings';
2
+ import { KeystoneX86 } from '@cheatron/keystone';
3
+ import { log } from './logger';
4
+ const nfLog = log.child('NativeFn');
5
+ /** Registry for automatic cleanup of memory pages */
6
+ const registry = new FinalizationRegistry((page) => {
7
+ if (page) {
8
+ // Lazy require to avoid circular dependencies
9
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
10
+ const { currentProcess } = require('./process');
11
+ // Free the allocated memory using currentProcess.free
12
+ try {
13
+ const success = currentProcess.memory.free(page, 0, MemoryFreeType.RELEASE);
14
+ if (success) {
15
+ nfLog.info('Garbage collection: cleaned up executable memory page');
16
+ }
17
+ else {
18
+ nfLog.error('Garbage collection: currentProcess.free returned false during cleanup');
19
+ }
20
+ }
21
+ catch (err) {
22
+ const message = err instanceof Error ? err.message : String(err);
23
+ nfLog.error(`Garbage collection: cleanup failed: ${message}`);
24
+ }
25
+ }
26
+ });
27
+ export const ALIGN = 16;
28
+ /**
29
+ * Rounds a number up to the nearest multiple of 16.
30
+ */
31
+ export function addressAlign16(n) {
32
+ return (n + ALIGN - 1) & ~(ALIGN - 1);
33
+ }
34
+ export const codeAlign16 = addressAlign16;
35
+ export const stackAlign16 = addressAlign16;
36
+ /**
37
+ * Dynamically creates callable native functions from assembly or bytecode.
38
+ *
39
+ * Functions are written into a single VirtualAlloc'd executable page and
40
+ * exposed as callable methods on the instance via koffi.
41
+ */
42
+ export class NativeFunctionCreator {
43
+ page;
44
+ pageAddr;
45
+ offset = 0;
46
+ capacity;
47
+ ks;
48
+ functions = new Map();
49
+ constructor(capacity = 8192) {
50
+ this.capacity = capacity;
51
+ this.ks = new KeystoneX86();
52
+ // Lazy require to avoid circular dependencies
53
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
54
+ const { currentProcess } = require('./process');
55
+ // Allocate executable memory using currentProcess.alloc
56
+ this.page = currentProcess.memory.alloc(BigInt(capacity), null, MemoryState.COMMIT | MemoryState.RESERVE, MemoryProtection.EXECUTE_READWRITE);
57
+ if (!this.page) {
58
+ throw new Error('VirtualAlloc failed: could not allocate executable memory');
59
+ }
60
+ // Register for automatic cleanup. Use 'this' as the unregister token.
61
+ registry.register(this, this.page, this);
62
+ this.pageAddr = ffi.address(this.page);
63
+ nfLog.info(`Allocated ${capacity} bytes of executable memory at 0x${this.pageAddr.toString(16).toUpperCase()}`);
64
+ }
65
+ /**
66
+ * Add a native function from assembly source code.
67
+ * @param def Function definition { name: [returnType, [paramTypes...]] }
68
+ * @param asmSource x86-64 assembly instructions
69
+ * @returns Address of the function
70
+ */
71
+ add(def, asmSource) {
72
+ const name = Object.keys(def)[0];
73
+ if (!name) {
74
+ throw new Error('Invalid function definition: name is missing');
75
+ }
76
+ const sig = def[name];
77
+ if (!sig) {
78
+ throw new Error(`Invalid function definition: signature is missing for '${name}'`);
79
+ }
80
+ const funcAddr = this.pageAddr + BigInt(this.offset);
81
+ const bytes = this.ks.asm(asmSource, funcAddr);
82
+ return this._writeAndBind(name, sig, bytes);
83
+ }
84
+ /**
85
+ * Add a native function from raw bytecode.
86
+ * @param def Function definition { name: [returnType, [paramTypes...]] }
87
+ * @param bytes Raw machine code bytes
88
+ * @returns Address of the function
89
+ */
90
+ addBytes(def, bytes) {
91
+ const name = Object.keys(def)[0];
92
+ if (!name) {
93
+ throw new Error('Invalid function definition: name is missing');
94
+ }
95
+ const sig = def[name];
96
+ if (!sig) {
97
+ throw new Error(`Invalid function definition: signature is missing for '${name}'`);
98
+ }
99
+ return this._writeAndBind(name, sig, bytes);
100
+ }
101
+ /**
102
+ * Get the address of a registered function by name.
103
+ */
104
+ getAddress(name) {
105
+ return this.functions.get(name)?.address;
106
+ }
107
+ /**
108
+ * Get the callable function by name.
109
+ */
110
+ // eslint-disable-next-line no-unused-vars
111
+ getFunction(name) {
112
+ return this.functions.get(name)?.callable;
113
+ }
114
+ /**
115
+ * Get info about all registered functions.
116
+ */
117
+ list() {
118
+ return [...this.functions.values()];
119
+ }
120
+ /**
121
+ * Get remaining capacity in bytes.
122
+ */
123
+ get remaining() {
124
+ return this.capacity - this.offset;
125
+ }
126
+ /**
127
+ * Free the executable memory page.
128
+ */
129
+ destroy() {
130
+ if (this.page) {
131
+ // Unregister from finalizer as we are doing manual cleanup
132
+ registry.unregister(this);
133
+ // Lazy require to avoid circular dependencies
134
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
135
+ const { currentProcess } = require('./process');
136
+ // Perform the actual free using currentProcess.free
137
+ const success = currentProcess.memory.free(this.page, 0, MemoryFreeType.RELEASE);
138
+ if (success) {
139
+ nfLog.info('NativeFunctionCreator destroyed');
140
+ }
141
+ else {
142
+ nfLog.warn('currentProcess.free failed during NativeFunctionCreator destruction');
143
+ }
144
+ this.page = null;
145
+ this.functions.clear();
146
+ }
147
+ }
148
+ // ── Internal ──────────────────────────────────────────────
149
+ _writeAndBind(name, sig, bytes) {
150
+ if (this.functions.has(name)) {
151
+ throw new Error(`Function '${name}' already registered`);
152
+ }
153
+ const alignedSize = codeAlign16(bytes.length);
154
+ if (this.offset + alignedSize > this.capacity) {
155
+ throw new Error(`Not enough space: need ${alignedSize} bytes, ${this.remaining} remaining`);
156
+ }
157
+ const funcOffset = this.offset;
158
+ const funcAddr = this.pageAddr + BigInt(funcOffset);
159
+ // Write bytecode into executable page
160
+ const buf = Buffer.from(bytes);
161
+ msvcrt.memcpy(funcAddr, buf, BigInt(bytes.length));
162
+ nfLog.debug(`Written '${name}' (${bytes.length} bytes) at 0x${funcAddr.toString(16).toUpperCase()} [offset: ${funcOffset}]`);
163
+ // Advance offset (aligned)
164
+ this.offset += alignedSize;
165
+ // Create koffi prototype
166
+ const [retType, paramTypes] = sig;
167
+ const protoName = `__nf_${name}_${Date.now()}`;
168
+ const paramStr = paramTypes.map((t, i) => `${t} p${i}`).join(', ');
169
+ const protoStr = `${retType} ${protoName}(${paramStr})`;
170
+ const proto = ffi.proto(protoStr);
171
+ // Decode function pointer from base page + offset
172
+ // koffi.decode(ptr, type, offset) offsets from the base external pointer
173
+ const callable = ffi.decode(this.page, proto, funcOffset);
174
+ // Bind as method on this instance
175
+ Object.defineProperty(this, name, {
176
+ enumerable: true,
177
+ configurable: true,
178
+ value: callable,
179
+ });
180
+ // Track
181
+ const entry = {
182
+ name,
183
+ address: funcAddr,
184
+ size: bytes.length,
185
+ sig,
186
+ callable,
187
+ };
188
+ this.functions.set(name, entry);
189
+ return funcAddr;
190
+ }
191
+ }
192
+ /**
193
+ * Global shared NativeFunctionCreator instance.
194
+ * Lazy initialized to prevent circular dependency issues during module load.
195
+ */
196
+ let _nativeFn;
197
+ export const nativeFn = new Proxy({}, {
198
+ get(_target, prop) {
199
+ if (!_nativeFn) {
200
+ _nativeFn = new NativeFunctionCreator();
201
+ }
202
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
203
+ const val = _nativeFn[prop];
204
+ // Don't bind non-functions or constructor
205
+ if (typeof val === 'function' && prop !== 'constructor') {
206
+ return val.bind(_nativeFn);
207
+ }
208
+ return val;
209
+ },
210
+ getPrototypeOf() {
211
+ return NativeFunctionCreator.prototype;
212
+ },
213
+ });
214
+ //# sourceMappingURL=native-fn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native-fn.js","sourceRoot":"","sources":["../src/native-fn.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,GAAG,EACH,UAAU,IAAI,MAAM,EACpB,gBAAgB,EAChB,WAAW,EACX,cAAc,GAGf,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;AAEpC,qDAAqD;AACrD,MAAM,QAAQ,GAAG,IAAI,oBAAoB,CAAS,CAAC,IAAI,EAAE,EAAE;IACzD,IAAI,IAAI,EAAE,CAAC;QACT,8CAA8C;QAC9C,iEAAiE;QACjE,MAAM,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;QAEhD,sDAAsD;QACtD,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,cAAc,CAAC,MAAM,CAAC,IAAI,CACxC,IAAI,EACJ,CAAW,EACX,cAAc,CAAC,OAAO,CACvB,CAAC;YACF,IAAI,OAAO,EAAE,CAAC;gBACZ,KAAK,CAAC,IAAI,CAAC,uDAAuD,CAAC,CAAC;YACtE,CAAC;iBAAM,CAAC;gBACN,KAAK,CAAC,KAAK,CACT,uEAAuE,CACxE,CAAC;YACJ,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC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AO,GAAG,KAAK,UAAU,IAAI,IAAI,KAAK,aAAa,EAAE,CAAC;YACxD,OAAO,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC7B,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IACD,cAAc;QACZ,OAAO,qBAAqB,CAAC,SAAS,CAAC;IACzC,CAAC;CACF,CACF,CAAC"}
@@ -0,0 +1,36 @@
1
+ import { MemoryProtection } from '@cheatron/win32-ext';
2
+ /**
3
+ * Default protection mask: all readable memory regions.
4
+ */
5
+ export declare const DEFAULT_PROTECT: number;
6
+ /**
7
+ * Pure data representation of a memory signature.
8
+ * Defines the bytes, mask, limits, and memory protection preferences.
9
+ */
10
+ export declare class Pattern {
11
+ bytes: Buffer;
12
+ mask: string;
13
+ private _limit;
14
+ protect: number;
15
+ constructor(signature: string);
16
+ get length(): number;
17
+ get maxResults(): number;
18
+ get hasLimit(): boolean;
19
+ /**
20
+ * Sets a specific scan limit.
21
+ */
22
+ limit(n: number): this;
23
+ /**
24
+ * Removes any limits (scan the whole memory for matches).
25
+ */
26
+ noLimit(): this;
27
+ /**
28
+ * Restricts scan to segments matching the given protection mask.
29
+ */
30
+ addProtect(flag: number | MemoryProtection): this;
31
+ /**
32
+ * Automatically applies typical readable/executable filters.
33
+ */
34
+ defaultProtect(): this;
35
+ }
36
+ //# sourceMappingURL=pattern.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pattern.d.ts","sourceRoot":"","sources":["../src/pattern.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAKvD;;GAEG;AACH,eAAO,MAAM,eAAe,QAIQ,CAAC;AAErC;;;GAGG;AACH,qBAAa,OAAO;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,MAAM,CAAa;IACpB,OAAO,EAAE,MAAM,CAAK;gBAEf,SAAS,EAAE,MAAM;IAsB7B,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED;;OAEG;IACH,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAKtB;;OAEG;IACH,OAAO,IAAI,IAAI;IAKf;;OAEG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI;IAKjD;;OAEG;IACH,cAAc,IAAI,IAAI;CAIvB"}
@@ -0,0 +1,79 @@
1
+ import { MemoryProtection } from '@cheatron/win32-ext';
2
+ import { log } from './logger';
3
+ const scanLog = log.child('Scanner');
4
+ /**
5
+ * Default protection mask: all readable memory regions.
6
+ */
7
+ export const DEFAULT_PROTECT = MemoryProtection.READONLY |
8
+ MemoryProtection.READWRITE |
9
+ MemoryProtection.EXECUTE_READ |
10
+ MemoryProtection.EXECUTE_READWRITE;
11
+ /**
12
+ * Pure data representation of a memory signature.
13
+ * Defines the bytes, mask, limits, and memory protection preferences.
14
+ */
15
+ export class Pattern {
16
+ bytes;
17
+ mask;
18
+ _limit = 1; // Default to 1 result
19
+ protect = 0;
20
+ constructor(signature) {
21
+ const parts = signature.split(/\s+/).filter(Boolean);
22
+ const bytes = [];
23
+ let mask = '';
24
+ for (const part of parts) {
25
+ if (part === '??' || part === '?') {
26
+ bytes.push(0);
27
+ mask += '?';
28
+ }
29
+ else {
30
+ const byte = parseInt(part, 16);
31
+ if (isNaN(byte))
32
+ throw new Error(`Invalid byte in signature: ${part}`);
33
+ bytes.push(byte);
34
+ mask += 'x';
35
+ }
36
+ }
37
+ this.bytes = Buffer.from(bytes);
38
+ this.mask = mask;
39
+ scanLog.debug(`Parsed pattern: ${signature} -> ${mask}`);
40
+ }
41
+ get length() {
42
+ return this.bytes.length;
43
+ }
44
+ get maxResults() {
45
+ return this._limit;
46
+ }
47
+ get hasLimit() {
48
+ return this._limit > 0;
49
+ }
50
+ /**
51
+ * Sets a specific scan limit.
52
+ */
53
+ limit(n) {
54
+ this._limit = n;
55
+ return this;
56
+ }
57
+ /**
58
+ * Removes any limits (scan the whole memory for matches).
59
+ */
60
+ noLimit() {
61
+ this._limit = 0;
62
+ return this;
63
+ }
64
+ /**
65
+ * Restricts scan to segments matching the given protection mask.
66
+ */
67
+ addProtect(flag) {
68
+ this.protect |= flag;
69
+ return this;
70
+ }
71
+ /**
72
+ * Automatically applies typical readable/executable filters.
73
+ */
74
+ defaultProtect() {
75
+ this.protect = DEFAULT_PROTECT;
76
+ return this;
77
+ }
78
+ }
79
+ //# sourceMappingURL=pattern.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pattern.js","sourceRoot":"","sources":["../src/pattern.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,MAAM,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AAErC;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAC1B,gBAAgB,CAAC,QAAQ;IACzB,gBAAgB,CAAC,SAAS;IAC1B,gBAAgB,CAAC,YAAY;IAC7B,gBAAgB,CAAC,iBAAiB,CAAC;AAErC;;;GAGG;AACH,MAAM,OAAO,OAAO;IACX,KAAK,CAAS;IACd,IAAI,CAAS;IACZ,MAAM,GAAW,CAAC,CAAC,CAAC,sBAAsB;IAC3C,OAAO,GAAW,CAAC,CAAC;IAE3B,YAAY,SAAiB;QAC3B,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACrD,MAAM,KAAK,GAAa,EAAE,CAAC;QAC3B,IAAI,IAAI,GAAG,EAAE,CAAC;QAEd,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,GAA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CACF"}
@@ -0,0 +1,104 @@
1
+ import { Thread } from './thread';
2
+ import { ThreadCreationFlags, MemoryFreeType, type SecurityAttributes, type MemoryBasicInformation, type HANDLE, type LPVOID, type SIZE_T } from '@cheatron/native-bindings';
3
+ import { Handle } from './handle';
4
+ import { Pattern } from './pattern';
5
+ import { ScanResult } from './scan-result';
6
+ /**
7
+ * Represents a process handle
8
+ */
9
+ export declare class Process extends Handle {
10
+ protected _pid: number;
11
+ readonly memory: ProcessMemory;
12
+ constructor(handle: HANDLE, pid?: number, autoClose?: boolean);
13
+ static open(pid: number, access?: number): Process;
14
+ createThread(startAddress: LPVOID, parameter?: LPVOID | null, stackSize?: SIZE_T, flags?: ThreadCreationFlags | number, attributes?: SecurityAttributes | LPVOID | null): Thread;
15
+ /**
16
+ * Finds pattern matches in a specific memory range.
17
+ * Configure limit on the Pattern: `.limit(1)` for first match only.
18
+ */
19
+ private findPatternInRangeGenerator;
20
+ findPatternInRange(signature: string | Pattern, start: bigint, size: number, module?: import('./module').Module): ScanResult;
21
+ /**
22
+ * Finds pattern matches in all committed readable memory of the process.
23
+ * Configure limit and protect filter on the Pattern object.
24
+ */
25
+ private findPatternGenerator;
26
+ findPattern(signature: string | Pattern): ScanResult;
27
+ /**
28
+ * Finds pattern matches across specified modules (default: all static modules).
29
+ * Each entry in the result is tagged with its source module.
30
+ * Configure limit and protect filter on the Pattern object.
31
+ */
32
+ private findPatternFromModulesGenerator;
33
+ findPatternFromModules(signature: string | Pattern, moduleNames?: string[]): ScanResult;
34
+ static current(): CurrentProcess;
35
+ get pid(): number;
36
+ }
37
+ /**
38
+ * Represents the current process (singleton)
39
+ */
40
+ export declare class CurrentProcess extends Process {
41
+ readonly memory: CurrentProcessMemory;
42
+ constructor();
43
+ createThread(startAddress: LPVOID, parameter?: LPVOID | null, stackSize?: SIZE_T, flags?: ThreadCreationFlags | number, attributes?: SecurityAttributes | LPVOID | null): Thread;
44
+ close(): void;
45
+ }
46
+ export declare const currentProcess: CurrentProcess;
47
+ /**
48
+ * Manages memory operations for a given process handle.
49
+ */
50
+ export declare class ProcessMemory {
51
+ readonly process: Process;
52
+ constructor(process: Process);
53
+ read(address: LPVOID, size: number): Buffer;
54
+ readMemory: (address: LPVOID, size: number) => Buffer;
55
+ write(address: LPVOID, buffer: Buffer): void;
56
+ writeMemory: (address: LPVOID, buffer: Buffer) => void;
57
+ readInt8(address: LPVOID): number;
58
+ writeInt8(address: LPVOID, value: number): void;
59
+ readUInt8(address: LPVOID): number;
60
+ writeUInt8(address: LPVOID, value: number): void;
61
+ readInt16(address: LPVOID): number;
62
+ writeInt16(address: LPVOID, value: number): void;
63
+ readUInt16(address: LPVOID): number;
64
+ writeUInt16(address: LPVOID, value: number): void;
65
+ readInt32(address: LPVOID): number;
66
+ writeInt32(address: LPVOID, value: number): void;
67
+ readUInt32(address: LPVOID): number;
68
+ writeUInt32(address: LPVOID, value: number): void;
69
+ readInt64(address: LPVOID): bigint;
70
+ writeInt64(address: LPVOID, value: bigint): void;
71
+ readUInt64(address: LPVOID): bigint;
72
+ writeUInt64(address: LPVOID, value: bigint): void;
73
+ readFloat(address: LPVOID): number;
74
+ writeFloat(address: LPVOID, value: number): void;
75
+ readDouble(address: LPVOID): number;
76
+ writeDouble(address: LPVOID, value: number): void;
77
+ readString(address: LPVOID, length: number, encoding?: BufferEncoding): string;
78
+ writeString(address: LPVOID, value: string, encoding?: BufferEncoding): void;
79
+ query(address: LPVOID): MemoryBasicInformation;
80
+ virtualQuery: (address: LPVOID) => MemoryBasicInformation;
81
+ /**
82
+ * Allocates memory in the process.
83
+ */
84
+ alloc(size: SIZE_T, address?: LPVOID | null, allocationType?: number, protection?: number): LPVOID;
85
+ /**
86
+ * Frees memory in the process.
87
+ */
88
+ free(address: LPVOID, size?: SIZE_T, freeType?: MemoryFreeType | number): boolean;
89
+ /**
90
+ * Changes the memory protection of a region of memory.
91
+ */
92
+ protect(address: LPVOID, size: SIZE_T, newProtect: number): number | null;
93
+ }
94
+ /**
95
+ * Optimizes memory operations natively for the current running process.
96
+ */
97
+ export declare class CurrentProcessMemory extends ProcessMemory {
98
+ alloc(size: SIZE_T, address?: LPVOID | null, allocationType?: number, protection?: number): LPVOID;
99
+ free(address: LPVOID, size?: SIZE_T, freeType?: MemoryFreeType | number): boolean;
100
+ protect(address: LPVOID, size: SIZE_T | number, newProtect: number): number | null;
101
+ query(address: LPVOID): MemoryBasicInformation;
102
+ virtualQuery: (address: LPVOID) => MemoryBasicInformation;
103
+ }
104
+ //# sourceMappingURL=process.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../src/process.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAIL,mBAAmB,EAKnB,cAAc,EACd,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,MAAM,EACX,KAAK,MAAM,EACX,KAAK,MAAM,EACZ,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAa,MAAM,eAAe,CAAC;AAItD;;GAEG;AACH,qBAAa,OAAQ,SAAQ,MAAM;IACjC,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC;IACvB,SAAgB,MAAM,EAAE,aAAa,CAAC;gBAE1B,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,SAAS,GAAE,OAAc;IAMnE,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,GAAE,MAAiC,GAAG,OAAO;IAU5E,YAAY,CACV,YAAY,EAAE,MAAM,EACpB,SAAS,GAAE,MAAM,GAAG,IAAW,EAC/B,SAAS,GAAE,MAAoB,EAC/B,KAAK,GAAE,mBAAmB,GAAG,MAAsC,EACnE,UAAU,GAAE,kBAAkB,GAAG,M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