forked from CreditTone/hooker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
object_store.js
61 lines (49 loc) · 1.48 KB
/
object_store.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
function loadDexfile(dexfile) {
Java.perform(function() {
Java.openClassFile(dexfile).load();
});
};
loadDexfile('/data/user/0/com.cubic.autohome/radar.dex');
function log(str) {
console.log(str);
};
function getBaseContext() {
var currentApplication = Java.use('android.app.ActivityThread').currentApplication();
var context = currentApplication.getApplicationContext();
return context; //Java.scheduleOnMainThread(fn):
};
function sleep(time) {
var startTime = new Date().getTime() + parseInt(time, 10);
while (new Date().getTime() < startTime) {}
};
function fastTojson(javaObject) {
var JSONClz = Java.use("gz.com.alibaba.fastjson.JSON");
return JSONClz.toJSONString(javaObject);
};
function object2Json(objectId) {
var radarPropertiesClz = Java.use("gz.radar.objects.ObjectsStore");
var obj = radarPropertiesClz.getObject(objectId+"");
if (obj) {
log(fastTojson(obj));
}else{
log("Not found this object.");
}
}
function object2String(objectId) {
var radarPropertiesClz = Java.use("gz.radar.objects.ObjectsStore");
var obj = radarPropertiesClz.getObject(objectId+"");
if (obj) {
log(obj.toString());
}else{
log("Not found this object.");
}
}
function getObject(objectId) {
var radarPropertiesClz = Java.use("gz.radar.objects.ObjectsStore");
var obj = radarPropertiesClz.getObject(objectId+"");
return obj;
}
function getField(javaObject, fieldName) {
var X = Java.use("gz.util.X");
return X.getField(javaObject, fieldName);
};