-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinjectScript.js
134 lines (108 loc) · 3.34 KB
/
injectScript.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
var scriptVerion = '0.3';
console.log('>>> Multiplayer hook script <<<');
console.log('>>> Script version: ' + scriptVerion + ' <<<');
var savedPointer = "";
var p = Memory.allocAnsiString("DEMO");
var pattern = p.toMatchPattern();
var dummy = Memory.allocAnsiString("\\\\nothing\\dev\\null");
/*var timer = setInterval(function () {
console.log(savedPointer);
console.log(p.toString());
console.log(pattern);
console.log("Start memory scan");
Memory.scan(ptr(savedPointer), 4294967296, pattern, {
onMatch: function (address, size) {
console.log("something found");
console.log(address);
clearInterval(timer);
},
onComplete: function () {
console.log("Memory scan complete");
},
onError: function (reason) {
console.log(reason);
}
});
}, 30000);*/
//var p = ptr(Memory.allocAnsiString("aabbccddeeffggg"));
/*var p = Memory.allocAnsiString("DEMO");//ptr();
var pattern = p.toMatchPattern();
console.log(p);
console.log(pattern);
var timer = setInterval(function () {
var modules = Process.enumerateModulesSync();
for(var a in modules){
//if(modules[a].name=="StreetLegal_Redline.exe") {
// console.log(modules[a].name);
Memory.scan(modules[a].base, modules[a].size, pattern, {
onMatch: function (address, size) {
console.log("something found");
console.log(address);
clearInterval(timer);
},
onComplete: function () {
//console.log("Memory scan complete");
},
onError: function (reason) {
console.log(reason);
}
});
//}
}
}, 3000);*/
var message="";
Interceptor.attach(Module.findExportByName('kernel32.dll', 'CreateFileA'), {
onEnter: function onEnter(args) {
//this.fileDescriptor = args[0].toInt32();
message = Memory.readUtf8String(args[0]);
//console.log(Memory.readUtf8String(args[0]));
//savedPointer = args[0].toString();
//Block error logging :(
/*if (message.indexOf('error.log') != -1) {
args[0] = Memory.allocAnsiString("\\\\nothing\\dev\\null");
}*/
/*if (message.indexOf('trololo') != -1) {
this.savePointer = true;
console.log('trololo pointer saved');
//args[0] = Memory.allocAnsiString("\\\\nothing\\dev\\null");
}*/
if (message.indexOf('DTM^') != -1) {
message = message.split('^');
send({name: message[1], data: message[2]});
//args[0] = dummy;
}
},
onLeave: function onLeave(retval) {
/*if (this.savePointer) {
savedPointer = retval.toInt32();
console.log('trololo pointer saved2');
}
if (retval.toInt32() > 0) {
//console.log(retval.toInt32());
}*/
}
});
Interceptor.attach(Module.findExportByName('kernel32.dll', 'ReadFile'), {
onEnter: function onEnter(args) {
//this.fileDescriptor = args[0].toInt32();
//var message = Memory.readUtf8String(args[1]);
//if (args[0].toInt32() == savedPointer) {
//console.log('TROLOLO');
//console.log("'"+Memory.readAnsiString(args[1])+"'");
//args[0] = Memory.allocAnsiString("SDAT -278.453;9.800;1033.002 ");
//args[3] = ptr("1");
//}
/*if(Memory.readAnsiString(args[1]).indexOf('DTM')!=-1){
this.args=args;
//console.log(Memory.readAnsiString(args[1]));
}*/
//qwerty123321qwerty
},
onLeave: function onLeave(retval) {
//if(this.args)
// Memory.writeAnsiString(args[1], "DTM:sosii");
//this.args[1] = Memory.allocAnsiString("DTM:sosii");
}
});
//var f = new NativeFunction(ptr("%s"), 'void', ['int']);
//f(1911);