Skip to content

Commit cca5a8b

Browse files
StarmaniaoSumAtrIX
andauthored
feat(Piccoma): Add Spoof Android device ID patch (#3145)
Co-authored-by: oSumAtrIX <[email protected]>
1 parent c09eaa5 commit cca5a8b

File tree

3 files changed

+81
-0
lines changed

3 files changed

+81
-0
lines changed

api/revanced-patches.api

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,12 @@ public final class app/revanced/patches/photomath/misc/unlock/plus/UnlockPlusPat
487487
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
488488
}
489489

490+
public final class app/revanced/patches/piccomafr/misc/SpoofAndroidDeviceIdPatch : app/revanced/patcher/patch/BytecodePatch {
491+
public static final field INSTANCE Lapp/revanced/patches/piccomafr/misc/SpoofAndroidDeviceIdPatch;
492+
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
493+
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
494+
}
495+
490496
public final class app/revanced/patches/piccomafr/tracking/DisableTrackingPatch : app/revanced/patcher/patch/BytecodePatch {
491497
public static final field INSTANCE Lapp/revanced/patches/piccomafr/tracking/DisableTrackingPatch;
492498
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
package app.revanced.patches.piccomafr.misc
2+
3+
import app.revanced.patcher.data.BytecodeContext
4+
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
5+
import app.revanced.patcher.patch.BytecodePatch
6+
import app.revanced.patcher.patch.annotation.CompatiblePackage
7+
import app.revanced.patcher.patch.annotation.Patch
8+
import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.stringPatchOption
9+
import app.revanced.patches.piccomafr.misc.fingerprints.GetAndroidIDFingerprint
10+
import app.revanced.util.exception
11+
12+
@Patch(
13+
name = "Spoof Android device ID",
14+
description = "Spoofs the Android device ID used by the app for account authentication." +
15+
"This can be used to copy the account to another device.",
16+
compatiblePackages = [
17+
CompatiblePackage(
18+
"com.piccomaeurope.fr",
19+
[
20+
"6.4.0",
21+
"6.4.1",
22+
"6.4.2",
23+
"6.4.3",
24+
"6.4.4",
25+
"6.4.5",
26+
"6.5.0",
27+
"6.5.1",
28+
"6.5.2",
29+
"6.5.3",
30+
"6.5.4",
31+
"6.6.0",
32+
"6.6.1",
33+
"6.6.2",
34+
],
35+
),
36+
],
37+
use = false,
38+
)
39+
@Suppress("unused")
40+
object SpoofAndroidDeviceIdPatch : BytecodePatch(
41+
setOf(GetAndroidIDFingerprint),
42+
) {
43+
private var androidDeviceId =
44+
stringPatchOption(
45+
key = "android-device-id",
46+
default = "0011223344556677",
47+
title = "Android device ID",
48+
description = "The Android device ID to spoof to.",
49+
required = true,
50+
) { it!!.matches("[A-Fa-f0-9]{16}".toRegex()) }
51+
52+
override fun execute(context: BytecodeContext) = GetAndroidIDFingerprint.result?.mutableMethod?.addInstructions(
53+
0,
54+
"""
55+
const-string v0, "$androidDeviceId"
56+
return-object v0
57+
""",
58+
) ?: throw GetAndroidIDFingerprint.exception
59+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package app.revanced.patches.piccomafr.misc.fingerprints
2+
3+
import app.revanced.patcher.extensions.or
4+
import app.revanced.patcher.fingerprint.MethodFingerprint
5+
import com.android.tools.smali.dexlib2.AccessFlags
6+
7+
8+
internal object GetAndroidIDFingerprint : MethodFingerprint(
9+
parameters = listOf("Landroid/content/Context"),
10+
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
11+
strings = listOf(
12+
"context",
13+
"android_id"
14+
),
15+
returnType = "Ljava/lang/String"
16+
)

0 commit comments

Comments
 (0)