Shamrock: add switch of anti trace

This commit is contained in:
Simplxs 2023-11-26 16:16:10 +08:00
parent f63bcabf1b
commit 4a4507dfcd
No known key found for this signature in database
GPG Key ID: E23537FF14DD6507
7 changed files with 42 additions and 18 deletions

View File

@ -224,6 +224,16 @@ object ShamrockConfig {
preferences.edit().putBoolean("debug", v).apply()
}
fun isAntiTrace(ctx: Context): Boolean {
val preferences = ctx.getSharedPreferences("config", 0)
return preferences.getBoolean("anti_qq_trace", true)
}
fun setAntiTrace(ctx: Context, v: Boolean) {
val preferences = ctx.getSharedPreferences("config", 0)
preferences.edit().putBoolean("anti_qq_trace", v).apply()
}
fun isInjectPacket(ctx: Context): Boolean {
val preferences = ctx.getSharedPreferences("config", 0)
return preferences.getBoolean("inject_packet", false)
@ -293,6 +303,7 @@ object ShamrockConfig {
"ssl_pwd" to preferences.getString("ssl_pwd", ""),
"inject_packet" to preferences.getBoolean("inject_packet", false),
"debug" to preferences.getBoolean("debug", false),
"anti_qq_trace" to preferences.getBoolean("anti_qq_trace", true),
"auto_clear" to preferences.getBoolean("auto_clear", false),
"ssl_private_pwd" to preferences.getString("ssl_private_pwd", ""),
"key_store" to preferences.getString("key_store", ""),

View File

@ -1,7 +1,6 @@
package moe.fuqiuluo.shamrock.ui.fragment
import android.content.Context
import android.widget.Toast
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.absolutePadding
import androidx.compose.foundation.layout.fillMaxSize
@ -85,6 +84,17 @@ fun LabFragment() {
ShamrockConfig.pushUpdate(ctx)
return@Function true
}
Function(
title = "防止调用栈检测",
desc = "防止QQ进行堆栈跟踪检测需要重新启动QQ。",
descColor = it,
isSwitch = ShamrockConfig.isAntiTrace(ctx)
) {
ShamrockConfig.setAntiTrace(ctx, it)
ShamrockConfig.pushUpdate(ctx)
return@Function true
}
}
}

View File

@ -33,7 +33,7 @@ public class MMKV implements SharedPreferences, SharedPreferences.Editor {
return null;
}
public SharedPreferences.Editor putBoolean(String str, boolean z) {
public SharedPreferences.Editor putBoolean(String s, boolean z) {
return this;
}

View File

@ -96,5 +96,11 @@ dependencies {
//ksp("androidx.room:room-compiler:$roomVersion")
// optional - Kotlin Extensions and Coroutines support for Room
implementation("androidx.room:room-ktx:$roomVersion")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
androidTestImplementation(platform("androidx.compose:compose-bom:2023.06.01"))
androidTestImplementation("androidx.compose.ui:ui-test-junit4")
}

View File

@ -7,7 +7,6 @@ import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.launch
import moe.fuqiuluo.shamrock.remote.service.api.WebSocketClientServlet
import moe.fuqiuluo.shamrock.remote.service.data.push.*
import moe.fuqiuluo.shamrock.helper.Level
import moe.fuqiuluo.shamrock.helper.LogCenter
import moe.fuqiuluo.shamrock.remote.service.api.GlobalEventTransmitter
@ -35,7 +34,7 @@ internal class WebSocketClientService(
}
})
submitFlowJob(GlobalScope.launch {
GlobalEventTransmitter.onRequestEvent() { event ->
GlobalEventTransmitter.onRequestEvent { event ->
pushTo(event)
}
})

View File

@ -43,6 +43,7 @@ internal object ShamrockConfig {
putBoolean( "debug", intent.getBooleanExtra("debug", false)) // 调试模式
Config.defaultToken = intent.getStringExtra("token")
Config.antiTrace = intent.getBooleanExtra("anti_qq_trace", true)
val wsPort = intent.getIntExtra("ws_port", 5800)
Config.activeWebSocket = if (Config.activeWebSocket == null) ConnectionConfig(

View File

@ -5,16 +5,13 @@ import android.content.Context
import android.content.pm.PackageManager
import android.content.pm.VersionedPackage
import android.os.Build
import de.robv.android.xposed.XC_MethodHook
import de.robv.android.xposed.XC_MethodReplacement
import de.robv.android.xposed.XposedBridge
import de.robv.android.xposed.XposedHelpers
import moe.fuqiuluo.shamrock.helper.Level
import moe.fuqiuluo.shamrock.helper.LogCenter
import moe.fuqiuluo.shamrock.remote.service.config.ShamrockConfig
import moe.fuqiuluo.shamrock.tools.hookMethod
import moe.fuqiuluo.shamrock.xposed.loader.LuoClassloader
import mqq.app.MobileQQ
/**
* 反检测