-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy pathhook_java_loadLibrary.js
More file actions
45 lines (41 loc) · 1.46 KB
/
hook_java_loadLibrary.js
File metadata and controls
45 lines (41 loc) · 1.46 KB
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
function hook_0() {
if (Java.available) {
Java.perform(function () {
var System = Java.use("java.lang.System");
if (System != undefined) {
System.loadLibrary.implementation = function (str) {
console.log("lib name is " + str);
this.loadLibrary(str);
}
} else {
console.log("class System not found!");
}
});
}
}
function hook(){
Java.perform(function() {
const System = Java.use('java.lang.System');
const Runtime = Java.use('java.lang.Runtime');
const VMStack = Java.use('dalvik.system.VMStack');
System.loadLibrary.implementation = function(library) {
try {
console.log('System.loadLibrary("' + library + '")');
const loaded = Runtime.getRuntime().loadLibrary0(VMStack.getCallingClassLoader(), library);
return loaded;
} catch(ex) {
console.log(ex);
}
};
System.load.implementation = function(library) {
try {
console.log('System.load("' + library + '")');
const loaded = Runtime.getRuntime().load0(VMStack.getCallingClassLoader(), library);
return loaded;
} catch(ex) {
console.log(ex);
}
};
});
}
setImmediate(hook_0());