generated from ReVanced/revanced-patches-template
-
-
Notifications
You must be signed in to change notification settings - Fork 454
feat(Instagram): Support app version 378.0.0.52.68
and add bypass check signature
#4901
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+43
−1
Merged
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
dd9e883
Fix instagram ads fingerprint
hoo-dles 25d6a26
Implementing bypass of signature check
hoo-dles c9988cc
Apply suggestions from code review
oSumAtrIX 8f8c0c1
Apply suggestions from code review
oSumAtrIX 19cc2af
Updating patch to be simpler without convoluted logic
hoo-dles 784f1af
Update patches/src/main/kotlin/app/revanced/patches/instagram/misc/si…
LisoUseInAIKyrios 775f15c
Update patches/src/main/kotlin/app/revanced/patches/instagram/misc/si…
LisoUseInAIKyrios 3f4972a
Update patches/src/main/kotlin/app/revanced/patches/instagram/misc/si…
LisoUseInAIKyrios 56c9376
Fixing imports for build issues
hoo-dles File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Implementing bypass of signature check
- Loading branch information
commit 25d6a269527844dcb25d436ca71ac13b2cec02f0
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
patches/src/main/kotlin/app/revanced/patches/instagram/misc/signature/Fingerprints.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package app.revanced.patches.instagram.misc.signature | ||
|
||
import app.revanced.patcher.fingerprint | ||
import com.android.tools.smali.dexlib2.Opcode | ||
|
||
internal val launcherFingerprint = fingerprint { | ||
opcodes( | ||
Opcode.INVOKE_STATIC, | ||
Opcode.INVOKE_VIRTUAL, | ||
Opcode.RETURN_VOID | ||
) | ||
strings( | ||
"com.instagram.mainactivity.InstagramMainActivity", | ||
"redirect_from_launcher_activity" | ||
) | ||
} | ||
|
||
internal val onReceiveNotificationFingerprint = fingerprint { | ||
opcodes( | ||
Opcode.INVOKE_STATIC, | ||
Opcode.CONST, | ||
Opcode.GOTO | ||
) | ||
custom { method, classDef -> | ||
method.name == "onReceive" && classDef.endsWith("/NotificationActionReceiver;") | ||
} | ||
} | ||
LisoUseInAIKyrios marked this conversation as resolved.
Show resolved
Hide resolved
|
47 changes: 47 additions & 0 deletions
47
patches/src/main/kotlin/app/revanced/patches/instagram/misc/signature/SignatureCheckPatch.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package app.revanced.patches.instagram.misc.signature | ||
|
||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction | ||
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction | ||
import app.revanced.patcher.patch.bytecodePatch | ||
import app.revanced.util.indexOfFirstInstruction | ||
import com.android.tools.smali.dexlib2.Opcode | ||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction | ||
|
||
@Suppress("unused") | ||
val signatureCheckPatch = bytecodePatch( | ||
name = "Disable signature check", | ||
description = "Disables the signature check that causes any modified app to crash on startup." | ||
LisoUseInAIKyrios marked this conversation as resolved.
Show resolved
Hide resolved
|
||
) { | ||
compatibleWith("com.instagram.android"("378.0.0.52.68")) | ||
LisoUseInAIKyrios marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// Patching method is inspired by: | ||
// https://github.com/mamiiblt/instafel/blob/032c6a714a4a862462cd4bcd106083f640b13219/instafel.patcher/src/main/java/me/mamiiblt/instafel/patcher/patches/fix/FixSecureCtxCrash.java | ||
// | ||
// Logic has been adapted to rely less on garbled method names that are likely to change. Instagram's code is | ||
// highly obfuscated, so any comments on code flow are best guesses. | ||
execute { | ||
// Main activity insertion point from NotificationAction receiver bypasses IgSecureContext check. Get the | ||
// method it calls, and use it to replace the method called by the Launcher. | ||
val safeMethod = onReceiveNotificationFingerprint.let { it -> | ||
oSumAtrIX marked this conversation as resolved.
Show resolved
Hide resolved
hoo-dles marked this conversation as resolved.
Show resolved
Hide resolved
hoo-dles marked this conversation as resolved.
Show resolved
Hide resolved
|
||
navigate(it.method) | ||
.to(it.patternMatch!!.startIndex) // navigate into invoke-static | ||
.to { instr -> instr.opcode == Opcode.INVOKE_VIRTUAL } // navigate to first invoke-virtual | ||
oSumAtrIX marked this conversation as resolved.
Show resolved
Hide resolved
|
||
.original() | ||
} | ||
|
||
launcherFingerprint.let { | ||
hoo-dles marked this conversation as resolved.
Show resolved
Hide resolved
|
||
navigate(it.method) | ||
.to(it.patternMatch!!.startIndex) // navigate into invoke-static | ||
.stop() // patch this method | ||
hoo-dles marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}.apply { | ||
val targetIndex = indexOfFirstInstruction(Opcode.INVOKE_VIRTUAL) | ||
val origReg = getInstruction<FiveRegisterInstruction>(targetIndex).registerD | ||
hoo-dles marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// Only replace the method called on this class's singleton. | ||
replaceInstruction( | ||
targetIndex, | ||
"invoke-virtual { v$origReg }, $safeMethod" | ||
) | ||
} | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.