Skip to content

Commit

Permalink
优化
Browse files Browse the repository at this point in the history
  • Loading branch information
lingqiqi5211 committed Dec 1, 2023
1 parent eae824a commit 6a2c1ef
Show file tree
Hide file tree
Showing 10 changed files with 70 additions and 261 deletions.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ package com.sevtinge.hyperceiler.module.hook.mediaeditor

import android.os.Build
import com.github.kyuubiran.ezxhelper.ClassLoaderProvider.safeClassLoader
import com.github.kyuubiran.ezxhelper.ClassUtils.loadClass
import com.github.kyuubiran.ezxhelper.ClassUtils.setStaticObject
import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook
import com.sevtinge.hyperceiler.module.base.BaseHook
import com.sevtinge.hyperceiler.utils.DexKit.addUsingStringsEquals
import com.sevtinge.hyperceiler.utils.DexKit.dexKitBridge
import com.sevtinge.hyperceiler.utils.api.LazyClass.AndroidBuildCls
import org.luckypray.dexkit.query.enums.StringMatchType


object FilterManagerAll : BaseHook() {
Expand All @@ -23,11 +21,6 @@ object FilterManagerAll : BaseHook() {
}

override fun init() {
/*val result = mMediaEditorResultMethodsMap["FilterManager"]!!
val methodResult = result
MethodFinder.fromArray(methodResult).first {
returnType == List::class.java || (parameterCount == 1 && parameterTypes[0] == Bundle::class.java)
}*/
methodResult?.createHook {
before {
if (!this@FilterManagerAll::device.isInitialized) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.sevtinge.hyperceiler.module.hook.mediaeditor

import com.github.kyuubiran.ezxhelper.EzXHelper
import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHooks
import com.github.kyuubiran.ezxhelper.EzXHelper.safeClassLoader
import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook
import com.sevtinge.hyperceiler.module.base.BaseHook
import com.sevtinge.hyperceiler.utils.DexKit.addUsingStringsEquals
import com.sevtinge.hyperceiler.utils.DexKit.dexKitBridge
Expand All @@ -20,13 +20,11 @@ object UnlockDisney : BaseHook() {
returnType = "boolean"
paramCount = 0
}
}.map { it.getMethodInstance(EzXHelper.classLoader) }.toList()
}.firstOrNull()?.getMethodInstance(safeClassLoader)

// debug 用
for (d in disney) {
logI(TAG,"disney name is $d")
}
disney.createHooks {
logI(TAG,"disney name is $disney")
disney!!.createHook {
returnConstant(true)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.sevtinge.hyperceiler.module.hook.mishare

import android.annotation.SuppressLint
import com.github.kyuubiran.ezxhelper.EzXHelper.classLoader
import com.github.kyuubiran.ezxhelper.EzXHelper.safeClassLoader
import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook
import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHooks
import com.sevtinge.hyperceiler.module.base.BaseHook
Expand All @@ -10,13 +12,14 @@ import com.sevtinge.hyperceiler.utils.api.BlurDraw.getValueByFields
import de.robv.android.xposed.XposedHelpers
import java.lang.reflect.Modifier

@SuppressLint("StaticFieldLeak")
object NoAutoTurnOff : BaseHook() {
private val nullMethod by lazy {
dexKitBridge.findMethod {
matcher {
addUsingStringsEquals("EnabledState", "mishare_enabled")
}
}.map { it.getMethodInstance(classLoader) }.toList()
}.firstOrNull()?.getMethodInstance(safeClassLoader)
}

private val null2Method by lazy {
Expand All @@ -28,7 +31,7 @@ object NoAutoTurnOff : BaseHook() {
paramCount = 2
modifiers = Modifier.STATIC
}
}.map { it.getMethodInstance(classLoader) }.first()
}.firstOrNull()?.getMethodInstance(safeClassLoader)
}

private val null3Method by lazy {
Expand Down Expand Up @@ -74,22 +77,28 @@ object NoAutoTurnOff : BaseHook() {

val nullField = dexKitBridge.findField {
matcher {
declaredClass(nullClass)
modifiers = Modifier.STATIC
addReadMethod {
addUsingStringsEquals("NfcShareTaskManager")
returnType = "void"
paramCount = 1
modifiers = Modifier.PRIVATE
}
modifiers = Modifier.STATIC or Modifier.FINAL
type = "int"
}
}.map { it.getFieldInstance(classLoader) }.first()
}.firstOrNull()?.getFieldInstance(safeClassLoader)

// 禁用小米互传功能自动关闭部分
try {
nullMethod.createHooks {
nullMethod!!.createHook {
returnConstant(null)
}
} catch (t: Throwable) {
logE(TAG, this.lpparam.packageName, "nullMethod hook failed", t)
}

try {
null2Method.createHook {
null2Method!!.createHook {
returnConstant(null)
}
} catch (t: Throwable) {
Expand All @@ -115,7 +124,7 @@ object NoAutoTurnOff : BaseHook() {
try {
findAndHookConstructor(nullClass, object : MethodHook() {
override fun after(param: MethodHookParam) {
XposedHelpers.setObjectField(param.thisObject, nullField.name, 999999999)
XposedHelpers.setObjectField(param.thisObject, nullField!!.name, 999999999)
logI(nullField.name)
} })
} catch (t: Throwable) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
package com.sevtinge.hyperceiler.module.hook.screenrecorder

import android.annotation.SuppressLint
import com.github.kyuubiran.ezxhelper.EzXHelper
import com.github.kyuubiran.ezxhelper.EzXHelper.safeClassLoader
import com.sevtinge.hyperceiler.module.base.BaseHook
import com.sevtinge.hyperceiler.utils.DexKit.addUsingStringsEquals
import com.sevtinge.hyperceiler.utils.DexKit.dexKitBridge
import de.robv.android.xposed.XposedHelpers

@SuppressLint("StaticFieldLeak")
object UnlockMoreVolumeFromNew : BaseHook() {
private val getClass by lazy {
dexKitBridge.findClass {
matcher {
addUsingStringsEquals("support_a2dp_inner_record")
}
}.map { it.getInstance(EzXHelper.classLoader) }.first()
}.firstOrNull()?.getInstance(safeClassLoader)
}

override fun init() {
val fieldData = dexKitBridge.findField {
matcher {
declaredClass(getClass)
getClass?.let { declaredClass(it) }
type = "boolean"

}
}.map { it.getFieldInstance(EzXHelper.classLoader) }.toList()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,37 +1,29 @@
package com.sevtinge.hyperceiler.module.hook.screenshot

import android.annotation.SuppressLint
import com.github.kyuubiran.ezxhelper.EzXHelper
import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook
import com.sevtinge.hyperceiler.module.base.BaseHook
import com.sevtinge.hyperceiler.utils.DexKit.addUsingStringsEquals
import com.sevtinge.hyperceiler.utils.DexKit.dexKitBridge
import java.lang.reflect.Modifier

@SuppressLint("StaticFieldLeak")
object UnlockMinimumCropLimit : BaseHook() {
private val mScreenCropViewMethod by lazy {
dexKitBridge.findMethod {
matcher {
declaredClass {
addUsingStringsEquals("fixImageBounds %f,%f")
}
usingNumbers(0.5f, 200)
returnType = "int"
paramCount = 0
modifiers = Modifier.PRIVATE
}
}.map { it.getMethodInstance(EzXHelper.classLoader) }.first()
}.firstOrNull()?.getMethodInstance(EzXHelper.safeClassLoader)
}


override fun init() {
mScreenCropViewMethod.createHook {
mScreenCropViewMethod!!.createHook {
returnConstant(0)
}

/*val mScreenCropView =
findClassIfExists("com.miui.gallery.editor.photo.screen.crop.ScreenCropView\$h")
returnIntConstant(mScreenCropView, "a")*/
}

/*private fun returnIntConstant(cls: Class<*>?, methodName: String) {
findAndHookMethod(cls, methodName, XC_MethodReplacement.returnConstant(0))
}*/
}
Loading

0 comments on commit 6a2c1ef

Please sign in to comment.