Without recompiling the app, user are able to make the app debuggable using xposed to debug/heapdump the app
Is there any method (root or non root) to detect the app is currently:
or
or
Using
BuildConfig.DEBUGandApplicationInfo, and check the flags field forFLAG_DEBUGGABLEdoesn't works since the app started by zygote with debug flag directly
Below is the code that hook the process class
    try {
        Method start = Process.class.getMethod(
                "start", String.class, String.class, Integer.TYPE, Integer.TYPE, int[].class,
                Integer.TYPE, Integer.TYPE, Integer.TYPE, String.class, String[].class);
        XposedBridge.log("start hook, appInfo: " + loadPackageParam.appInfo);
        XposedBridge.hookMethod(start, new XC_MethodHook() {
            @Override
            protected void beforeHookedMethod(MethodHookParam methodHookParam) throws Throwable {
                    int id = 5;
                    int flags = (Integer) methodHookParam.args[id];
                    if ((flags & 0x1) == 0) {
                        flags |= 0x1;
                    }
                    methodHookParam.args[id] = flags;
                    }
            }
        });
    } catch (NoSuchMethodException e) {
        e.printStackTrace();
    }

boolean isConnected = new Debug().isDebuggerConnected();
Determine if a debugger is currently attached. Documentation of Debug class
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With