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

No Success with Digitales Amt v2.5.2 #2

Closed
SeriousM opened this issue Feb 21, 2023 · 2 comments
Closed

No Success with Digitales Amt v2.5.2 #2

SeriousM opened this issue Feb 21, 2023 · 2 comments

Comments

@SeriousM
Copy link

SeriousM commented Feb 21, 2023

Hi, I just tried so many ways to get the DA running, including your addon.
The DA is in version 2.5.2 but sadly it does complain about the detected rooting.
I found another addon that worked with the version 2.5.2: https://github.com/SapuSeven/Digitales-Amt-Integrity-Bypass
Maybe you want to adapt the solution?

The difference is that you're using (https://github.com/Crazyphil/digitales-amt-liberator/blob/main/app/src/main/java/it/kapfer/digitalesamt/liberator/ModuleMain.kt#L36)

XposedHelpers.findAndHookMethod(DEVICE_INTEGRITY_CHECK_CLASS, lpparam.classLoader, "checkIntegrity", XC_MethodReplacement.DO_NOTHING)

which ends up in the function implementation (https://github.com/LSPosed/LSPosed/blob/master/core/src/main/java/de/robv/android/xposed/XC_MethodReplacement.java#L82)

    public static final XC_MethodReplacement DO_NOTHING = new XC_MethodReplacement(PRIORITY_HIGHEST * 2) {
        @Override
        protected Object replaceHookedMethod(MethodHookParam param) throws Throwable {
            return null;
        }
    };

and @Crazyphil uses (https://github.com/SapuSeven/Digitales-Amt-Integrity-Bypass/blob/master/app/src/main/java/com/sapuseven/xposed/at/gv/oe/app/RootBypass.kt#L18)

            object : XC_MethodReplacement() {
                @Throws(Throwable::class)
                override fun replaceHookedMethod(param: MethodHookParam) {
                    param.result = null
                }
            })

Setting "para.result = null" seems to be the solution and in fact is probably a guard against the use of XC_MethodReplacement.DO_NOTHING.

@Crazyphil
Copy link
Owner

Thank you for your in-depth analysis. Unfortunately, I cannot reproduce the problems you're having. I also use Digitales Amt in version 2.5.2, and Digitales Amt Liberator version 1.1.0 does its job just fine.

Just to confirm, these are my settings:

Magisk is installed in version 25.2
magisk-version

The Digitales Amt app is not denylisted in Magisk
denylist

The Zygisk variant of LSPosed is installed in version 1.8.6 and enabled as a Magisk module
magisk-modules
lsposed

Digitales Amt Liberator is installed and enabled in LSPosed
lsposed-module

Digitales Amt Liberator is enabled for the Digitales Amt app
module-settings


Regarding your comments to the code: whether you return a value or directly set the result parameter of a replaced method doesn't matter. At least that is what I deduced from the Javadoc and behavior of the DO_NOTHING hook.

If you look into the API source, you'll see that setResult() does nothing more than preventing the call of the original method and setting the result field (which is already initialized with null from the beginning):

		public void setResult(Object result) {
			this.result = result;
			this.throwable = null;
			this.returnEarly = true;
		}

https://github.com/rovo89/XposedBridge/blob/a535c02ed9dfd53683cc0274d9f95bcb6ffb9f79/app/src/main/java/de/robv/android/xposed/XC_MethodHook.java#L96

The Javadoc confirms that it doesn't matter whether the result is set or simply returned for a replaced method:

	/**
	 * Shortcut for replacing a method completely. Whatever is returned/thrown here is taken
	 * instead of the result of the original method (which will not be called).
	 *
	 * <p>Note that implementations shouldn't call {@code super(param)}, it's not necessary.
	 *
	 * @param param Information about the method call.
	 * @throws Throwable Anything that is thrown by the callback will be passed on to the original caller.
	 */
	@SuppressWarnings("UnusedParameters")
	protected abstract Object replaceHookedMethod(MethodHookParam param) throws Throwable;

https://github.com/rovo89/XposedBridge/blob/a535c02ed9dfd53683cc0274d9f95bcb6ffb9f79/app/src/main/java/de/robv/android/xposed/XC_MethodReplacement.java#L51

@SeriousM
Copy link
Author

SeriousM commented Mar 2, 2023

Thank you for all the information!
I can confirm that all versions are exactly the same on my phone.
The only difference I spotted is that LSPosed's "Xposed API-Aufrufschutz" is deactivated in oposion to your activated state.

I'm afraid that I wont check out if your version may work anyway because I already setup DA with my personal id and I don't wont go through reset - resetup everything.

Regarding your comments to the code: whether you return a value or directly set the result parameter of a replaced method doesn't matter. At least that is what I deduced from the Javadoc and behavior of the DO_NOTHING hook.

What I wanted to point out, no matter if this makes the difference in successful patching, is that if the caller of the replaced method sets param.result to something known and expects that it doesn't get replaced with null, a null value would give away that that the method was actually replaced.

Anyway, I will close the issue and thank you very much for your investigation.

@SeriousM SeriousM closed this as completed Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants