forked from ReVanced/revanced-patches
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Piccoma): Add
Disable tracking
patch (ReVanced#3143)
Co-authored-by: oSumAtrIX <[email protected]>
- Loading branch information
Showing
5 changed files
with
129 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
src/main/kotlin/app/revanced/patches/piccomafr/tracking/DisableTrackingPatch.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
package app.revanced.patches.piccomafr.tracking | ||
|
||
import app.revanced.patcher.data.BytecodeContext | ||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction | ||
import app.revanced.patcher.extensions.InstructionExtensions.getInstructions | ||
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction | ||
import app.revanced.patcher.patch.BytecodePatch | ||
import app.revanced.patcher.patch.annotation.CompatiblePackage | ||
import app.revanced.patcher.patch.annotation.Patch | ||
import app.revanced.patches.piccomafr.tracking.fingerprints.AppMesurementFingerprint | ||
import app.revanced.patches.piccomafr.tracking.fingerprints.FacebookSDKFingerprint | ||
import app.revanced.patches.piccomafr.tracking.fingerprints.FirebaseInstallFingerprint | ||
import app.revanced.util.exception | ||
import app.revanced.util.getReference | ||
import com.android.tools.smali.dexlib2.Opcode | ||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction | ||
import com.android.tools.smali.dexlib2.iface.reference.StringReference | ||
|
||
@Patch( | ||
name = "Disable tracking", | ||
description = "Disables tracking by replacing tracking URLs with example.com.", | ||
compatiblePackages = [ | ||
CompatiblePackage( | ||
"com.piccomaeurope.fr", | ||
[ | ||
"6.4.0", | ||
"6.4.1", | ||
"6.4.2", | ||
"6.4.3", | ||
"6.4.4", | ||
"6.4.5", | ||
"6.5.0", | ||
"6.5.1", | ||
"6.5.2", | ||
"6.5.3", | ||
"6.5.4", | ||
"6.6.0", | ||
"6.6.1", | ||
"6.6.2", | ||
], | ||
), | ||
], | ||
) | ||
@Suppress("unused") | ||
object DisableTrackingPatch : BytecodePatch( | ||
setOf(FacebookSDKFingerprint, FirebaseInstallFingerprint, AppMesurementFingerprint), | ||
) { | ||
override fun execute(context: BytecodeContext) { | ||
FacebookSDKFingerprint.result?.mutableMethod?.apply { | ||
getInstructions().filter { instruction -> | ||
instruction.opcode == Opcode.CONST_STRING | ||
}.forEach { instruction -> | ||
instruction as OneRegisterInstruction | ||
|
||
replaceInstruction( | ||
instruction.location.index, | ||
"const-string v${instruction.registerA}, \"example.com\"", | ||
) | ||
} | ||
} ?: throw FacebookSDKFingerprint.exception | ||
|
||
FirebaseInstallFingerprint.result?.mutableMethod?.apply { | ||
getInstructions().filter { | ||
it.opcode == Opcode.CONST_STRING | ||
}.filter { | ||
it.getReference<StringReference>()?.string == "firebaseinstallations.googleapis.com" | ||
}.forEach { instruction -> | ||
instruction as OneRegisterInstruction | ||
|
||
replaceInstruction( | ||
instruction.location.index, | ||
"const-string v${instruction.registerA}, \"example.com\"", | ||
) | ||
} | ||
} ?: throw FirebaseInstallFingerprint.exception | ||
|
||
AppMesurementFingerprint.result?.mutableMethod?.addInstruction(0, "return-void") | ||
?: throw AppMesurementFingerprint.exception | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...n/kotlin/app/revanced/patches/piccomafr/tracking/fingerprints/AppMesurementFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package app.revanced.patches.piccomafr.tracking.fingerprints | ||
|
||
import app.revanced.patcher.extensions.or | ||
import app.revanced.patcher.fingerprint.MethodFingerprint | ||
import com.android.tools.smali.dexlib2.AccessFlags | ||
|
||
|
||
internal object AppMesurementFingerprint : MethodFingerprint( | ||
accessFlags = AccessFlags.PRIVATE or AccessFlags.FINAL, | ||
strings = listOf( | ||
"config/app/", | ||
"Fetching remote configuration" | ||
), | ||
returnType = "V" | ||
) |
15 changes: 15 additions & 0 deletions
15
...ain/kotlin/app/revanced/patches/piccomafr/tracking/fingerprints/FacebookSDKFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package app.revanced.patches.piccomafr.tracking.fingerprints | ||
|
||
import app.revanced.patcher.extensions.or | ||
import app.revanced.patcher.fingerprint.MethodFingerprint | ||
import com.android.tools.smali.dexlib2.AccessFlags | ||
|
||
|
||
internal object FacebookSDKFingerprint : MethodFingerprint( | ||
accessFlags = AccessFlags.STATIC or AccessFlags.CONSTRUCTOR, | ||
strings = listOf( | ||
"instagram.com", | ||
"facebook.com" | ||
), | ||
returnType = "V" | ||
) |
13 changes: 13 additions & 0 deletions
13
...kotlin/app/revanced/patches/piccomafr/tracking/fingerprints/FirebaseInstallFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package app.revanced.patches.piccomafr.tracking.fingerprints | ||
|
||
import app.revanced.patcher.fingerprint.MethodFingerprint | ||
import com.android.tools.smali.dexlib2.AccessFlags | ||
|
||
|
||
internal object FirebaseInstallFingerprint : MethodFingerprint( | ||
accessFlags = AccessFlags.PRIVATE.value, | ||
strings = listOf( | ||
"https://%s/%s/%s", | ||
"firebaseinstallations.googleapis.com" | ||
) | ||
) |