Skip to content

Commit 42d2c27

Browse files
feat: Add Disable pairip license check patch (#4927)
Co-authored-by: LisoUseInAIKyrios <[email protected]>
1 parent 54f0e85 commit 42d2c27

File tree

6 files changed

+279
-26
lines changed

6 files changed

+279
-26
lines changed

patches/api/patches.api

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,10 @@ public final class app/revanced/patches/shared/misc/mapping/ResourceMappingPatch
652652
public static final fun getResourceMappings ()Ljava/util/List;
653653
}
654654

655+
public final class app/revanced/patches/shared/misc/pairip/license/DisableLicenseCheckPatchKt {
656+
public static final fun getDisableLicenseCheckPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
657+
}
658+
655659
public final class app/revanced/patches/shared/misc/settings/SettingsPatchKt {
656660
public static final fun settingsPatch (Ljava/util/List;Ljava/util/Set;)Lapp/revanced/patcher/patch/ResourcePatch;
657661
public static final fun settingsPatch (Lkotlin/Pair;Ljava/util/Set;)Lapp/revanced/patcher/patch/ResourcePatch;
@@ -1615,8 +1619,24 @@ public final class app/revanced/util/BytecodeUtilsKt {
16151619
public static final fun indexOfFirstResourceIdOrThrow (Lcom/android/tools/smali/dexlib2/iface/Method;Ljava/lang/String;)I
16161620
public static final fun injectHideViewCall (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;IILjava/lang/String;Ljava/lang/String;)V
16171621
public static final fun literal (Lapp/revanced/patcher/FingerprintBuilder;Lkotlin/jvm/functions/Function0;)V
1622+
public static final fun returnEarly (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;B)V
1623+
public static final fun returnEarly (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;C)V
1624+
public static final fun returnEarly (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;D)V
1625+
public static final fun returnEarly (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;F)V
1626+
public static final fun returnEarly (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;I)V
1627+
public static final fun returnEarly (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;J)V
1628+
public static final fun returnEarly (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;S)V
16181629
public static final fun returnEarly (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;Z)V
16191630
public static synthetic fun returnEarly$default (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;ZILjava/lang/Object;)V
1631+
public static final fun returnLate (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;B)V
1632+
public static final fun returnLate (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;C)V
1633+
public static final fun returnLate (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;D)V
1634+
public static final fun returnLate (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;F)V
1635+
public static final fun returnLate (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;I)V
1636+
public static final fun returnLate (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;J)V
1637+
public static final fun returnLate (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;S)V
1638+
public static final fun returnLate (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;Z)V
1639+
public static synthetic fun returnLate$default (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;ZILjava/lang/Object;)V
16201640
public static final fun transformMethods (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableClass;Lkotlin/jvm/functions/Function1;)V
16211641
public static final fun traverseClassHierarchy (Lapp/revanced/patcher/patch/BytecodePatchContext;Lapp/revanced/patcher/util/proxy/mutableTypes/MutableClass;Lkotlin/jvm/functions/Function1;)V
16221642
}
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
package app.revanced.patches.angulus.ads
22

33
import app.revanced.patcher.patch.bytecodePatch
4+
import app.revanced.patches.shared.misc.pairip.license.disableLicenseCheckPatch
45
import app.revanced.util.returnEarly
56

67
@Suppress("unused")
78
val angulusPatch = bytecodePatch(name = "Hide ads") {
89
compatibleWith("com.drinkplusplus.angulus")
910

11+
dependsOn(disableLicenseCheckPatch)
12+
1013
execute {
1114
// Always return 0 as the daily measurement count.
12-
getDailyMeasurementCountFingerprint.method.returnEarly()
15+
getDailyMeasurementCountFingerprint.method.returnEarly(0)
1316
}
1417
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package app.revanced.patches.shared.misc.pairip.license
2+
3+
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
4+
import app.revanced.patcher.patch.bytecodePatch
5+
import app.revanced.util.returnEarly
6+
import java.util.logging.Logger
7+
8+
@Suppress("unused")
9+
val disableLicenseCheckPatch = bytecodePatch(
10+
name = "Disable pairip license check",
11+
description = "Disable Play Integrity Protect (pairip) client-side license check."
12+
) {
13+
14+
execute {
15+
if (processLicenseResponseFingerprint.methodOrNull == null || validateLicenseResponseFingerprint.methodOrNull == null)
16+
return@execute Logger.getLogger(this::class.java.name)
17+
.warning("Could not find pairip licensing check. No changes applied.")
18+
19+
// Set first parameter (responseCode) to 0 (success status).
20+
processLicenseResponseFingerprint.method.addInstruction(0, "const/4 p1, 0x0")
21+
22+
// Short-circuit the license response validation.
23+
validateLicenseResponseFingerprint.method.returnEarly();
24+
25+
}
26+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package app.revanced.patches.shared.misc.pairip.license
2+
3+
import app.revanced.patcher.fingerprint
4+
5+
internal val processLicenseResponseFingerprint = fingerprint {
6+
custom { method, classDef ->
7+
classDef.type == "Lcom/pairip/licensecheck/LicenseClient;" &&
8+
method.name == "processResponse"
9+
}
10+
}
11+
12+
internal val validateLicenseResponseFingerprint = fingerprint {
13+
custom { method, classDef ->
14+
classDef.type == "Lcom/pairip/licensecheck/ResponseValidator;" &&
15+
method.name == "validateResponse"
16+
}
17+
}

0 commit comments

Comments
 (0)