-
Notifications
You must be signed in to change notification settings - Fork 0
/
hook_code.js
56 lines (48 loc) · 2.2 KB
/
hook_code.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
function anti_ad(activity, activityName) {
Java.perform(function() {
var pm = activity.getPackageManager();
var launcherIntent = pm.getLaunchIntentForPackage(activity.getPackageName());
var luanchIntent = launcherIntent.getComponent().flattenToString();
var curIntent = activity.getIntent();
var curIntentName = curIntent.getComponent().flattenToString();
if (curIntentName.equals(luanchIntent)) {
Mainintent = new Intent();
Mainintent.setClassName(activity, activityName);
activity.finish();
activity.startActivity(Mainintent);
console.log("Start New MainActivity");
}
});
}
function exe_start(){
var activityName = "tv.danmaku.bili.MainActivityV2";
// var activityName = "com.kugou.android.app.MediaActivity"
var activity = Java.use("android.app.Activity");
activity.onStart.implementation = function() {
console.log('onStart: ' + this);
var pm = this.getPackageManager();
// console.log("getPackageManager ", pm);
var launcherIntent = pm.getLaunchIntentForPackage(this.getPackageName());
var luanchIntentName = launcherIntent.getComponent().flattenToString();
// console.log("Fetch LaunchActivity ", launcherIntent);
var curIntent = this.getIntent();
// console.log("getIntent ", curIntent);
var curIntentName = curIntent.getComponent().flattenToString();
// console.log("curIntentName ", curIntentName, "luanchIntentName", luanchIntentName);
// console.log("equals: ", curIntentName==luanchIntentName);
if (curIntentName==luanchIntentName) {
console.log("enter in if condition");
var Mainintent = launcherIntent;
console.log("new Intent(): ",Mainintent);
Mainintent.setClassName(this, activityName);
console.log("Start New MainActivity mashang kaishi ", Mainintent);
this.finish();
this.startActivity(Mainintent);
console.log("Start New MainActivity");
}
this.onStart();
//public static void SomeClass.init(final Context var0)
SomeClass.init(this);
}
}
setImmediate(exe_start)