Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unhook classloader hook after used #1064

Merged
merged 2 commits into from
Dec 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,28 @@
import de.robv.android.xposed.XposedHelpers;

public class AntiQues extends BaseHook {
XC_MethodHook.Unhook clHook;

@Override
public void init() throws NoSuchMethodException {
XposedHelpers.findAndHookMethod("com.android.server.SystemServiceManager", lpparam.classLoader,
clHook = XposedHelpers.findAndHookMethod("com.android.server.SystemServiceManager", lpparam.classLoader,
"loadClassFromLoader", String.class, ClassLoader.class, new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
protected void beforeHookedMethod(MethodHookParam param) {
try {
String clzName = (String) param.args[0];
ClassLoader cl = (ClassLoader) param.args[1];
if (clzName.equals("com.android.server.wifi.WifiService")) {
XposedHelpers.findAndHookMethod("com.android.server.wifi.Utils", cl, "checkDeviceNameIsIllegalSync", Context.class, int.class, String.class,
new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
protected void beforeHookedMethod(MethodHookParam param) {
param.setResult(false);
}
});
clHook.unhook();
}
} catch (Throwable t) {
} catch (Throwable ignored) {
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@

public class FlightModeHotSpot implements IXposedHookLoadPackage {

XC_MethodHook.Unhook clHook;

@Override
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {
if (lpparam.packageName.equals("android")) {
try {
XposedHelpers.findAndHookMethod("com.android.server.SystemServiceManager", lpparam.classLoader,
clHook = XposedHelpers.findAndHookMethod("com.android.server.SystemServiceManager", lpparam.classLoader,
"loadClassFromLoader", String.class, ClassLoader.class, new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
Expand All @@ -51,6 +53,7 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
param.setResult(false);
}
});
clHook.unhook();
}
} catch (Throwable t) {
XposedBridge.log("[FlightModeHotSpot]:Hook MiuiWifiApManager Failed, the reason is=" + Objects.requireNonNull(t.getCause()) +
Expand Down
Loading