feat: bypass screenshot detection

This commit is contained in:
rhunk
2023-11-10 19:21:19 +01:00
parent 9365528c74
commit b120b6a27d
4 changed files with 30 additions and 0 deletions

View File

@ -312,6 +312,10 @@
"name": "Messaging",
"description": "Change how you interact with friends",
"properties": {
"bypass_screenshot_detection": {
"name": "Bypass Screenshot Detection",
"description": "Prevents Snapchat from detecting when you take a screenshot"
},
"anonymous_story_viewing": {
"name": "Anonymous Story Viewing",
"description": "Prevents anyone from knowing you've seen their story"

View File

@ -5,6 +5,7 @@ import me.rhunk.snapenhance.common.config.FeatureNotice
import me.rhunk.snapenhance.common.data.NotificationType
class MessagingTweaks : ConfigContainer() {
val bypassScreenshotDetection = boolean("bypass_screenshot_detection") { requireRestart() }
val anonymousStoryViewing = boolean("anonymous_story_viewing")
val hideBitmojiPresence = boolean("hide_bitmoji_presence")
val hideTypingNotifications = boolean("hide_typing_notifications")

View File

@ -0,0 +1,23 @@
package me.rhunk.snapenhance.core.features.impl.tweaks
import android.content.ContentResolver
import android.database.ContentObserver
import android.net.Uri
import me.rhunk.snapenhance.core.features.Feature
import me.rhunk.snapenhance.core.features.FeatureLoadParams
import me.rhunk.snapenhance.core.util.hook.HookStage
import me.rhunk.snapenhance.core.util.hook.hook
class BypassScreenshotDetection : Feature("BypassScreenshotDetection", loadParams = FeatureLoadParams.ACTIVITY_CREATE_SYNC) {
override fun onActivityCreate() {
if (!context.config.messaging.bypassScreenshotDetection.get()) return
ContentResolver::class.java.methods.first {
it.name == "registerContentObserver" &&
it.parameterTypes.contentEquals(arrayOf(android.net.Uri::class.java, Boolean::class.javaPrimitiveType, ContentObserver::class.java))
}.hook(HookStage.BEFORE) { param ->
val uri = param.arg<Uri>(0)
if (uri.host != "media") return@hook
param.setResult(null)
}
}
}

View File

@ -17,6 +17,7 @@ import me.rhunk.snapenhance.core.features.impl.messaging.*
import me.rhunk.snapenhance.core.features.impl.spying.MessageLogger
import me.rhunk.snapenhance.core.features.impl.spying.StealthMode
import me.rhunk.snapenhance.core.features.impl.tweaks.CameraTweaks
import me.rhunk.snapenhance.core.features.impl.tweaks.BypassScreenshotDetection
import me.rhunk.snapenhance.core.features.impl.ui.*
import me.rhunk.snapenhance.core.logger.CoreLogger
import me.rhunk.snapenhance.core.manager.Manager
@ -103,6 +104,7 @@ class FeatureManager(
CallStartConfirmation::class,
SnapPreview::class,
InstantDelete::class,
BypassScreenshotDetection::class,
)
initializeFeatures()