-
Notifications
You must be signed in to change notification settings - Fork 1
/
console.js
51 lines (41 loc) · 1.14 KB
/
console.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
var ptr_WriteConsoleW = Module.getExportByName(null,"WriteConsoleW");
var counter = 0;
var PROTECTION = 'wr-';
var examined_ranges_sizes = {};
var examined_ranges_data = {};
console.log("[frida] script loaded successfully!")
Interceptor.attach(ptr_WriteConsoleW,
{
onEnter: function (args)
{
counter = counter + 1;
if(counter == 8){
console.log('counter:' + counter);
let ranges = Process.enumerateRanges(PROTECTION);
//console.log('[BEGIN] Memory ranges located: ' + ranges.length );
ranges.forEach(function (range) {
if (range.size){
let destFileName = `dumps/${range.base}_dump`;
let arrayBuffer = null;
try {
arrayBuffer = range.base.readByteArray(range.size);
//console.log('[DEBUG] base: ' + range.base + '| size: ' + range.size );
}
catch(e){
console.log('[ERROR] Dumping memory at: ' + range.base);
}
if (arrayBuffer){
let file = new File(destFileName, 'wb');
file.write(arrayBuffer);
file.flush();
file.close();
}
}
});
//console.log('[END] Memory dumped correctly');
}
},
onLeave: function (retvals)
{
}
});