-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
54 lines (47 loc) · 1.38 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
const mjs = require('memoryjs');
module.exports = function(procName) {
const process = mjs.openProcess(procName);
return {
process,
addresses: {},
getPathTracer(moduleName = '', path = []) {
return function() {
let val = mjs.findModule(moduleName, process.th32ProcessID).modBaseAddr;
for (const i in path) {
if (parseInt(i) === path.length - 1) return val + path[i];
val = mjs.readMemory(process.handle, val + path[i], mjs.DWORD);
}
}
},
setAddress(addressName = '', moduleName = '', path = []) {
this.addresses[addressName] = this.getPathTracer(moduleName, path)
},
read(addressName = '', dataType = mjs.DWORD) {
return mjs.readMemory(this.process.handle, this.addresses[addressName](), dataType);
},
write(addressName = '', value, dataType = mjs.DWORD) {
return mjs.writeMemory(this.process.handle, this.addresses[addressName](), value, dataType);
},
BYTE: 'byte',
INT: 'int',
INT32: 'int32',
UINT32: 'uint32',
INT64: 'int64',
UINT64: 'uint64',
DWORD: 'dword',
SHORT: 'short',
LONG: 'long',
FLOAT: 'float',
DOUBLE: 'double',
BOOL: 'bool',
BOOLEAN: 'boolean',
PTR: 'ptr',
POINTER: 'pointer',
STR: 'str',
STRING: 'string',
VEC3: 'vec3',
VECTOR3: 'vector3',
VEC4: 'vec4',
VECTOR4: 'vector4',
}
};