build(Needs bump): Bump dependencies (#2946)

Co-authored-by: Ushie <ushiekane@gmail.com>
Co-authored-by: aAbed <aabedhkhan@gmail.com>
Co-authored-by: CnC-Robert <CnC.Rob3rt@gmail.com>
This commit is contained in:
oSumAtrIX 2023-09-20 05:33:02 +02:00
parent 487e7f2fa6
commit aeb5299ca5
No known key found for this signature in database
GPG key ID: A9B3094ACDB604B4
445 changed files with 4668 additions and 5477 deletions

View file

@ -1,5 +1,6 @@
plugins { plugins {
kotlin("jvm") version "1.8.20" kotlin("jvm") version "1.8.20"
alias(libs.plugins.ksp)
} }
group = "app.revanced" group = "app.revanced"
@ -25,16 +26,17 @@ repositories {
} }
dependencies { dependencies {
implementation("app.revanced:revanced-patcher:14.2.1") implementation(libs.revanced.patcher)
implementation("com.android.tools.smali:smali:3.0.3") implementation(libs.smali)
// Required because build fails without it. implementation(libs.revanced.patch.annotation.processor)
// TODO: Find a way to remove this dependency. // TODO: Required because build fails without it. Find a way to remove this dependency.
implementation("com.google.guava:guava:32.1.2-jre") implementation(libs.guava)
// Used in JsonGenerator. // Used in JsonGenerator.
implementation("com.google.code.gson:gson:2.10.1") implementation(libs.gson)
// A dependency to the Android library unfortunately fails the build, // A dependency to the Android library unfortunately fails the build, which is why this is required.
// which is why this is required for the patch change-oauth-client-id.
compileOnly(project("dummy")) compileOnly(project("dummy"))
ksp(libs.revanced.patch.annotation.processor)
} }
kotlin { kotlin {
@ -63,6 +65,7 @@ tasks {
} }
} }
} }
register<JavaExec>("generateMeta") { register<JavaExec>("generateMeta") {
description = "Generate metadata for this bundle" description = "Generate metadata for this bundle"
dependsOn(build) dependsOn(build)
@ -70,6 +73,7 @@ tasks {
classpath = sourceSets["main"].runtimeClasspath classpath = sourceSets["main"].runtimeClasspath
mainClass.set("app.revanced.meta.PatchesFileGenerator") mainClass.set("app.revanced.meta.PatchesFileGenerator")
} }
// Dummy task to fix the Gradle semantic-release plugin. // Dummy task to fix the Gradle semantic-release plugin.
// Remove this if you forked it to support building only. // Remove this if you forked it to support building only.
// Tracking issue: https://github.com/KengoTODA/gradle-semantic-release-plugin/issues/435 // Tracking issue: https://github.com/KengoTODA/gradle-semantic-release-plugin/issues/435

17
gradle/libs.versions.toml Normal file
View file

@ -0,0 +1,17 @@
[versions]
revanced-patcher = "15.0.1"
revanced-patch-annotation-processor = "15.0.1"
ksp = "1.9.0-1.0.11"
smali = "3.0.3"
guava = "32.1.2-jre"
gson = "2.10.1"
[libraries]
revanced-patcher = { module = "app.revanced:revanced-patcher", version.ref = "revanced-patcher" }
revanced-patch-annotation-processor = { module = "app.revanced:revanced-patch-annotation-processor", version.ref = "revanced-patch-annotation-processor" }
smali = { module = "com.android.tools.smali:smali", version.ref = "smali" }
guava = { module = "com.google.guava:guava", version.ref = "guava" }
gson = { module = "com.google.code.gson:gson", version.ref = "gson" }
[plugins]
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }

View file

@ -2,12 +2,11 @@ package app.revanced.extensions
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.MethodFingerprintExtensions.name
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.patch.PatchException import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.util.proxy.mutableTypes.MutableClass import app.revanced.patcher.util.proxy.mutableTypes.MutableClass
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch import app.revanced.patches.shared.mapping.misc.ResourceMappingPatch
import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.iface.Method import com.android.tools.smali.dexlib2.iface.Method
import com.android.tools.smali.dexlib2.iface.instruction.WideLiteralInstruction import com.android.tools.smali.dexlib2.iface.instruction.WideLiteralInstruction
@ -20,7 +19,7 @@ import org.w3c.dom.Node
* @return The [PatchException]. * @return The [PatchException].
*/ */
val MethodFingerprint.exception val MethodFingerprint.exception
get() = PatchException("Failed to resolve $name") get() = PatchException("Failed to resolve ${this.javaClass.simpleName}")
/** /**
* Find the [MutableMethod] from a given [Method] in a [MutableClass]. * Find the [MutableMethod] from a given [Method] in a [MutableClass].
@ -77,22 +76,21 @@ fun Method.findIndexForIdResource(resourceName: String): Int {
* *
* @return the first constant instruction with the value, or -1 if not found. * @return the first constant instruction with the value, or -1 if not found.
*/ */
fun Method.indexOfFirstConstantInstructionValue(constantValue: Long): Int { fun Method.indexOfFirstConstantInstructionValue(constantValue: Long) = implementation?.let {
return implementation?.let {
it.instructions.indexOfFirst { instruction -> it.instructions.indexOfFirst { instruction ->
instruction.opcode == Opcode.CONST && (instruction as WideLiteralInstruction).wideLiteral == constantValue instruction.opcode == Opcode.CONST && (instruction as WideLiteralInstruction).wideLiteral == constantValue
} }
} ?: -1 } ?: -1
}
/** /**
* Check if the method contains a constant with the given value. * Check if the method contains a constant with the given value.
* *
* @return if the method contains a constant with the given value. * @return if the method contains a constant with the given value.
*/ */
fun Method.containsConstantInstructionValue(constantValue: Long): Boolean { fun Method.containsConstantInstructionValue(constantValue: Long) =
return indexOfFirstConstantInstructionValue(constantValue) >= 0 indexOfFirstConstantInstructionValue(constantValue) >= 0
}
/** /**
* Traverse the class hierarchy starting from the given root class. * Traverse the class hierarchy starting from the given root class.

View file

@ -1,67 +1,43 @@
package app.revanced.meta package app.revanced.meta
import app.revanced.patcher.extensions.PatchExtensions.compatiblePackages import app.revanced.patcher.PatchSet
import app.revanced.patcher.extensions.PatchExtensions.dependencies import app.revanced.patcher.patch.Patch
import app.revanced.patcher.extensions.PatchExtensions.description
import app.revanced.patcher.extensions.PatchExtensions.include
import app.revanced.patcher.extensions.PatchExtensions.options
import app.revanced.patcher.extensions.PatchExtensions.patchName
import app.revanced.patcher.patch.PatchOption
import com.google.gson.GsonBuilder import com.google.gson.GsonBuilder
import java.io.File import java.io.File
internal class JsonGenerator : PatchesFileGenerator { internal class JsonGenerator : PatchesFileGenerator {
override fun generate(bundle: PatchBundlePatches) { override fun generate(patches: PatchSet) = patches.map {
val patches = bundle.map {
JsonPatch( JsonPatch(
it.patchName, it.name!!,
it.description ?: "This patch has no description.", it.description,
!it.include, it.compatiblePackages,
it.options?.map { option -> it.dependencies?.map { dependency -> dependency::class.java.name }?.toSet(),
JsonPatch.Option( it.use,
option.key, it.requiresIntegrations,
option.title, it.options.values.map { option ->
option.description, JsonPatch.Option(option.key, option.value, option.title, option.description, option.required)
option.required,
option.let { listOption ->
if (listOption is PatchOption.ListOption<*>) {
listOption.options.toMutableList().toTypedArray()
} else null
} }
) )
}?.toTypedArray() ?: emptyArray(), }.let {
it.dependencies?.map { dep -> File("patches.json").writeText(GsonBuilder().serializeNulls().create().toJson(it))
dep.java.patchName
}?.toTypedArray() ?: emptyArray(),
it.compatiblePackages?.map { pkg ->
JsonPatch.CompatiblePackage(pkg.name, pkg.versions)
}?.toTypedArray() ?: emptyArray()
)
}
val json = File("patches.json")
json.writeText(GsonBuilder().serializeNulls().create().toJson(patches))
} }
@Suppress("unused")
private class JsonPatch( private class JsonPatch(
val name: String, val name: String? = null,
val description: String, val description: String? = null,
val excluded: Boolean, val compatiblePackages: Set<Patch.CompatiblePackage>? = null,
val options: Array<Option>, val dependencies: Set<String>? = null,
val dependencies: Array<String>, val use: Boolean = true,
val compatiblePackages: Array<CompatiblePackage>, val requiresIntegrations: Boolean = false,
val options: List<Option>
) { ) {
class CompatiblePackage(
val name: String,
val versions: Array<String>,
)
class Option( class Option(
val key: String, val key: String,
val title: String, val default: Any?,
val description: String, val title: String?,
val description: String?,
val required: Boolean, val required: Boolean,
val choices: Array<*>?,
) )
} }
} }

View file

@ -1,13 +1,11 @@
package app.revanced.meta package app.revanced.meta
import app.revanced.patcher.PatchBundleLoader import app.revanced.patcher.PatchBundleLoader
import app.revanced.patcher.patch.PatchClass import app.revanced.patcher.PatchSet
import java.io.File import java.io.File
internal typealias PatchBundlePatches = List<PatchClass>
internal interface PatchesFileGenerator { internal interface PatchesFileGenerator {
fun generate(bundle: PatchBundlePatches) fun generate(patches: PatchSet)
private companion object { private companion object {
@JvmStatic @JvmStatic

View file

@ -1,15 +1,17 @@
package app.revanced.patches.all.activity.exportall.patch package app.revanced.patches.all.activity.exportall
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.ResourceContext import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotation.Patch
@Patch(false) @Patch(
@Name("Export all activities") name = "Export all activities",
@Description("Makes all app activities exportable.") description = "Makes all app activities exportable.",
class ExportAllActivitiesPatch : ResourcePatch { use = false
)
@Suppress("unused")
object ExportAllActivitiesPatch : ResourcePatch() {
private const val EXPORTED_FLAG = "android:exported"
override fun execute(context: ResourceContext) { override fun execute(context: ResourceContext) {
context.xmlEditor["AndroidManifest.xml"].use { editor -> context.xmlEditor["AndroidManifest.xml"].use { editor ->
val document = editor.file val document = editor.file
@ -32,8 +34,4 @@ class ExportAllActivitiesPatch : ResourcePatch {
} }
} }
} }
private companion object {
const val EXPORTED_FLAG = "android:exported"
}
} }

View file

@ -1,27 +1,44 @@
package app.revanced.patches.all.connectivity.wifi.spoof.patch package app.revanced.patches.all.connectivity.wifi.spoof
import app.revanced.patcher.annotation.Description import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.annotations.RequiresIntegrations
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.util.patch.* import app.revanced.util.patch.AbstractTransformInstructionsPatch
import app.revanced.util.patch.IMethodCall
import app.revanced.util.patch.Instruction35cInfo
import app.revanced.util.patch.filterMapInstruction35c
import com.android.tools.smali.dexlib2.iface.ClassDef import com.android.tools.smali.dexlib2.iface.ClassDef
import com.android.tools.smali.dexlib2.iface.Method import com.android.tools.smali.dexlib2.iface.Method
import com.android.tools.smali.dexlib2.iface.instruction.Instruction import com.android.tools.smali.dexlib2.iface.instruction.Instruction
import java.util.*
@Patch(false) @Patch(
@Name("Spoof wifi connection") name = "Spoof Wi-Fi connection",
@Description("Spoofs an existing Wi-Fi connection.") description = "Spoofs an existing Wi-Fi connection.",
@RequiresIntegrations use = false,
class SpoofWifiPatch : AbstractTransformInstructionsPatch<Instruction35cInfo>() { requiresIntegrations = true
)
@Suppress("unused")
object SpoofWifiPatch : AbstractTransformInstructionsPatch<Instruction35cInfo>() {
private const val INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX = "Lapp/revanced/all/connectivity/wifi/spoof/SpoofWifiPatch"
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "$INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX;"
private companion object { override fun filterMap(
const val INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX = "Lapp/revanced/all/connectivity/wifi/spoof/SpoofWifiPatch" classDef: ClassDef,
const val INTEGRATIONS_CLASS_DESCRIPTOR = "${INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX};" method: Method,
instruction: Instruction,
instructionIndex: Int
) = filterMapInstruction35c<MethodCall>(
INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX,
classDef,
instruction,
instructionIndex
)
override fun transform(mutableMethod: MutableMethod, entry: Instruction35cInfo) {
val (methodType, instruction, instructionIndex) = entry
methodType.replaceInvokeVirtualWithIntegrations(INTEGRATIONS_CLASS_DESCRIPTOR, mutableMethod, instruction, instructionIndex)
} }
// Information about method calls we want to replace // Information about method calls we want to replace
enum class MethodCall( enum class MethodCall(
override val definedClassName: String, override val definedClassName: String,
@ -186,21 +203,4 @@ class SpoofWifiPatch : AbstractTransformInstructionsPatch<Instruction35cInfo>()
"V", "V",
); );
} }
override fun filterMap(
classDef: ClassDef,
method: Method,
instruction: Instruction,
instructionIndex: Int
) = filterMapInstruction35c<MethodCall>(
INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX,
classDef,
instruction,
instructionIndex
)
override fun transform(mutableMethod: MutableMethod, entry: Instruction35cInfo) {
val (methodType, instruction, instructionIndex) = entry
methodType.replaceInvokeVirtualWithIntegrations(INTEGRATIONS_CLASS_DESCRIPTOR, mutableMethod, instruction, instructionIndex)
}
} }

View file

@ -1,15 +1,18 @@
package app.revanced.patches.all.interaction.gestures.patch package app.revanced.patches.all.interaction.gestures
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.ResourceContext import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotation.Patch
@Patch(
name = "Predictive back gesture",
description = "Enables the predictive back gesture introduced on Android 13.",
use = false
)
@Suppress("unused")
object PredictiveBackGesturePatch : ResourcePatch() {
private const val FLAG = "android:enableOnBackInvokedCallback"
@Patch(false)
@Name("Predictive back gesture")
@Description("Enables the predictive back gesture introduced on Android 13.")
class PredictiveBackGesturePatch : ResourcePatch {
override fun execute(context: ResourceContext) { override fun execute(context: ResourceContext) {
context.xmlEditor["AndroidManifest.xml"].use { editor -> context.xmlEditor["AndroidManifest.xml"].use { editor ->
val document = editor.file val document = editor.file
@ -20,12 +23,7 @@ class PredictiveBackGesturePatch : ResourcePatch {
document.createAttribute(FLAG) document.createAttribute(FLAG)
.apply { value = "true" } .apply { value = "true" }
.let(attributes::setNamedItem) .let(attributes::setNamedItem)
} }
} }
} }
private companion object {
const val FLAG = "android:enableOnBackInvokedCallback"
}
} }

View file

@ -1,16 +1,17 @@
package app.revanced.patches.all.misc.debugging.patch package app.revanced.patches.all.misc.debugging
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.ResourceContext import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.* import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotation.Patch
import org.w3c.dom.Element import org.w3c.dom.Element
@Patch(false) @Patch(
@Name("Enable android debugging") name = "Enable Android debugging",
@Description("Enables Android debugging capabilities. This can slow down the app.") description = "Enables Android debugging capabilities. This can slow down the app.",
class EnableAndroidDebuggingPatch : ResourcePatch { use = false
)
@Suppress("unused")
object EnableAndroidDebuggingPatch : ResourcePatch() {
override fun execute(context: ResourceContext) { override fun execute(context: ResourceContext) {
context.xmlEditor["AndroidManifest.xml"].use { dom -> context.xmlEditor["AndroidManifest.xml"].use { dom ->
val applicationNode = dom val applicationNode = dom
@ -22,5 +23,4 @@ class EnableAndroidDebuggingPatch : ResourcePatch {
applicationNode.setAttribute("android:debuggable", "true") applicationNode.setAttribute("android:debuggable", "true")
} }
} }
} }

View file

@ -1,20 +1,20 @@
package app.revanced.patches.all.misc.network.patch package app.revanced.patches.all.misc.network
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.ResourceContext import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patches.all.misc.debugging.EnableAndroidDebuggingPatch
import app.revanced.patches.all.misc.debugging.patch.EnableAndroidDebuggingPatch
import org.w3c.dom.Element import org.w3c.dom.Element
import java.io.File import java.io.File
@Patch(false) @Patch(
@Name("Override certificate pinning") name = "Override certificate pinning",
@Description("Overrides certificate pinning, allowing to inspect traffic via a proxy.") description = "Overrides certificate pinning, allowing to inspect traffic via a proxy.",
@DependsOn([EnableAndroidDebuggingPatch::class]) dependencies = [EnableAndroidDebuggingPatch::class],
class OverrideCertificatePinningPatch : ResourcePatch { use = false
)
@Suppress("unused")
object OverrideCertificatePinningPatch : ResourcePatch() {
override fun execute(context: ResourceContext) { override fun execute(context: ResourceContext) {
val resXmlDirectory = context["res/xml"] val resXmlDirectory = context["res/xml"]

View file

@ -1,16 +1,26 @@
package app.revanced.patches.all.misc.packagename.patch package app.revanced.patches.all.misc.packagename
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.ResourceContext import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.* import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patcher.patch.options.types.StringPatchOption.Companion.stringPatchOption
import org.w3c.dom.Element import org.w3c.dom.Element
@Patch(false) @Patch(
@Name("Change package name") name = "Change package name",
@Description("Changes the package name. Appends \".revanced\" to the package name by default.") description = "Appends \".revanced\" to the package name by default.",
class ChangePackageNamePatch : ResourcePatch { use = false
)
@Suppress("unused")
object ChangePackageNamePatch : ResourcePatch() {
private var packageName by stringPatchOption(
key = "packageName",
default = null,
title = "Package name",
description = "The name of the package to rename the app to.",
)
override fun execute(context: ResourceContext) { override fun execute(context: ResourceContext) {
val packageNameToUse = packageName ?: getDefaultPackageName(context) val packageNameToUse = packageName ?: getDefaultPackageName(context)
@ -36,15 +46,4 @@ class ChangePackageNamePatch : ResourcePatch {
return manifest.getAttribute("package") return manifest.getAttribute("package")
} }
} }
companion object : OptionsContainer() {
var packageName: String? by option(
PatchOption.StringOption(
key = "packageName",
default = null,
title = "Package name",
description = "The name of the package to rename the app to.",
)
)
}
} }

View file

@ -1,12 +1,7 @@
package app.revanced.patches.all.screencapture.removerestriction.bytecode.patch package app.revanced.patches.all.screencapture.removerestriction
import app.revanced.patcher.annotation.Description import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.annotations.RequiresIntegrations
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.all.screencapture.removerestriction.resource.patch.RemoveCaptureRestrictionResourcePatch
import app.revanced.util.patch.AbstractTransformInstructionsPatch import app.revanced.util.patch.AbstractTransformInstructionsPatch
import app.revanced.util.patch.IMethodCall import app.revanced.util.patch.IMethodCall
import app.revanced.util.patch.Instruction35cInfo import app.revanced.util.patch.Instruction35cInfo
@ -15,12 +10,18 @@ import com.android.tools.smali.dexlib2.iface.ClassDef
import com.android.tools.smali.dexlib2.iface.Method import com.android.tools.smali.dexlib2.iface.Method
import com.android.tools.smali.dexlib2.iface.instruction.Instruction import com.android.tools.smali.dexlib2.iface.instruction.Instruction
@Patch(false) @Patch(
@Name("Remove screen capture restriction") name = "Remove screen capture restriction",
@Description("Removes the restriction of capturing audio from apps that normally wouldn't allow it.") description = "Removes the restriction of capturing audio from apps that normally wouldn't allow it.",
@DependsOn([RemoveCaptureRestrictionResourcePatch::class]) dependencies = [RemoveCaptureRestrictionResourcePatch::class],
@RequiresIntegrations use = false,
class RemoveCaptureRestrictionPatch : AbstractTransformInstructionsPatch<Instruction35cInfo>() { requiresIntegrations = true
)
@Suppress("unused")
object RemoveCaptureRestrictionPatch : AbstractTransformInstructionsPatch<Instruction35cInfo>() {
private const val INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX =
"Lapp/revanced/all/screencapture/removerestriction/RemoveScreencaptureRestrictionPatch"
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "$INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX;"
// Information about method calls we want to replace // Information about method calls we want to replace
enum class MethodCall( enum class MethodCall(
override val definedClassName: String, override val definedClassName: String,
@ -58,10 +59,4 @@ class RemoveCaptureRestrictionPatch : AbstractTransformInstructionsPatch<Instruc
val (methodType, instruction, instructionIndex) = entry val (methodType, instruction, instructionIndex) = entry
methodType.replaceInvokeVirtualWithIntegrations(INTEGRATIONS_CLASS_DESCRIPTOR, mutableMethod, instruction, instructionIndex) methodType.replaceInvokeVirtualWithIntegrations(INTEGRATIONS_CLASS_DESCRIPTOR, mutableMethod, instruction, instructionIndex)
} }
private companion object {
const val INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX =
"Lapp/revanced/all/screencapture/removerestriction/RemoveScreencaptureRestrictionPatch"
const val INTEGRATIONS_CLASS_DESCRIPTOR = "$INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX;"
}
} }

View file

@ -1,12 +1,12 @@
package app.revanced.patches.all.screencapture.removerestriction.resource.patch package app.revanced.patches.all.screencapture.removerestriction
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.data.ResourceContext import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotation.Patch
import org.w3c.dom.Element import org.w3c.dom.Element
@Description("Sets allowAudioPlaybackCapture in manifest to true.") @Patch(description = "Sets allowAudioPlaybackCapture in manifest to true.")
internal class RemoveCaptureRestrictionResourcePatch : ResourcePatch { internal object RemoveCaptureRestrictionResourcePatch : ResourcePatch() {
override fun execute(context: ResourceContext) { override fun execute(context: ResourceContext) {
// create an xml editor instance // create an xml editor instance
context.xmlEditor["AndroidManifest.xml"].use { dom -> context.xmlEditor["AndroidManifest.xml"].use { dom ->

View file

@ -1,9 +1,6 @@
package app.revanced.patches.all.screenshot.removerestriction.patch package app.revanced.patches.all.screenshot.removerestriction
import app.revanced.patcher.annotation.Description import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.annotations.RequiresIntegrations
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.util.patch.AbstractTransformInstructionsPatch import app.revanced.util.patch.AbstractTransformInstructionsPatch
import app.revanced.util.patch.IMethodCall import app.revanced.util.patch.IMethodCall
@ -13,32 +10,17 @@ import com.android.tools.smali.dexlib2.iface.ClassDef
import com.android.tools.smali.dexlib2.iface.Method import com.android.tools.smali.dexlib2.iface.Method
import com.android.tools.smali.dexlib2.iface.instruction.Instruction import com.android.tools.smali.dexlib2.iface.instruction.Instruction
@Patch(false) @Patch(
@Name("Remove screenshot restriction") name = "Remove screenshot restriction",
@Description("Removes the restriction of taking screenshots in apps that normally wouldn't allow it.") description = "Removes the restriction of taking screenshots in apps that normally wouldn't allow it.",
@RequiresIntegrations use = false,
class RemoveScreenshotRestrictionPatch : AbstractTransformInstructionsPatch<Instruction35cInfo>() { requiresIntegrations = true,
)
private companion object { @Suppress("unused")
const val INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX = object RemoveScreenshotRestrictionPatch : AbstractTransformInstructionsPatch<Instruction35cInfo>() {
private const val INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX =
"Lapp/revanced/all/screenshot/removerestriction/RemoveScreenshotRestrictionPatch" "Lapp/revanced/all/screenshot/removerestriction/RemoveScreenshotRestrictionPatch"
const val INTEGRATIONS_CLASS_DESCRIPTOR = "$INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX;" private const val INTEGRATIONS_CLASS_DESCRIPTOR = "$INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX;"
}
// Information about method calls we want to replace
enum class MethodCall(
override val definedClassName: String,
override val methodName: String,
override val methodParams: Array<String>,
override val returnType: String
): IMethodCall {
SetFlags(
"Landroid/view/Window;",
"setFlags",
arrayOf("I", "I"),
"V",
);
}
override fun filterMap( override fun filterMap(
classDef: ClassDef, classDef: ClassDef,
@ -56,4 +38,19 @@ class RemoveScreenshotRestrictionPatch : AbstractTransformInstructionsPatch<Inst
val (methodType, instruction, instructionIndex) = entry val (methodType, instruction, instructionIndex) = entry
methodType.replaceInvokeVirtualWithIntegrations(INTEGRATIONS_CLASS_DESCRIPTOR, mutableMethod, instruction, instructionIndex) methodType.replaceInvokeVirtualWithIntegrations(INTEGRATIONS_CLASS_DESCRIPTOR, mutableMethod, instruction, instructionIndex)
} }
// Information about method calls we want to replace
enum class MethodCall(
override val definedClassName: String,
override val methodName: String,
override val methodParams: Array<String>,
override val returnType: String
): IMethodCall {
SetFlags(
"Landroid/view/Window;",
"setFlags",
arrayOf("I", "I"),
"V",
);
}
} }

View file

@ -1,23 +1,22 @@
package app.revanced.patches.backdrops.misc.pro.patch package app.revanced.patches.backdrops.misc.pro
import app.revanced.extensions.exception import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patches.backdrops.misc.pro.annotations.ProUnlockCompatibility import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.backdrops.misc.pro.fingerprints.ProUnlockFingerprint import app.revanced.patches.backdrops.misc.pro.fingerprints.ProUnlockFingerprint
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@Patch @Patch(
@Name("Pro unlock") name = "Pro unlock",
@Description("Unlocks pro-only functions.") compatiblePackages = [CompatiblePackage("com.backdrops.wallpapers", ["4.52"])]
@ProUnlockCompatibility )
class ProUnlockPatch : BytecodePatch( @Suppress("unused")
listOf(ProUnlockFingerprint) object ProUnlockPatch : BytecodePatch(
setOf(ProUnlockFingerprint)
) { ) {
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
ProUnlockFingerprint.result?.let { result -> ProUnlockFingerprint.result?.let { result ->

View file

@ -1,7 +0,0 @@
package app.revanced.patches.backdrops.misc.pro.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.backdrops.wallpapers", arrayOf("4.52"))])
internal annotation class ProUnlockCompatibility

View file

@ -1,21 +1,20 @@
package app.revanced.patches.candylinkvpn.patch package app.revanced.patches.candylinkvpn
import app.revanced.extensions.exception import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patches.candylinkvpn.annotations.UnlockProCompatibility import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.candylinkvpn.fingerprints.IsPremiumPurchasedFingerprint import app.revanced.patches.candylinkvpn.fingerprints.IsPremiumPurchasedFingerprint
@Patch @Patch(
@Name("Unlock pro") name = "Unlock pro",
@Description("Unlocks premium features.") compatiblePackages = [CompatiblePackage("com.candylink.openvpn")]
@UnlockProCompatibility )
class UnlockProPatch : BytecodePatch( @Suppress("unused")
listOf(IsPremiumPurchasedFingerprint) object UnlockProPatch : BytecodePatch(
setOf(IsPremiumPurchasedFingerprint)
) { ) {
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
IsPremiumPurchasedFingerprint.result?.mutableMethod?.addInstructions( IsPremiumPurchasedFingerprint.result?.mutableMethod?.addInstructions(

View file

@ -1,8 +0,0 @@
package app.revanced.patches.candylinkvpn.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.candylink.openvpn")])
@Target(AnnotationTarget.CLASS)
internal annotation class UnlockProCompatibility

View file

@ -1,16 +1,13 @@
package app.revanced.patches.duolingo.unlocksuper.patch package app.revanced.patches.duolingo.unlocksuper
import app.revanced.extensions.exception import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Package
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.getInstructions import app.revanced.patcher.extensions.InstructionExtensions.getInstructions
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchException import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.duolingo.unlocksuper.fingerprints.IsUserSuperMethodFingerprint import app.revanced.patches.duolingo.unlocksuper.fingerprints.IsUserSuperMethodFingerprint
import app.revanced.patches.duolingo.unlocksuper.fingerprints.UserSerializationMethodFingerprint import app.revanced.patches.duolingo.unlocksuper.fingerprints.UserSerializationMethodFingerprint
@ -18,14 +15,17 @@ import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction22c import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction22c
import com.android.tools.smali.dexlib2.iface.reference.Reference import com.android.tools.smali.dexlib2.iface.reference.Reference
@Patch @Patch(
@Name("Unlock Duolingo Super") name = "Unlock Duolingo Super",
@Description("Unlocks Duolingo Super features.") compatiblePackages = [CompatiblePackage("com.duolingo")]
@Compatibility([Package("com.duolingo")]) )
class UnlockDuolingoSuperPatch : BytecodePatch( @Suppress("unused")
listOf(UserSerializationMethodFingerprint, IsUserSuperMethodFingerprint) object UnlockDuolingoSuperPatch : BytecodePatch(
setOf(
UserSerializationMethodFingerprint,
IsUserSuperMethodFingerprint
)
) { ) {
/* First find the reference to the isUserSuper field, then patch the instruction that assigns it to false. /* First find the reference to the isUserSuper field, then patch the instruction that assigns it to false.
* This strategy is used because the method that sets the isUserSuper field is difficult to fingerprint reliably. * This strategy is used because the method that sets the isUserSuper field is difficult to fingerprint reliably.
*/ */
@ -53,7 +53,6 @@ class UnlockDuolingoSuperPatch : BytecodePatch(
?: throw UserSerializationMethodFingerprint.exception ?: throw UserSerializationMethodFingerprint.exception
} }
private companion object {
private fun MutableMethod.indexOfReference(reference: Reference) = getInstructions() private fun MutableMethod.indexOfReference(reference: Reference) = getInstructions()
.filterIsInstance<BuilderInstruction22c>() .filterIsInstance<BuilderInstruction22c>()
.filter { it.opcode == Opcode.IPUT_BOOLEAN }.indexOfFirst { it.reference == reference }.let { .filter { it.opcode == Opcode.IPUT_BOOLEAN }.indexOfFirst { it.reference == reference }.let {
@ -61,4 +60,3 @@ class UnlockDuolingoSuperPatch : BytecodePatch(
else it else it
} }
} }
}

View file

@ -1,23 +1,23 @@
package app.revanced.patches.finanzonline.detection.bootloader.patch package app.revanced.patches.finanzonline.detection.bootloader
import app.revanced.extensions.exception import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.finanzonline.detection.bootloader.fingerprints.BootStateFingerprint import app.revanced.patches.finanzonline.detection.bootloader.fingerprints.BootStateFingerprint
import app.revanced.patches.finanzonline.detection.bootloader.fingerprints.CreateKeyFingerprint import app.revanced.patches.finanzonline.detection.bootloader.fingerprints.CreateKeyFingerprint
import app.revanced.patches.finanzonline.detection.shared.annotations.DetectionCompatibility
@Patch @Patch(
@Name("Remove bootloader detection") name = "Remove bootloader detection",
@Description("Removes the check for an unlocked bootloader.") description = "Removes the check for an unlocked bootloader.",
@DetectionCompatibility compatiblePackages = [CompatiblePackage("at.gv.bmf.bmf2go")]
class BootloaderDetectionPatch : BytecodePatch( )
listOf(CreateKeyFingerprint, BootStateFingerprint) @Suppress("unused")
object BootloaderDetectionPatch : BytecodePatch(
setOf(CreateKeyFingerprint, BootStateFingerprint)
) { ) {
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
arrayOf(CreateKeyFingerprint, BootStateFingerprint).forEach { fingerprint -> arrayOf(CreateKeyFingerprint, BootStateFingerprint).forEach { fingerprint ->

View file

@ -1,21 +1,21 @@
package app.revanced.patches.finanzonline.detection.root.patch package app.revanced.patches.finanzonline.detection.root
import app.revanced.extensions.exception import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.finanzonline.detection.root.fingerprints.RootDetectionFingerprint import app.revanced.patches.finanzonline.detection.root.fingerprints.RootDetectionFingerprint
import app.revanced.patches.finanzonline.detection.shared.annotations.DetectionCompatibility
@Patch @Patch(
@Name("Remove root detection") name = "Remove root detection",
@Description("Removes the check for root permissions.") description = "Removes the check for root permissions.",
@DetectionCompatibility compatiblePackages = [CompatiblePackage("at.gv.bmf.bmf2go")]
class RootDetectionPatch : BytecodePatch( )
listOf(RootDetectionFingerprint) @Suppress("unused")
object RootDetectionPatch : BytecodePatch(
setOf(RootDetectionFingerprint)
) { ) {
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
RootDetectionFingerprint.result?.mutableMethod?.addInstructions( RootDetectionFingerprint.result?.mutableMethod?.addInstructions(

View file

@ -1,8 +0,0 @@
package app.revanced.patches.finanzonline.detection.shared.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility([Package("at.gv.bmf.bmf2go")])
@Target(AnnotationTarget.CLASS)
internal annotation class DetectionCompatibility

View file

@ -1,25 +1,24 @@
package app.revanced.patches.googlerecorder.restrictions.patch package app.revanced.patches.googlerecorder.restrictions
import app.revanced.extensions.exception import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Package
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.removeInstructions import app.revanced.patcher.extensions.InstructionExtensions.removeInstructions
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.googlerecorder.restrictions.fingerprints.OnApplicationCreateFingerprint import app.revanced.patches.googlerecorder.restrictions.fingerprints.OnApplicationCreateFingerprint
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@Patch @Patch(
@Name("Remove device restrictions") name = "Remove device restrictions",
@Description("Removes restrictions from using the app on any device.") description = "Removes restrictions from using the app on any device.",
@Compatibility([Package("com.google.android.apps.recorder")]) compatiblePackages = [CompatiblePackage("com.google.android.apps.recorder")]
class RemoveDeviceRestrictions : BytecodePatch( )
listOf(OnApplicationCreateFingerprint) @Suppress("unused")
object RemoveDeviceRestrictions : BytecodePatch(
setOf(OnApplicationCreateFingerprint)
) { ) {
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
OnApplicationCreateFingerprint.result?.let { OnApplicationCreateFingerprint.result?.let {

View file

@ -0,0 +1,26 @@
package app.revanced.patches.hexeditor.ad
import app.revanced.extensions.exception
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.hexeditor.ad.fingerprints.PrimaryAdsFingerprint
@Patch(
name = "Disable ads",
compatiblePackages = [CompatiblePackage("com.myprog.hexedit")]
)
@Suppress("unused")
object DisableAdsPatch : BytecodePatch(
setOf(PrimaryAdsFingerprint)
) {
override fun execute(context: BytecodeContext) = PrimaryAdsFingerprint.result?.mutableMethod?.replaceInstructions(
0,
"""
const/4 v0, 0x1
return v0
"""
) ?: throw PrimaryAdsFingerprint.exception
}

View file

@ -1,12 +0,0 @@
package app.revanced.patches.hexeditor.ad.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[
Package("com.myprog.hexedit")
]
)
@Target(AnnotationTarget.CLASS)
internal annotation class HexEditorAdsCompatibility

View file

@ -1,32 +0,0 @@
package app.revanced.patches.hexeditor.ad.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.hexeditor.ad.annotations.HexEditorAdsCompatibility
import app.revanced.patches.hexeditor.ad.fingerprints.PrimaryAdsFingerprint
@Patch
@Name("Disable ads")
@Description("Disables ads in HexEditor.")
@HexEditorAdsCompatibility
class HexEditorAdsPatch : BytecodePatch(
listOf(
PrimaryAdsFingerprint
)
) {
override fun execute(context: BytecodeContext) {
val method = PrimaryAdsFingerprint.result!!.mutableMethod
method.replaceInstructions(
0,
"""
const/4 v0, 0x1
return v0
"""
)
}
}

View file

@ -1,22 +1,19 @@
package app.revanced.patches.iconpackstudio.misc.pro.patch package app.revanced.patches.iconpackstudio.misc.pro
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patches.iconpackstudio.misc.pro.annotations.UnlockProCompatibility import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.iconpackstudio.misc.pro.fingerprints.CheckProFingerprint import app.revanced.patches.iconpackstudio.misc.pro.fingerprints.CheckProFingerprint
@Patch @Patch(
@Name("Unlock pro") name = "Unlock pro",
@Description("Unlocks all pro features.") compatiblePackages = [CompatiblePackage("ginlemon.iconpackstudio")]
@UnlockProCompatibility
class UnlockProPatch : BytecodePatch(
listOf(
CheckProFingerprint
) )
@Suppress("unused")
object UnlockProPatch : BytecodePatch(
setOf(CheckProFingerprint)
) { ) {
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
val method = CheckProFingerprint.result!!.mutableMethod val method = CheckProFingerprint.result!!.mutableMethod

View file

@ -1,8 +0,0 @@
package app.revanced.patches.iconpackstudio.misc.pro.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility([Package("ginlemon.iconpackstudio")])
@Target(AnnotationTarget.CLASS)
internal annotation class UnlockProCompatibility

View file

@ -0,0 +1,21 @@
package app.revanced.patches.idaustria.detection.root
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.idaustria.detection.root.fingerprints.RootDetectionFingerprint
@Patch(
name = "Remove root detection",
description = "Removes the check for root permissions and unlocked bootloader.",
compatiblePackages = [CompatiblePackage("at.gv.oe.app")]
)
@Suppress("unused")
object RootDetectionPatch : BytecodePatch(
setOf(RootDetectionFingerprint)
) {
override fun execute(context: BytecodeContext) =
RootDetectionFingerprint.result!!.mutableMethod.addInstruction(0, "return-void")
}

View file

@ -1,21 +0,0 @@
package app.revanced.patches.idaustria.detection.root.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.idaustria.detection.root.fingerprints.RootDetectionFingerprint
import app.revanced.patches.idaustria.detection.shared.annotations.DetectionCompatibility
@Patch
@Name("Remove root detection")
@Description("Removes the check for root permissions and unlocked bootloader.")
@DetectionCompatibility
class RootDetectionPatch : BytecodePatch(
listOf(RootDetectionFingerprint)
) {
override fun execute(context: BytecodeContext) =
RootDetectionFingerprint.result!!.mutableMethod.addInstruction(0, "return-void")
}

View file

@ -1,8 +0,0 @@
package app.revanced.patches.idaustria.detection.shared.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility([Package("at.gv.oe.app")])
@Target(AnnotationTarget.CLASS)
internal annotation class DetectionCompatibility

View file

@ -1,23 +1,23 @@
package app.revanced.patches.idaustria.detection.signature.patch package app.revanced.patches.idaustria.detection.signature
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patches.idaustria.detection.shared.annotations.DetectionCompatibility import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.idaustria.detection.signature.fingerprints.SpoofSignatureFingerprint import app.revanced.patches.idaustria.detection.signature.fingerprints.SpoofSignatureFingerprint
@Patch @Patch(
@Name("Spoof signature") name = "Spoof signature",
@Description("Spoofs the signature of the app.") description = "Spoofs the signature of the app.",
@DetectionCompatibility compatiblePackages = [CompatiblePackage("at.gv.oe.app")]
class SpoofSignaturePatch : BytecodePatch( )
listOf(SpoofSignatureFingerprint) @Suppress("unused")
object SpoofSignaturePatch : BytecodePatch(
setOf(SpoofSignatureFingerprint)
) { ) {
companion object { private const val EXPECTED_SIGNATURE =
const val EXPECTED_SIGNATURE = "OpenSSLRSAPublicKey{modulus=ac3e6fd6050aa7e0d6010ae58190404cd89a56935b44f6fee" + "OpenSSLRSAPublicKey{modulus=ac3e6fd6050aa7e0d6010ae58190404cd89a56935b44f6fee" +
"067c149768320026e10b24799a1339e414605e448e3f264444a327b9ae292be2b62ad567dd1800dbed4a88f718a33dc6db6b" + "067c149768320026e10b24799a1339e414605e448e3f264444a327b9ae292be2b62ad567dd1800dbed4a88f718a33dc6db6b" +
"f5178aa41aa0efff8a3409f5ca95dbfccd92c7b4298966df806ea7a0204a00f0e745f6d9f13bdf24f3df715d7b62c1600906" + "f5178aa41aa0efff8a3409f5ca95dbfccd92c7b4298966df806ea7a0204a00f0e745f6d9f13bdf24f3df715d7b62c1600906" +
"15de1c8a956b9286764985a3b3c060963c435fb9481a5543aaf0671fc2dba6c5c2b17d1ef1d85137f14dc9bbdf3490288087" + "15de1c8a956b9286764985a3b3c060963c435fb9481a5543aaf0671fc2dba6c5c2b17d1ef1d85137f14dc9bbdf3490288087" +
@ -28,7 +28,6 @@ class SpoofSignaturePatch : BytecodePatch(
"0def55be2c1f6f9c72c92fb45d7e0a9ac571cb38f0a9a37bb33ea06f223fde8c7a92e8c47769e386f9799776e8f110c21df2" + "0def55be2c1f6f9c72c92fb45d7e0a9ac571cb38f0a9a37bb33ea06f223fde8c7a92e8c47769e386f9799776e8f110c21df2" +
"77ef1be61b2c01ebdabddcbf53cc4b6fd9a3c445606ee77b3758162c80ad8f8137b3c6864e92db904807dcb2be9d7717dd21" + "77ef1be61b2c01ebdabddcbf53cc4b6fd9a3c445606ee77b3758162c80ad8f8137b3c6864e92db904807dcb2be9d7717dd21" +
"bf42c121d620ddfb7914f7a95c713d9e1c1b7bdb4a03d618e40cf7e9e235c0b5687e03b7ab3,publicExponent=10001}" "bf42c121d620ddfb7914f7a95c713d9e1c1b7bdb4a03d618e40cf7e9e235c0b5687e03b7ab3,publicExponent=10001}"
}
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
SpoofSignatureFingerprint.result!!.mutableMethod.addInstructions( SpoofSignatureFingerprint.result!!.mutableMethod.addInstructions(

View file

@ -1,21 +1,20 @@
package app.revanced.patches.inshorts.ad.patch package app.revanced.patches.inshorts.ad
import app.revanced.extensions.exception import app.revanced.extensions.exception
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patches.inshorts.ad.annotations.HideAdsCompatibility import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.inshorts.ad.fingerprints.InshortsAdsFingerprint import app.revanced.patches.inshorts.ad.fingerprints.InshortsAdsFingerprint
@Patch @Patch(
@Name("Hide ads") name = "Hide ads",
@Description("Removes ads from Inshorts.") compatiblePackages = [CompatiblePackage("com.nis.app")]
@HideAdsCompatibility )
class HideAdsPatch : BytecodePatch( @Suppress("unused")
listOf(InshortsAdsFingerprint) object HideAdsPatch : BytecodePatch(
setOf(InshortsAdsFingerprint)
) { ) {
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
InshortsAdsFingerprint.result?.let { result -> InshortsAdsFingerprint.result?.let { result ->

View file

@ -1,9 +0,0 @@
package app.revanced.patches.inshorts.ad.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.nis.app")])
@Target(AnnotationTarget.CLASS)
internal annotation class HideAdsCompatibility

View file

@ -1,14 +1,14 @@
package app.revanced.patches.instagram.patches.ads.timeline.patch package app.revanced.patches.instagram.patches.ads.timeline
import app.revanced.extensions.exception import app.revanced.extensions.exception
import app.revanced.patcher.annotation.*
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patcher.util.smali.ExternalLabel import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.instagram.patches.ads.timeline.fingerprints.MediaFingerprint import app.revanced.patches.instagram.patches.ads.timeline.fingerprints.MediaFingerprint
import app.revanced.patches.instagram.patches.ads.timeline.fingerprints.ShowAdFingerprint import app.revanced.patches.instagram.patches.ads.timeline.fingerprints.ShowAdFingerprint
@ -19,12 +19,14 @@ import app.revanced.patches.instagram.patches.ads.timeline.fingerprints.ads.Shop
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@Patch @Patch(
@Name("Hide timeline ads") name = "Hide timeline ads",
@Description("Removes ads from the timeline.") description = "Removes ads from the timeline.",
@Compatibility([Package("com.instagram.android", arrayOf("275.0.0.27.98"))]) compatiblePackages = [CompatiblePackage("com.instagram.android", ["275.0.0.27.98"])]
class HideTimelineAdsPatch : BytecodePatch( )
listOf( @Suppress("unused")
object HideTimelineAdsPatch : BytecodePatch(
setOf(
ShowAdFingerprint, ShowAdFingerprint,
MediaFingerprint, MediaFingerprint,
PaidPartnershipAdFingerprint // Unlike the other ads this one is resolved from all classes. PaidPartnershipAdFingerprint // Unlike the other ads this one is resolved from all classes.

View file

@ -1,21 +1,20 @@
package app.revanced.patches.irplus.ad.patch package app.revanced.patches.irplus.ad
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patches.irplus.ad.annotations.IrplusAdsCompatibility import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.irplus.ad.fingerprints.IrplusAdsFingerprint import app.revanced.patches.irplus.ad.fingerprints.IrplusAdsFingerprint
@Patch @Patch(
@Name("Remove ads") name = "Remove ads",
@Description("Removes all ads from the app.") compatiblePackages = [CompatiblePackage("net.binarymode.android.irplus")]
@IrplusAdsCompatibility )
class IrplusAdsPatch : BytecodePatch( @Suppress("unused")
listOf(IrplusAdsFingerprint) object RemoveAdsPatch : BytecodePatch(
setOf(IrplusAdsFingerprint)
) { ) {
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
val method = IrplusAdsFingerprint.result!!.mutableMethod val method = IrplusAdsFingerprint.result!!.mutableMethod

View file

@ -1,8 +0,0 @@
package app.revanced.patches.irplus.ad.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility([Package("net.binarymode.android.irplus")])
@Target(AnnotationTarget.CLASS)
internal annotation class IrplusAdsCompatibility

View file

@ -1,18 +1,21 @@
package app.revanced.patches.lightroom.misc.login.patch package app.revanced.patches.lightroom.misc.login
import app.revanced.extensions.exception import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patches.lightroom.misc.login.annotations.DisableMandatoryLoginCompatibility import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.lightroom.misc.login.fingerprint.IsLoggedInFingerprint import app.revanced.patches.lightroom.misc.login.fingerprints.IsLoggedInFingerprint
@Patch @Patch(
@Name("Disable mandatory login") name = "Disable mandatory login",
@DisableMandatoryLoginCompatibility compatiblePackages = [CompatiblePackage("com.adobe.lrmobile")]
class DisableMandatoryLoginPatch : BytecodePatch(listOf(IsLoggedInFingerprint)) { )
@Suppress("unused")
object DisableMandatoryLoginPatch : BytecodePatch(
setOf(IsLoggedInFingerprint)
) {
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
IsLoggedInFingerprint.result?.mutableMethod?.apply { IsLoggedInFingerprint.result?.mutableMethod?.apply {
val index = implementation!!.instructions.lastIndex - 1 val index = implementation!!.instructions.lastIndex - 1

View file

@ -1,8 +0,0 @@
package app.revanced.patches.lightroom.misc.login.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.adobe.lrmobile",)])
@Target(AnnotationTarget.CLASS)
internal annotation class DisableMandatoryLoginCompatibility

View file

@ -1,4 +1,4 @@
package app.revanced.patches.lightroom.misc.login.fingerprint package app.revanced.patches.lightroom.misc.login.fingerprints
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View file

@ -0,0 +1,24 @@
package app.revanced.patches.lightroom.misc.premium
import app.revanced.extensions.exception
import app.revanced.patcher.data.BytecodeContext
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.lightroom.misc.premium.fingerprints.HasPurchasedFingerprint
@Patch(
name = "Unlock premium",
compatiblePackages = [CompatiblePackage("com.adobe.lrmobile")]
)
@Suppress("unused")
object UnlockPremiumPatch : BytecodePatch(
setOf(HasPurchasedFingerprint)
){
override fun execute(context: BytecodeContext) {
// Set hasPremium = true.
HasPurchasedFingerprint.result?.mutableMethod?.replaceInstruction(2, "const/4 v2, 0x1")
?: throw HasPurchasedFingerprint.exception
}
}

View file

@ -1,8 +0,0 @@
package app.revanced.patches.lightroom.misc.premium.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.adobe.lrmobile")])
@Target(AnnotationTarget.CLASS)
internal annotation class UnlockPremiumCompatibility

View file

@ -1,4 +1,4 @@
package app.revanced.patches.lightroom.misc.premium.fingerprint package app.revanced.patches.lightroom.misc.premium.fingerprints
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View file

@ -1,23 +0,0 @@
package app.revanced.patches.lightroom.misc.premium.patch
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.lightroom.misc.premium.annotations.UnlockPremiumCompatibility
import app.revanced.patches.lightroom.misc.premium.fingerprint.HasPurchasedFingerprint
@Patch
@Name("Unlock premium")
@Description("Unlocks premium features.")
@UnlockPremiumCompatibility
class UnlockPremiumPatch : BytecodePatch(listOf(HasPurchasedFingerprint)) {
override fun execute(context: BytecodeContext) {
// Set hasPremium = true.
HasPurchasedFingerprint.result?.mutableMethod?.replaceInstruction(2, "const/4 v2, 0x1")
?: throw HasPurchasedFingerprint.exception
}
}

View file

@ -1,15 +1,15 @@
package app.revanced.patches.memegenerator.detection.license.patch package app.revanced.patches.memegenerator.detection.license
import app.revanced.extensions.exception import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patches.memegenerator.detection.license.fingerprint.LicenseValidationFingerprint import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.memegenerator.detection.license.fingerprints.LicenseValidationFingerprint
@Description("Disables Firebase license validation.") @Patch(description = "Disables Firebase license validation.")
class LicenseValidationPatch : BytecodePatch( object LicenseValidationPatch : BytecodePatch(
listOf(LicenseValidationFingerprint) setOf(LicenseValidationFingerprint)
) { ) {
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
LicenseValidationFingerprint.result?.apply { LicenseValidationFingerprint.result?.apply {

View file

@ -1,4 +1,4 @@
package app.revanced.patches.memegenerator.detection.license.fingerprint package app.revanced.patches.memegenerator.detection.license.fingerprints
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View file

@ -1,15 +1,15 @@
package app.revanced.patches.memegenerator.detection.signature.patch package app.revanced.patches.memegenerator.detection.signature
import app.revanced.extensions.exception import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patches.memegenerator.detection.signature.fingerprint.VerifySignatureFingerprint import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.memegenerator.detection.signature.fingerprints.VerifySignatureFingerprint
@Description("Disables detection of incorrect signature.") @Patch(description = "Disables detection of incorrect signature.")
class SignatureVerificationPatch : BytecodePatch( object SignatureVerificationPatch : BytecodePatch(
listOf(VerifySignatureFingerprint) setOf(VerifySignatureFingerprint)
) { ) {
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
VerifySignatureFingerprint.result?.apply { VerifySignatureFingerprint.result?.apply {

View file

@ -1,4 +1,4 @@
package app.revanced.patches.memegenerator.detection.signature.fingerprint package app.revanced.patches.memegenerator.detection.signature.fingerprints
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod

View file

@ -0,0 +1,44 @@
package app.revanced.patches.memegenerator.misc.pro
import app.revanced.extensions.exception
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.memegenerator.detection.license.LicenseValidationPatch
import app.revanced.patches.memegenerator.detection.signature.SignatureVerificationPatch
import app.revanced.patches.memegenerator.misc.pro.fingerprints.IsFreeVersionFingerprint
@Patch(
name = "Unlock pro",
dependencies = [
SignatureVerificationPatch::class,
LicenseValidationPatch::class
],
compatiblePackages = [
CompatiblePackage(
"com.zombodroid.MemeGenerator", [
"4.6364",
"4.6370",
"4.6375",
"4.6377"
]
)
]
)
@Suppress("unused")
object UnlockProVersionPatch : BytecodePatch(
setOf(IsFreeVersionFingerprint)
) {
override fun execute(context: BytecodeContext) {
IsFreeVersionFingerprint.result?.apply {
mutableMethod.replaceInstructions(0,
"""
sget-object p0, Ljava/lang/Boolean;->FALSE:Ljava/lang/Boolean;
return-object p0
"""
)
} ?: throw IsFreeVersionFingerprint.exception
}
}

View file

@ -1,17 +0,0 @@
package app.revanced.patches.memegenerator.misc.pro.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package(
"com.zombodroid.MemeGenerator", arrayOf(
"4.6364",
"4.6370",
"4.6375",
"4.6377",
)
)]
)
@Target(AnnotationTarget.CLASS)
internal annotation class UnlockProCompatibility

View file

@ -1,4 +1,4 @@
package app.revanced.patches.memegenerator.misc.pro.fingerprint package app.revanced.patches.memegenerator.misc.pro.fingerprints
import app.revanced.patcher.extensions.or import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint

View file

@ -1,39 +0,0 @@
package app.revanced.patches.memegenerator.misc.pro.patch
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.memegenerator.detection.license.patch.LicenseValidationPatch
import app.revanced.patches.memegenerator.detection.signature.patch.SignatureVerificationPatch
import app.revanced.patches.memegenerator.misc.pro.annotations.UnlockProCompatibility
import app.revanced.patches.memegenerator.misc.pro.fingerprint.IsFreeVersionFingerprint
@Patch
@Name("Unlock pro")
@Description("Unlocks pro features.")
@DependsOn([
SignatureVerificationPatch::class,
LicenseValidationPatch::class
])
@UnlockProCompatibility
class UnlockProVersionPatch : BytecodePatch(
listOf(
IsFreeVersionFingerprint
)
) {
override fun execute(context: BytecodeContext) {
IsFreeVersionFingerprint.result?.apply {
mutableMethod.replaceInstructions(0,
"""
sget-object p0, Ljava/lang/Boolean;->FALSE:Ljava/lang/Boolean;
return-object p0
"""
)
} ?: throw IsFreeVersionFingerprint.exception
}
}

View file

@ -1,19 +1,21 @@
package app.revanced.patches.messenger.ads.inbox.patch package app.revanced.patches.messenger.ads.inbox.patch
import app.revanced.extensions.exception import app.revanced.extensions.exception
import app.revanced.patcher.annotation.*
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.messenger.ads.inbox.fingerprints.LoadInboxAdsFingerprint import app.revanced.patches.messenger.ads.inbox.fingerprints.LoadInboxAdsFingerprint
@Patch @Patch(
@Name("Hide inbox ads") name = "Hide inbox ads",
@Description("Hides ads in inbox.") description = "Hides ads in inbox.",
@Compatibility([Package("com.facebook.orca")]) compatiblePackages = [CompatiblePackage("com.facebook.orca")]
class HideInboxAdsPatch : BytecodePatch( )
listOf(LoadInboxAdsFingerprint) @Suppress("unused")
object HideInboxAdsPatch : BytecodePatch(
setOf(LoadInboxAdsFingerprint)
) { ) {
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
LoadInboxAdsFingerprint.result?.mutableMethod?.apply { LoadInboxAdsFingerprint.result?.mutableMethod?.apply {

View file

@ -1,20 +1,24 @@
package app.revanced.patches.messenger.inputfield.patch package app.revanced.patches.messenger.inputfield.patch
import app.revanced.extensions.exception import app.revanced.extensions.exception
import app.revanced.patcher.annotation.*
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.messenger.inputfield.fingerprints.SwitchMessangeInputEmojiButtonFingerprint import app.revanced.patches.messenger.inputfield.fingerprints.SwitchMessangeInputEmojiButtonFingerprint
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@Patch @Patch(
@Name("Disable switching emoji to sticker in message input field") name = "Disable switching emoji to sticker",
@Description("Disables switching from emoji to sticker search mode in message input field") description = "Disables switching from emoji to sticker search mode in message input field.",
@Compatibility([Package("com.facebook.orca")]) compatiblePackages = [CompatiblePackage("com.facebook.orca")]
class DisableSwitchingEmojiToStickerInMessageInputField : BytecodePatch(listOf(SwitchMessangeInputEmojiButtonFingerprint)) { )
@Suppress("unused")
object DisableSwitchingEmojiToStickerPatch : BytecodePatch(
setOf(SwitchMessangeInputEmojiButtonFingerprint)
) {
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
SwitchMessangeInputEmojiButtonFingerprint.result?.let { SwitchMessangeInputEmojiButtonFingerprint.result?.let {
val setStringIndex = it.scanResult.patternScanResult!!.startIndex + 2 val setStringIndex = it.scanResult.patternScanResult!!.startIndex + 2

View file

@ -1,21 +1,22 @@
package app.revanced.patches.messenger.inputfield.patch package app.revanced.patches.messenger.inputfield.patch
import app.revanced.extensions.exception import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Package
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.messenger.inputfield.fingerprints.SendTypingIndicatorFingerprint import app.revanced.patches.messenger.inputfield.fingerprints.SendTypingIndicatorFingerprint
@Patch @Patch(
@Name("Disable typing indicator") name = "Disable typing indicator",
@Description("Disables the indicator while typing a message") description = "Disables the indicator while typing a message.",
@Compatibility([Package("com.facebook.orca")]) compatiblePackages = [CompatiblePackage("com.facebook.orca")]
class DisableTypingIndicator : BytecodePatch(listOf(SendTypingIndicatorFingerprint)) { )
@Suppress("unused")
object DisableTypingIndicatorPatch : BytecodePatch(
setOf(SendTypingIndicatorFingerprint)
){
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
SendTypingIndicatorFingerprint.result?.mutableMethod?.replaceInstruction(0, "return-void") SendTypingIndicatorFingerprint.result?.mutableMethod?.replaceInstruction(0, "return-void")
?: throw SendTypingIndicatorFingerprint.exception ?: throw SendTypingIndicatorFingerprint.exception

View file

@ -1,20 +1,19 @@
package app.revanced.patches.moneymanager.patch package app.revanced.patches.moneymanager
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patches.moneymanager.annotations.UnlockProCompatibility import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.moneymanager.fingerprints.UnlockProFingerprint import app.revanced.patches.moneymanager.fingerprints.UnlockProFingerprint
@Patch @Patch(
@Name("Unlock pro") name = "Unlock pro",
@Description("Unlocks pro features.") compatiblePackages = [CompatiblePackage("com.ithebk.expensemanager")]
@UnlockProCompatibility )
class UnlockProPatch : BytecodePatch( @Suppress("unused")
listOf(UnlockProFingerprint) object UnlockProPatch : BytecodePatch(
setOf(UnlockProFingerprint)
){ ){
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
UnlockProFingerprint.result!!.mutableMethod.addInstructions( UnlockProFingerprint.result!!.mutableMethod.addInstructions(

View file

@ -1,8 +0,0 @@
package app.revanced.patches.moneymanager.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.ithebk.expensemanager")])
@Target(AnnotationTarget.CLASS)
internal annotation class UnlockProCompatibility

View file

@ -1,22 +1,22 @@
package app.revanced.patches.music.ad.video.patch package app.revanced.patches.music.ad.video
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.music.ad.video.fingerprints.ShowMusicVideoAdsConstructorFingerprint import app.revanced.patches.music.ad.video.fingerprints.ShowMusicVideoAdsConstructorFingerprint
import app.revanced.patches.music.ad.video.fingerprints.ShowMusicVideoAdsFingerprint import app.revanced.patches.music.ad.video.fingerprints.ShowMusicVideoAdsFingerprint
import app.revanced.patches.music.annotations.MusicCompatibility
@Patch @Patch(
@Name("Music video ads") name = "Music video ads",
@Description("Removes ads in the music player.") description = "Removes ads in the music player.",
@MusicCompatibility compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")]
class MusicVideoAdsPatch : BytecodePatch( )
listOf(ShowMusicVideoAdsConstructorFingerprint) @Suppress("unused")
object MusicVideoAdsPatch : BytecodePatch(
setOf(ShowMusicVideoAdsConstructorFingerprint)
) { ) {
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
ShowMusicVideoAdsFingerprint.resolve(context, ShowMusicVideoAdsConstructorFingerprint.result!!.classDef) ShowMusicVideoAdsFingerprint.resolve(context, ShowMusicVideoAdsConstructorFingerprint.result!!.classDef)

View file

@ -1,8 +0,0 @@
package app.revanced.patches.music.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.google.android.apps.youtube.music")])
@Target(AnnotationTarget.CLASS)
internal annotation class MusicCompatibility

View file

@ -1,24 +1,22 @@
package app.revanced.patches.music.audio.codecs.patch package app.revanced.patches.music.audio.codecs
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patcher.util.smali.toInstruction import app.revanced.patcher.util.smali.toInstruction
import app.revanced.patches.music.annotations.MusicCompatibility
import app.revanced.patches.music.audio.codecs.fingerprints.AllCodecsReferenceFingerprint import app.revanced.patches.music.audio.codecs.fingerprints.AllCodecsReferenceFingerprint
import app.revanced.patches.music.audio.codecs.fingerprints.CodecsLockFingerprint import app.revanced.patches.music.audio.codecs.fingerprints.CodecsLockFingerprint
import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.Opcode
@Patch @Patch(
@Name("Codecs unlock") name = "Codecs unlock",
@Description("Adds more audio codec options. The new audio codecs usually result in better audio quality.") description = "Adds more audio codec options. The new audio codecs usually result in better audio quality.",
@MusicCompatibility compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")]
class CodecsUnlockPatch : BytecodePatch(
listOf(
CodecsLockFingerprint, AllCodecsReferenceFingerprint
) )
@Suppress("unused")
object CodecsUnlockPatch : BytecodePatch(
setOf(CodecsLockFingerprint, AllCodecsReferenceFingerprint)
) { ) {
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
val codecsLockResult = CodecsLockFingerprint.result!! val codecsLockResult = CodecsLockFingerprint.result!!

View file

@ -1,21 +1,21 @@
package app.revanced.patches.music.audio.exclusiveaudio.patch package app.revanced.patches.music.audio.exclusiveaudio
import app.revanced.extensions.exception import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patches.music.annotations.MusicCompatibility import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.music.audio.exclusiveaudio.fingerprints.AllowExclusiveAudioPlaybackFingerprint import app.revanced.patches.music.audio.exclusiveaudio.fingerprints.AllowExclusiveAudioPlaybackFingerprint
@Patch @Patch(
@Name("Exclusive audio playback") name = "Exclusive audio playback",
@Description("Enables the option to play audio without video.") description = "Enables the option to play audio without video.",
@MusicCompatibility compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")]
class ExclusiveAudioPatch : BytecodePatch( )
listOf(AllowExclusiveAudioPlaybackFingerprint) @Suppress("unused")
object ExclusiveAudioPatch : BytecodePatch(
setOf(AllowExclusiveAudioPlaybackFingerprint)
) { ) {
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
AllowExclusiveAudioPlaybackFingerprint.result?.mutableMethod?.apply { AllowExclusiveAudioPlaybackFingerprint.result?.mutableMethod?.apply {

View file

@ -1,23 +1,24 @@
package app.revanced.patches.music.interaction.permanentrepeat.patch package app.revanced.patches.music.interaction.permanentrepeat
import app.revanced.extensions.exception import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patcher.util.smali.ExternalLabel import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.music.annotations.MusicCompatibility
import app.revanced.patches.music.interaction.permanentrepeat.fingerprints.RepeatTrackFingerprint import app.revanced.patches.music.interaction.permanentrepeat.fingerprints.RepeatTrackFingerprint
@Patch(false) @Patch(
@Name("Permanent repeat") name = "Permanent repeat",
@Description("Permanently remember your repeating preference even if the playlist ends or another track is played.") description = "Permanently remember your repeating preference even if the playlist ends or another track is played.",
@MusicCompatibility compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")],
class PermanentRepeatPatch : BytecodePatch( use = false
listOf(RepeatTrackFingerprint) )
@Suppress("unused")
object PermanentRepeatPatch : BytecodePatch(
setOf(RepeatTrackFingerprint)
) { ) {
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
RepeatTrackFingerprint.result?.let { RepeatTrackFingerprint.result?.let {

View file

@ -0,0 +1,25 @@
package app.revanced.patches.music.interaction.permanentshuffle
import app.revanced.extensions.exception
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.music.interaction.permanentshuffle.fingerprints.DisableShuffleFingerprint
@Patch(
name = "Permanent shuffle",
description = "Permanently remember your shuffle preference " +
"even if the playlist ends or another track is played.",
compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")],
use = false
)
@Suppress("unused")
object PermanentShuffleTogglePatch : BytecodePatch(setOf(DisableShuffleFingerprint)) {
override fun execute(context: BytecodeContext) {
DisableShuffleFingerprint.result?.mutableMethod?.addInstruction(0, "return-void")
?: throw DisableShuffleFingerprint.exception
}
}

View file

@ -1,25 +0,0 @@
package app.revanced.patches.music.interaction.permanentshuffle.patch
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.annotations.MusicCompatibility
import app.revanced.patches.music.interaction.permanentshuffle.fingerprints.DisableShuffleFingerprint
@Patch(false)
@Name("Permanent shuffle")
@Description("Permanently remember your shuffle preference " +
"even if the playlist ends or another track is played.")
@MusicCompatibility
class PermanentShuffleTogglePatch : BytecodePatch(
listOf(DisableShuffleFingerprint)
) {
override fun execute(context: BytecodeContext) {
DisableShuffleFingerprint.result?.mutableMethod?.addInstruction(0, "return-void")
?: throw DisableShuffleFingerprint.exception
}
}

View file

@ -1,21 +1,22 @@
package app.revanced.patches.music.layout.compactheader.patch package app.revanced.patches.music.layout.compactheader
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patches.music.annotations.MusicCompatibility import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.music.layout.compactheader.fingerprints.CompactHeaderConstructorFingerprint import app.revanced.patches.music.layout.compactheader.fingerprints.CompactHeaderConstructorFingerprint
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction11x import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction11x
@Patch(false) @Patch(
@Name("Compact header") name = "Compact header",
@Description("Hides the music category bar at the top of the homepage.") description = "Hides the music category bar at the top of the homepage.",
@MusicCompatibility compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")],
class CompactHeaderPatch : BytecodePatch( use = false
listOf(CompactHeaderConstructorFingerprint) )
@Suppress("unused")
object CompactHeaderPatch : BytecodePatch(
setOf(CompactHeaderConstructorFingerprint)
) { ) {
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
val result = CompactHeaderConstructorFingerprint.result!! val result = CompactHeaderConstructorFingerprint.result!!

View file

@ -0,0 +1,26 @@
package app.revanced.patches.music.layout.minimizedplayback
import app.revanced.extensions.exception
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.music.layout.minimizedplayback.fingerprints.MinimizedPlaybackManagerFingerprint
@Patch(
name = "Minimized playback music",
description = "Enables minimized playback on Kids music.",
compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")]
)
@Suppress("unused")
object MinimizedPlaybackPatch : BytecodePatch(setOf(MinimizedPlaybackManagerFingerprint)) {
override fun execute(context: BytecodeContext) =
MinimizedPlaybackManagerFingerprint.result?.mutableMethod?.addInstruction(
0,
"""
return-void
"""
) ?: throw MinimizedPlaybackManagerFingerprint.exception
}

View file

@ -1,27 +0,0 @@
package app.revanced.patches.music.layout.minimizedplayback.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.annotations.MusicCompatibility
import app.revanced.patches.music.layout.minimizedplayback.fingerprints.MinimizedPlaybackManagerFingerprint
@Patch
@Name("Minimized playback music")
@Description("Enables minimized playback on Kids music.")
@MusicCompatibility
class MinimizedPlaybackPatch : BytecodePatch(
listOf(MinimizedPlaybackManagerFingerprint)
) {
override fun execute(context: BytecodeContext) {
MinimizedPlaybackManagerFingerprint.result!!.mutableMethod.addInstruction(
0,
"""
return-void
"""
)
}
}

View file

@ -1,24 +1,22 @@
package app.revanced.patches.music.layout.premium.patch package app.revanced.patches.music.layout.premium
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patches.music.annotations.MusicCompatibility import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.music.layout.premium.fingerprints.HideGetPremiumFingerprint import app.revanced.patches.music.layout.premium.fingerprints.HideGetPremiumFingerprint
import app.revanced.patches.music.layout.premium.fingerprints.HideGetPremiumParentFingerprint import app.revanced.patches.music.layout.premium.fingerprints.HideGetPremiumParentFingerprint
@Patch @Patch(
@Name("Hide get premium") name = "Hide get premium",
@Description("Removes all \"Get Premium\" evidences from the avatar menu.") description = "Removes all \"Get Premium\" evidences from the avatar menu.",
@MusicCompatibility compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")]
class HideGetPremiumPatch : BytecodePatch( )
listOf(HideGetPremiumParentFingerprint) @Suppress("unused")
) { object HideGetPremiumPatch : BytecodePatch(setOf(HideGetPremiumParentFingerprint)) {
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
val parentResult = HideGetPremiumParentFingerprint.result!! val parentResult = HideGetPremiumParentFingerprint.result!!
HideGetPremiumFingerprint.resolve(context, parentResult.classDef) HideGetPremiumFingerprint.resolve(context, parentResult.classDef)

View file

@ -1,13 +1,11 @@
package app.revanced.patches.music.layout.upgradebutton.patch package app.revanced.patches.music.layout.upgradebutton
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patcher.util.smali.toInstructions import app.revanced.patcher.util.smali.toInstructions
import app.revanced.patches.music.annotations.MusicCompatibility
import app.revanced.patches.music.layout.upgradebutton.fingerprints.PivotBarConstructorFingerprint import app.revanced.patches.music.layout.upgradebutton.fingerprints.PivotBarConstructorFingerprint
import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction22t import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction22t
@ -15,12 +13,14 @@ import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction22c
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c
@Patch @Patch(
@Name("Remove upgrade button") name = "Remove upgrade button",
@Description("Removes the upgrade tab from the pivot bar.") description = "Removes the upgrade tab from the pivot bar.",
@MusicCompatibility compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")]
class RemoveUpgradeButtonPatch : BytecodePatch( )
listOf(PivotBarConstructorFingerprint) @Suppress("unused")
object RemoveUpgradeButtonPatch : BytecodePatch(
setOf(PivotBarConstructorFingerprint)
) { ) {
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
val result = PivotBarConstructorFingerprint.result!! val result = PivotBarConstructorFingerprint.result!!

View file

@ -1,22 +1,21 @@
package app.revanced.patches.music.misc.androidauto.patch package app.revanced.patches.music.misc.androidauto
import app.revanced.extensions.exception import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patches.music.annotations.MusicCompatibility import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.music.misc.androidauto.fingerprints.CheckCertificateFingerprint import app.revanced.patches.music.misc.androidauto.fingerprints.CheckCertificateFingerprint
@Patch
@Name("Bypass certificate checks") @Patch(
@Description("Bypasses certificate checks which prevent YouTube Music from working on Android Auto.") name = "Bypass certificate checks",
@MusicCompatibility description = "Bypasses certificate checks which prevent YouTube Music from working on Android Auto.",
class BypassCertificateChecksPatch : BytecodePatch( compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")]
listOf(CheckCertificateFingerprint) )
) { @Suppress("unused")
object BypassCertificateChecksPatch : BytecodePatch(setOf(CheckCertificateFingerprint)) {
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
CheckCertificateFingerprint.result?.apply { CheckCertificateFingerprint.result?.apply {
mutableMethod.addInstructions( mutableMethod.addInstructions(

View file

@ -1,26 +1,25 @@
package app.revanced.patches.music.misc.microg.patch.bytecode package app.revanced.patches.music.misc.microg
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.music.annotations.MusicCompatibility
import app.revanced.patches.music.misc.microg.fingerprints.* import app.revanced.patches.music.misc.microg.fingerprints.*
import app.revanced.patches.music.misc.microg.patch.resource.MicroGResourcePatch
import app.revanced.patches.music.misc.microg.shared.Constants.MUSIC_PACKAGE_NAME import app.revanced.patches.music.misc.microg.shared.Constants.MUSIC_PACKAGE_NAME
import app.revanced.patches.music.misc.microg.shared.Constants.REVANCED_MUSIC_PACKAGE_NAME import app.revanced.patches.music.misc.microg.shared.Constants.REVANCED_MUSIC_PACKAGE_NAME
import app.revanced.patches.youtube.misc.microg.shared.Constants import app.revanced.patches.youtube.misc.microg.shared.Constants
import app.revanced.util.microg.MicroGBytecodeHelper import app.revanced.util.microg.MicroGBytecodeHelper
@Patch
@DependsOn([MicroGResourcePatch::class]) @Patch(
@Name("Vanced MicroG support") name = "MicroG support",
@Description("Allows YouTube Music ReVanced to run without root and under a different package name.") description = "Allows YouTube Music ReVanced to run without root and under a different package name.",
@MusicCompatibility dependencies = [MicroGResourcePatch::class],
class MicroGBytecodePatch : BytecodePatch( compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")]
listOf( )
@Suppress("unused")
object MicroGBytecodePatch : BytecodePatch(
setOf(
ServiceCheckFingerprint, ServiceCheckFingerprint,
GooglePlayUtilityFingerprint, GooglePlayUtilityFingerprint,
CastDynamiteModuleFingerprint, CastDynamiteModuleFingerprint,

View file

@ -1,8 +1,8 @@
package app.revanced.patches.music.misc.microg.patch.resource package app.revanced.patches.music.misc.microg
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.data.ResourceContext import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.music.misc.microg.shared.Constants.MUSIC_PACKAGE_NAME import app.revanced.patches.music.misc.microg.shared.Constants.MUSIC_PACKAGE_NAME
import app.revanced.patches.music.misc.microg.shared.Constants.REVANCED_MUSIC_APP_NAME import app.revanced.patches.music.misc.microg.shared.Constants.REVANCED_MUSIC_APP_NAME
import app.revanced.patches.music.misc.microg.shared.Constants.REVANCED_MUSIC_PACKAGE_NAME import app.revanced.patches.music.misc.microg.shared.Constants.REVANCED_MUSIC_PACKAGE_NAME
@ -11,8 +11,12 @@ import app.revanced.patches.music.misc.microg.shared.Constants.SPOOFED_PACKAGE_S
import app.revanced.util.microg.MicroGManifestHelper import app.revanced.util.microg.MicroGManifestHelper
import app.revanced.util.microg.MicroGResourceHelper import app.revanced.util.microg.MicroGResourceHelper
@Description("Resource patch to allow YouTube Music ReVanced to run without root and under a different package name.")
class MicroGResourcePatch : ResourcePatch { @Patch(
description = "Resource patch to allow YouTube Music ReVanced to run without root " +
"and under a different package name."
)
object MicroGResourcePatch : ResourcePatch() {
override fun execute(context: ResourceContext) { override fun execute(context: ResourceContext) {
// update manifest // update manifest
MicroGResourceHelper.patchManifest( MicroGResourceHelper.patchManifest(

View file

@ -0,0 +1,26 @@
package app.revanced.patches.music.premium.backgroundplay
import app.revanced.extensions.exception
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.music.premium.backgroundplay.fingerprints.BackgroundPlaybackDisableFingerprint
@Patch(
name = "Background play",
description = "Enables playing music in the background.",
compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")]
)
@Suppress("unused")
object BackgroundPlayPatch : BytecodePatch(setOf(BackgroundPlaybackDisableFingerprint)) {
override fun execute(context: BytecodeContext) =
BackgroundPlaybackDisableFingerprint.result?.mutableMethod?.addInstructions(
0, """
const/4 v0, 0x1
return v0
"""
) ?: throw BackgroundPlaybackDisableFingerprint.exception
}

View file

@ -1,28 +0,0 @@
package app.revanced.patches.music.premium.backgroundplay.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.annotations.MusicCompatibility
import app.revanced.patches.music.premium.backgroundplay.fingerprints.BackgroundPlaybackDisableFingerprint
@Patch
@Name("Background play")
@Description("Enables playing music in the background.")
@MusicCompatibility
class BackgroundPlayPatch : BytecodePatch(
listOf(BackgroundPlaybackDisableFingerprint)
) {
override fun execute(context: BytecodeContext) {
BackgroundPlaybackDisableFingerprint.result!!.mutableMethod.addInstructions(
0,
"""
const/4 v0, 0x1
return v0
"""
)
}
}

View file

@ -0,0 +1,25 @@
package app.revanced.patches.myexpenses.misc.pro
import app.revanced.extensions.exception
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.myexpenses.misc.pro.fingerprints.IsEnabledFingerprint
@Patch(
name = "Unlock pro",
compatiblePackages = [CompatiblePackage("org.totschnig.myexpenses", ["3.4.9"])]
)
@Suppress("unused")
object UnlockProPatch : BytecodePatch(setOf(IsEnabledFingerprint)) {
override fun execute(context: BytecodeContext) = IsEnabledFingerprint.result?.mutableMethod?.addInstructions(
0,
"""
const/4 v0, 0x1
return v0
"""
) ?: throw IsEnabledFingerprint.exception
}

View file

@ -1,8 +0,0 @@
package app.revanced.patches.myexpenses.misc.pro.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility([Package("org.totschnig.myexpenses", arrayOf("3.4.9"))])
@Target(AnnotationTarget.CLASS)
internal annotation class UnlockProCompatibility

View file

@ -1,31 +0,0 @@
package app.revanced.patches.myexpenses.misc.pro.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.myexpenses.misc.pro.annotations.UnlockProCompatibility
import app.revanced.patches.myexpenses.misc.pro.fingerprints.IsEnabledFingerprint
@Patch
@Name("Unlock pro")
@Description("Unlocks all professional features.")
@UnlockProCompatibility
class UnlockProPatch : BytecodePatch(
listOf(
IsEnabledFingerprint
)
) {
override fun execute(context: BytecodeContext) {
val method = IsEnabledFingerprint.result!!.mutableMethod
method.addInstructions(
0,
"""
const/4 v0, 0x1
return v0
"""
)
}
}

View file

@ -1,18 +1,20 @@
package app.revanced.patches.netguard.broadcasts.removerestriction.resource.patch package app.revanced.patches.netguard.broadcasts.removerestriction
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.ResourceContext import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patches.netguard.broadcasts.removerestriction.resource.annotations.RemoveBroadcastsRestrictionCompatibility import app.revanced.patcher.patch.annotation.Patch
import org.w3c.dom.Element import org.w3c.dom.Element
@Patch(false)
@Name("Remove broadcasts restriction") @Patch(
@Description("Enables starting/stopping NetGuard via broadcasts.") name = "Remove broadcasts restriction",
@RemoveBroadcastsRestrictionCompatibility description = "Enables starting/stopping NetGuard via broadcasts.",
class RemoveBroadcastsRestrictionPatch : ResourcePatch { compatiblePackages = [CompatiblePackage("eu.faircode.netguard")],
use = false
)
@Suppress("unused")
object RemoveBroadcastsRestrictionPatch : ResourcePatch() {
override fun execute(context: ResourceContext) { override fun execute(context: ResourceContext) {
context.xmlEditor["AndroidManifest.xml"].use { dom -> context.xmlEditor["AndroidManifest.xml"].use { dom ->
val applicationNode = dom val applicationNode = dom

View file

@ -1,8 +0,0 @@
package app.revanced.patches.netguard.broadcasts.removerestriction.resource.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility([Package("eu.faircode.netguard")])
@Target(AnnotationTarget.CLASS)
annotation class RemoveBroadcastsRestrictionCompatibility

View file

@ -0,0 +1,25 @@
package app.revanced.patches.nfctoolsse.misc.pro
import app.revanced.extensions.exception
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.nfctoolsse.misc.pro.fingerprints.IsLicenseRegisteredFingerprint
@Patch(
name = "Unlock pro",
compatiblePackages = [CompatiblePackage("com.wakdev.apps.nfctools.se")]
)
@Suppress("unused")
object UnlockProPatch : BytecodePatch(setOf(IsLicenseRegisteredFingerprint)) {
override fun execute(context: BytecodeContext) = IsLicenseRegisteredFingerprint.result?.mutableMethod
?.addInstructions(
0, """
const/4 v0, 0x1
return v0
"""
) ?: throw IsLicenseRegisteredFingerprint.exception
}

View file

@ -1,8 +0,0 @@
package app.revanced.patches.nfctoolsse.misc.pro.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.wakdev.apps.nfctools.se")])
@Target(AnnotationTarget.CLASS)
internal annotation class UnlockProCompatibility

View file

@ -1,35 +0,0 @@
package app.revanced.patches.nfctoolsse.misc.pro.patch
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.nfctoolsse.misc.pro.annotations.UnlockProCompatibility
import app.revanced.patches.nfctoolsse.misc.pro.fingerprints.IsLicenseRegisteredFingerprint
@Patch
@Name("Unlock pro")
@Description("Unlocks all pro features.")
@UnlockProCompatibility
class UnlockProPatch : BytecodePatch(
listOf(
IsLicenseRegisteredFingerprint
)
) {
override fun execute(context: BytecodeContext) {
IsLicenseRegisteredFingerprint.result?.mutableMethod?.apply {
addInstructions(
0,
"""
const/4 v0, 0x1
return v0
"""
)
} ?: throw IsLicenseRegisteredFingerprint.exception
}
}

View file

@ -0,0 +1,24 @@
package app.revanced.patches.nyx.misc.pro
import app.revanced.extensions.exception
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.nyx.misc.pro.fingerprints.CheckProFingerprint
@Patch(
name = "Unlock pro",
compatiblePackages = [CompatiblePackage("com.awedea.nyx")]
)
@Suppress("unused")
object UnlockProPatch : BytecodePatch(setOf(CheckProFingerprint)) {
override fun execute(context: BytecodeContext) = CheckProFingerprint.result?.mutableMethod?.addInstructions(
0,
"""
const/4 v0, 0x1
return v0
"""
) ?: throw CheckProFingerprint.exception
}

View file

@ -1,8 +0,0 @@
package app.revanced.patches.nyx.misc.pro.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.awedea.nyx")])
@Target(AnnotationTarget.CLASS)
internal annotation class UnlockProCompatibility

View file

@ -1,31 +0,0 @@
package app.revanced.patches.nyx.misc.pro.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.nyx.misc.pro.annotations.UnlockProCompatibility
import app.revanced.patches.nyx.misc.pro.fingerprints.CheckProFingerprint
@Patch
@Name("Unlock pro")
@Description("Unlocks all pro features.")
@UnlockProCompatibility
class UnlockProPatch : BytecodePatch(
listOf(
CheckProFingerprint
)
) {
override fun execute(context: BytecodeContext) {
val method = CheckProFingerprint.result!!.mutableMethod
method.addInstructions(
0,
"""
const/4 v0, 0x1
return v0
"""
)
}
}

View file

@ -0,0 +1,30 @@
package app.revanced.patches.photomath.detection.deviceid
import app.revanced.extensions.exception
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.photomath.detection.deviceid.fingerprints.GetDeviceIdFingerprint
import app.revanced.patches.photomath.detection.signature.SignatureDetectionPatch
import kotlin.random.Random
@Patch(
name = "Spoof device ID",
description = "Spoofs device ID to mitigate manual bans by developers.",
dependencies = [SignatureDetectionPatch::class],
compatiblePackages = [CompatiblePackage("com.microblink.photomath")]
)
@Suppress("unused")
object SpoofDeviceIdPatch : BytecodePatch(
setOf(GetDeviceIdFingerprint)
){
override fun execute(context: BytecodeContext) = GetDeviceIdFingerprint.result?.mutableMethod?.replaceInstructions(
0,
"""
const-string v0, "${Random.nextLong().toString(16)}"
return-object v0
"""
) ?: throw GetDeviceIdFingerprint.exception
}

View file

@ -1,32 +0,0 @@
package app.revanced.patches.photomath.detection.deviceid.patch
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Package
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.photomath.detection.deviceid.fingerprints.GetDeviceIdFingerprint
import app.revanced.patches.photomath.detection.signature.patch.SignatureDetectionPatch
import kotlin.random.Random
@Patch
@DependsOn([SignatureDetectionPatch::class])
@Name("Spoof device ID")
@Description("Spoofs device ID to mitigate manual bans by developers.")
@Compatibility([Package("com.microblink.photomath")])
class SpoofDeviceIdPatch : BytecodePatch(
listOf(GetDeviceIdFingerprint)
) {
override fun execute(context: BytecodeContext) = GetDeviceIdFingerprint.result?.mutableMethod?.replaceInstructions(
0,
"""
const-string v0, "${Random.nextLong().toString(16)}"
return-object v0
"""
) ?: throw GetDeviceIdFingerprint.exception
}

View file

@ -1,19 +1,17 @@
package app.revanced.patches.photomath.detection.signature.patch package app.revanced.patches.photomath.detection.signature
import app.revanced.extensions.exception import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.photomath.detection.signature.fingerprints.CheckSignatureFingerprint import app.revanced.patches.photomath.detection.signature.fingerprints.CheckSignatureFingerprint
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@Description("Disables detection of incorrect signature.") @Patch(description = "Disables detection of incorrect signature.")
class SignatureDetectionPatch : BytecodePatch( object SignatureDetectionPatch : BytecodePatch(
listOf( setOf(CheckSignatureFingerprint)
CheckSignatureFingerprint
)
) { ) {
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
CheckSignatureFingerprint.result?.apply { CheckSignatureFingerprint.result?.apply {

View file

@ -1,14 +1,16 @@
package app.revanced.patches.photomath.misc.bookpoint.patch package app.revanced.patches.photomath.misc.bookpoint
import app.revanced.extensions.exception import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.photomath.misc.bookpoint.fingerprints.IsBookpointEnabledFingerprint import app.revanced.patches.photomath.misc.bookpoint.fingerprints.IsBookpointEnabledFingerprint
@Description("Enables textbook access") @Patch(description = "Enables textbook access")
class EnableBookpointPatch : BytecodePatch(listOf(IsBookpointEnabledFingerprint)) { object EnableBookpointPatch : BytecodePatch(
setOf(IsBookpointEnabledFingerprint)
) {
override fun execute(context: BytecodeContext) = override fun execute(context: BytecodeContext) =
IsBookpointEnabledFingerprint.result?.mutableMethod?.replaceInstructions( IsBookpointEnabledFingerprint.result?.mutableMethod?.replaceInstructions(
0, 0,

View file

@ -0,0 +1,29 @@
package app.revanced.patches.photomath.misc.unlockplus
import app.revanced.extensions.exception
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.photomath.detection.signature.SignatureDetectionPatch
import app.revanced.patches.photomath.misc.bookpoint.EnableBookpointPatch
import app.revanced.patches.photomath.misc.unlockplus.fingerprints.IsPlusUnlockedFingerprint
@Patch(
name = "Unlock plus",
dependencies = [SignatureDetectionPatch::class, EnableBookpointPatch::class],
compatiblePackages = [CompatiblePackage("com.microblink.photomath")]
)
@Suppress("unused")
object UnlockPlusPatch : BytecodePatch(
setOf(IsPlusUnlockedFingerprint)
){
override fun execute(context: BytecodeContext) = IsPlusUnlockedFingerprint.result?.mutableMethod?.addInstructions(
0,
"""
const/4 v0, 0x1
return v0
"""
) ?: throw IsPlusUnlockedFingerprint.exception
}

View file

@ -1,30 +0,0 @@
package app.revanced.patches.photomath.misc.unlockplus.patch
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Package
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.photomath.detection.signature.patch.SignatureDetectionPatch
import app.revanced.patches.photomath.misc.bookpoint.patch.EnableBookpointPatch
import app.revanced.patches.photomath.misc.unlockplus.fingerprints.IsPlusUnlockedFingerprint
@Patch
@Name("Unlock plus")
@DependsOn([SignatureDetectionPatch::class, EnableBookpointPatch::class])
@Compatibility([Package("com.microblink.photomath")])
class UnlockPlusPatch : BytecodePatch(
listOf(IsPlusUnlockedFingerprint)
) {
override fun execute(context: BytecodeContext) = IsPlusUnlockedFingerprint.result?.mutableMethod?.addInstructions(
0,
"""
const/4 v0, 0x1
return v0
"""
) ?: throw IsPlusUnlockedFingerprint.exception
}

View file

@ -0,0 +1,28 @@
package app.revanced.patches.pixiv.ads
import app.revanced.extensions.exception
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.pixiv.ads.fingerprints.IsNotPremiumFingerprint
@Patch(
name = "Hide ads",
compatiblePackages = [CompatiblePackage("jp.pxv.android")]
)
@Suppress("unused")
object HideAdsPatch : BytecodePatch(setOf(IsNotPremiumFingerprint)) {
// Always return false in the "isNotPremium" method which normally returns !this.accountManager.isPremium.
// However, this is not the method that controls the user's premium status.
// Instead, this method is used to determine whether ads should be shown.
override fun execute(context: BytecodeContext) =
IsNotPremiumFingerprint.result?.mutableClass?.virtualMethods?.first()?.addInstructions(
0,
"""
const/4 v0, 0x0
return v0
"""
) ?: throw IsNotPremiumFingerprint.exception
}

View file

@ -1,28 +0,0 @@
package app.revanced.patches.pixiv.ads.patch
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.*
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.pixiv.ads.fingerprints.IsNotPremiumFingerprint
@Patch
@Name("Hide ads")
@Description("Hides ads.")
@Compatibility([Package("jp.pxv.android")])
class HideAdsPatch : BytecodePatch(listOf(IsNotPremiumFingerprint)) {
override fun execute(context: BytecodeContext) {
// Always return false in the "isNotPremium" method which normally returns !this.accountManager.isPremium.
// However, this is not the method that controls the user's premium status.
// Instead, this method is used to determine whether ads should be shown.
IsNotPremiumFingerprint.result?.mutableClass?.virtualMethods?.first()?.addInstructions(
0,
"""
const/4 v0, 0x0
return v0
"""
) ?: throw IsNotPremiumFingerprint.exception
}
}

View file

@ -1,13 +1,13 @@
package app.revanced.patches.reddit.ad.banner.patch package app.revanced.patches.reddit.ad.banner
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.ResourceContext import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotation.Patch
@Patch(description = "Hides banner ads from comments on subreddits.")
object HideBannerPatch : ResourcePatch() {
private const val RESOURCE_FILE_PATH = "res/layout/merge_listheader_link_detail.xml"
@Name("Hide subreddit banner")
@Description("Hides banner ads from comments on subreddits.")
class HideBannerPatch : ResourcePatch {
override fun execute(context: ResourceContext) { override fun execute(context: ResourceContext) {
context.xmlEditor[RESOURCE_FILE_PATH].use { context.xmlEditor[RESOURCE_FILE_PATH].use {
it.file.getElementsByTagName("merge").item(0).childNodes.apply { it.file.getElementsByTagName("merge").item(0).childNodes.apply {
@ -29,9 +29,5 @@ class HideBannerPatch : ResourcePatch {
} }
} }
} }
private companion object {
const val RESOURCE_FILE_PATH = "res/layout/merge_listheader_link_detail.xml"
}
} }

View file

@ -0,0 +1,22 @@
package app.revanced.patches.reddit.ad.comments
import app.revanced.extensions.exception
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.reddit.ad.comments.fingerprints.HideCommentAdsFingerprint
@Patch(description = "Removes ads in the comments.",)
object HideCommentAdsPatch : BytecodePatch(
setOf(HideCommentAdsFingerprint)
) {
// Returns a blank object instead of the comment ad.
override fun execute(context: BytecodeContext) = HideCommentAdsFingerprint.result?.mutableMethod?.addInstructions(
0, """
new-instance v0, Ljava/lang/Object;
invoke-direct {v0}, Ljava/lang/Object;-><init>()V
return-object v0
"""
) ?: throw HideCommentAdsFingerprint.exception
}

View file

@ -1,27 +0,0 @@
package app.revanced.patches.reddit.ad.comments.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patches.reddit.ad.comments.fingerprints.HideCommentAdsFingerprint
@Name("Hide comment ads")
@Description("Removes all comment ads.")
class HideCommentAdsPatch : BytecodePatch(
listOf(HideCommentAdsFingerprint)
) {
override fun execute(context: BytecodeContext) {
val method = HideCommentAdsFingerprint.result!!.mutableMethod
// Returns a blank object instead of the comment ad.
method.addInstructions(
0,
"""
new-instance v0, Ljava/lang/Object;
invoke-direct {v0}, Ljava/lang/Object;-><init>()V
return-object v0
"""
)
}
}

View file

@ -1,17 +1,13 @@
package app.revanced.patches.reddit.ad.general.patch package app.revanced.patches.reddit.ad.general
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patcher.patch.annotations.RequiresIntegrations import app.revanced.patches.reddit.ad.banner.HideBannerPatch
import app.revanced.patches.reddit.ad.banner.patch.HideBannerPatch import app.revanced.patches.reddit.ad.comments.HideCommentAdsPatch
import app.revanced.patches.reddit.ad.comments.patch.HideCommentAdsPatch
import app.revanced.patches.reddit.ad.general.annotations.HideAdsCompatibility
import app.revanced.patches.reddit.ad.general.fingerprints.AdPostFingerprint import app.revanced.patches.reddit.ad.general.fingerprints.AdPostFingerprint
import app.revanced.patches.reddit.ad.general.fingerprints.NewAdPostFingerprint import app.revanced.patches.reddit.ad.general.fingerprints.NewAdPostFingerprint
import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.Opcode
@ -20,15 +16,19 @@ import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction22c
import com.android.tools.smali.dexlib2.iface.reference.FieldReference import com.android.tools.smali.dexlib2.iface.reference.FieldReference
import com.android.tools.smali.dexlib2.iface.reference.MethodReference import com.android.tools.smali.dexlib2.iface.reference.MethodReference
@Patch
@Name("Hide ads") @Patch(
@Description("Removes ads from the Reddit.") name = "Hide ads",
@DependsOn([HideBannerPatch::class, HideCommentAdsPatch::class]) dependencies = [HideBannerPatch::class, HideCommentAdsPatch::class],
@HideAdsCompatibility compatiblePackages = [CompatiblePackage("com.reddit.frontpage")],
@RequiresIntegrations requiresIntegrations = true,
class HideAdsPatch : BytecodePatch( )
listOf(AdPostFingerprint, NewAdPostFingerprint) @Suppress("unused")
) { object HideAdsPatch : BytecodePatch(setOf(AdPostFingerprint, NewAdPostFingerprint)) {
private const val FILTER_METHOD_DESCRIPTOR =
"Lapp/revanced/reddit/patches/FilterPromotedLinksPatch;" +
"->filterChildren(Ljava/lang/Iterable;)Ljava/util/List;"
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
// region Filter promoted ads (does not work in popular or latest feed) // region Filter promoted ads (does not work in popular or latest feed)
@ -77,10 +77,4 @@ class HideAdsPatch : BytecodePatch(
// endregion // endregion
} }
private companion object {
private const val FILTER_METHOD_DESCRIPTOR =
"Lapp/revanced/reddit/patches/FilterPromotedLinksPatch;" +
"->filterChildren(Ljava/lang/Iterable;)Ljava/util/List;"
}
} }

View file

@ -1,8 +0,0 @@
package app.revanced.patches.reddit.ad.general.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.reddit.frontpage")])
@Target(AnnotationTarget.CLASS)
internal annotation class HideAdsCompatibility

View file

@ -6,22 +6,27 @@ import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.OptionsContainer
import app.revanced.patcher.patch.PatchException import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.patch.PatchOption import app.revanced.patcher.patch.options.types.StringPatchOption.Companion.stringPatchOption
import java.io.File import java.io.File
abstract class AbstractSpoofClientPatch( abstract class AbstractSpoofClientPatch(
private val redirectUri: String, private val redirectUri: String,
private val options: SpoofClientOptionsContainer,
private val clientIdFingerprints: List<MethodFingerprint>, private val clientIdFingerprints: List<MethodFingerprint>,
private val userAgentFingerprints: List<MethodFingerprint>? = null, private val userAgentFingerprints: List<MethodFingerprint>? = null,
) : BytecodePatch(buildList { ) : BytecodePatch(buildSet {
addAll(clientIdFingerprints) addAll(clientIdFingerprints)
userAgentFingerprints?.let(::addAll) userAgentFingerprints?.let(::addAll)
}) { }) {
var clientId by stringPatchOption(
"client-id",
null,
"OAuth client ID",
"The Reddit OAuth client ID."
)
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
if (options.clientId == null) { if (clientId == null) {
// Ensure device runs Android. // Ensure device runs Android.
try { try {
Class.forName("android.os.Environment") Class.forName("android.os.Environment")
@ -42,7 +47,7 @@ abstract class AbstractSpoofClientPatch(
""".trimIndent() """.trimIndent()
throw PatchException(error) throw PatchException(error)
}.let { options.clientId = it.readText().trim() } }.let { clientId = it.readText().trim() }
} }
fun List<MethodFingerprint>?.executePatch( fun List<MethodFingerprint>?.executePatch(
@ -68,17 +73,4 @@ abstract class AbstractSpoofClientPatch(
*/ */
// Not every client needs to patch the user agent. // Not every client needs to patch the user agent.
open fun List<MethodFingerprintResult>.patchUserAgent(context: BytecodeContext) {} open fun List<MethodFingerprintResult>.patchUserAgent(context: BytecodeContext) {}
companion object Options {
open class SpoofClientOptionsContainer : OptionsContainer() {
var clientId by option(
PatchOption.StringOption(
"client-id",
null,
"OAuth client ID",
"The Reddit OAuth client ID."
)
)
}
}
} }

View file

@ -1,9 +0,0 @@
package app.revanced.patches.reddit.customclients
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.patch.annotations.Patch
@Target(AnnotationTarget.CLASS)
@Patch
@Name("Spoof client")
annotation class SpoofClientAnnotation

Some files were not shown because too many files have changed in this diff Show more