-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6c7bdd9
commit c1941ea
Showing
9 changed files
with
125 additions
and
39 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,18 @@ | ||
package xyz.hellocraft.portalhook; | ||
|
||
import android.content.Intent; | ||
import android.net.Uri; | ||
|
||
import de.robv.android.xposed.IXposedHookLoadPackage; | ||
import de.robv.android.xposed.XC_MethodReplacement; | ||
import de.robv.android.xposed.XposedBridge; | ||
import de.robv.android.xposed.XposedHelpers; | ||
import de.robv.android.xposed.callbacks.XC_LoadPackage; | ||
import xyz.hellocraft.portalhook.hook.PortalHook; | ||
import xyz.hellocraft.portalhook.hook.XiaoAiHook; | ||
|
||
public class MainHook implements IXposedHookLoadPackage { | ||
@Override | ||
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable { | ||
if(!lpparam.packageName.equals("com.miui.contentextension")) return; | ||
XposedBridge.log("Hook到传送门进程!"); | ||
final Class<?> clazz = XposedHelpers.findClass("com.miui.contentextension.utils.AppsUtils", lpparam.classLoader); | ||
//getClassInfo(clazz); | ||
|
||
XposedHelpers.findAndHookMethod(clazz, "getIntentWithBrowser", String.class, new XC_MethodReplacement() { | ||
@Override | ||
protected Object replaceHookedMethod(MethodHookParam param) throws Throwable { | ||
XposedBridge.log("Hook到方法,目标URL:"+param.args[0].toString()); | ||
Uri uri = Uri.parse(param.args[0].toString()); | ||
Intent intent = new Intent(); | ||
intent.setAction("android.intent.action.VIEW"); | ||
intent.setData(uri); | ||
return intent; | ||
} | ||
}); | ||
|
||
switch (lpparam.packageName) { | ||
case "com.miui.contentextension": | ||
new PortalHook(lpparam); | ||
case "com.miui.voiceassist": | ||
new XiaoAiHook(lpparam); | ||
} | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
app/src/main/java/xyz/hellocraft/portalhook/hook/PortalHook.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package xyz.hellocraft.portalhook.hook; | ||
|
||
import android.content.Intent; | ||
import android.net.Uri; | ||
|
||
import de.robv.android.xposed.XC_MethodReplacement; | ||
import de.robv.android.xposed.XposedBridge; | ||
import de.robv.android.xposed.XposedHelpers; | ||
import de.robv.android.xposed.callbacks.XC_LoadPackage; | ||
|
||
public class PortalHook { | ||
|
||
public PortalHook(XC_LoadPackage.LoadPackageParam lpparam) { | ||
XposedBridge.log("Hook到传送门进程!"); | ||
final Class<?> clazz = XposedHelpers.findClass("com.miui.contentextension.utils.AppsUtils", lpparam.classLoader); | ||
//getClassInfo(clazz); | ||
|
||
XposedHelpers.findAndHookMethod(clazz, "getIntentWithBrowser", String.class, new XC_MethodReplacement() { | ||
@Override | ||
protected Object replaceHookedMethod(MethodHookParam param) throws Throwable { | ||
XposedBridge.log("Hook到方法,目标URL:"+param.args[0].toString()); | ||
Uri uri = Uri.parse(param.args[0].toString()); | ||
Intent intent = new Intent(); | ||
intent.setAction("android.intent.action.VIEW"); | ||
intent.setData(uri); | ||
return intent; | ||
} | ||
}); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
app/src/main/java/xyz/hellocraft/portalhook/hook/XiaoAiHook.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package xyz.hellocraft.portalhook.hook; | ||
|
||
import android.content.Intent; | ||
import android.net.Uri; | ||
|
||
import de.robv.android.xposed.XC_MethodHook; | ||
import de.robv.android.xposed.XposedBridge; | ||
import de.robv.android.xposed.XposedHelpers; | ||
import de.robv.android.xposed.callbacks.XC_LoadPackage; | ||
|
||
public class XiaoAiHook { | ||
public XiaoAiHook(XC_LoadPackage.LoadPackageParam lpparam) { | ||
|
||
XposedBridge.log("Hook到小爱同学进程!"); | ||
try { | ||
Class<?> clazz = XposedHelpers.findClass("e.D.L.pa.Wa", lpparam.classLoader); | ||
XposedHelpers.findAndHookMethod(clazz,"startActivityWithIntent", Intent.class, boolean.class,int.class, new XC_MethodHook() { | ||
@Override | ||
protected void beforeHookedMethod(MethodHookParam param) throws Throwable { | ||
super.beforeHookedMethod(param); | ||
XposedBridge.log("0)Hook到Activity启动,开始判断"); | ||
Intent intent = (Intent) param.args[0]; | ||
XposedBridge.log(intent.toString()); | ||
try { | ||
if (intent.getPackage().equals("com.android.browser")) { | ||
XposedBridge.log("发现浏览器目标 Intent!"); | ||
XposedBridge.log("目标URL:" + intent.getDataString()); | ||
Uri uri = Uri.parse(intent.getDataString()); | ||
Intent newIntent = new Intent(); | ||
newIntent.setAction("android.intent.action.VIEW"); | ||
newIntent.setData(uri); | ||
param.args[0] = newIntent; | ||
} | ||
} catch (Exception e) { | ||
XposedBridge.log(e); | ||
} | ||
} | ||
}); | ||
} catch (Exception e) { | ||
XposedBridge.log(e); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters