This commit is contained in:
2022-02-07 02:45:25 +08:00
parent ffc07e7241
commit e1fdc90e91
9 changed files with 28 additions and 13 deletions

View File

@@ -24,6 +24,8 @@
拥有丰富的调试日志功能,细到每个 Hook 方法的名称、所在类以及查找耗时,可进行快速调试和排错。<br/>
- <strong>方便移植</strong><br/>
原生支持 Xposed API 用法,并原生对接 Xposed API拥有 Xposed API 的 Hook 框架都能快速对接 Yuki Hook API。<br/>
- <strong>支持混淆</strong><br/>
使用 Yuki Hook API 构建的 Xposed 模块原生支持代码 R8 压缩优化混淆,可增加反编译难度以及代码安全性,无需任何配置。<br/>
- <strong>快速上手</strong><br/>
简单易用,不需要繁琐的配置,不需要十足的开发经验,搭建环境集成依赖即可立即开始使用。

View File

@@ -30,7 +30,7 @@ android {
buildTypes {
release {
minifyEnabled false
minifyEnabled true
signingConfig signingConfigs.debug
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}

View File

@@ -27,9 +27,13 @@
*/
package com.highcapable.yukihookapi.demo
import androidx.annotation.Keep
// for test
@Keep
class InjectTest(private val string: String) {
// for test
@Keep
fun getString() = string
}

View File

@@ -27,9 +27,13 @@
*/
package com.highcapable.yukihookapi.demo
import androidx.annotation.Keep
// for test
@Keep
class InjectTestName(private val string: String) {
// for test
@Keep
fun getString() = string
}

View File

@@ -31,12 +31,15 @@ package com.highcapable.yukihookapi.demo
import android.os.Bundle
import android.widget.Toast
import androidx.annotation.Keep
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
import com.highcapable.yukihookapi.hook.xposed.YukiHookModuleStatus
@Keep
class MainActivity : AppCompatActivity() {
@Keep
private var a = "没更改的变量"
override fun onCreate(savedInstanceState: Bundle?) {
@@ -66,14 +69,18 @@ class MainActivity : AppCompatActivity() {
}
// for test
@Keep
private fun toast() = Toast.makeText(this, "我弹出来了,没有 Hook", Toast.LENGTH_SHORT).show()
// for test
@Keep
private fun a(content1: String = "前缀", content: String) = "$content1${content}_后面加了一段文字"
// for test
@Keep
private fun test() = "正常显示的一行文字"
// for test
@Keep
private fun test(string: String) = string
}

View File

@@ -162,6 +162,15 @@ class YukiHookXposedProcessor : SymbolProcessorProvider {
"import de.robv.android.xposed.callbacks.XC_LoadPackage\n" +
"import $packageName.$className\n" +
"\n" +
"/**\n" +
" * XposedInit Inject Class\n" +
" *\n" +
" * Compiled from YukiHookXposedProcessor\n" +
" *\n" +
" * HookEntryClass: [$className]\n" +
" *\n" +
" * Powered by YukiHookAPI (C) HighCapable 2022\n" +
" */\n" +
"@Keep\n" +
"class $className$xposedClassShortName : IXposedHookLoadPackage {\n" +
"\n" +
@@ -170,7 +179,7 @@ class YukiHookXposedProcessor : SymbolProcessorProvider {
" runCatching {\n" +
" $className().onHook()\n" +
" }.onFailure {\n" +
" loggerE(msg = \"Try to load $packageName.$className Failed\", e = it)\n" +
" loggerE(msg = \"YukiHookAPI try to load HookEntryClass failed\", e = it)\n" +
" }\n" +
" YukiHookAPI.Configs.modulePackageName.ifEmpty {\n" +
" YukiHookAPI.Configs.modulePackageName = \"$realPackageName\"\n" +

View File

@@ -30,7 +30,6 @@
package com.highcapable.yukihookapi
import android.content.pm.ApplicationInfo
import androidx.annotation.Keep
import com.highcapable.yukihookapi.YukiHookAPI.encase
import com.highcapable.yukihookapi.annotation.DoNotUseMethod
import com.highcapable.yukihookapi.hook.entity.YukiBaseHooker
@@ -46,7 +45,6 @@ import de.robv.android.xposed.callbacks.XC_LoadPackage
*
* 模块装载方式已经自动对接 Xposed API - 可直接调用 [encase] 完成操作
*/
@Keep
object YukiHookAPI {
/** Xposed Hook API 方法体回调 */
@@ -84,7 +82,6 @@ object YukiHookAPI {
*
* 未写将自动生成
*/
@Keep
var modulePackageName = ""
}
@@ -102,7 +99,6 @@ object YukiHookAPI {
* @param lpparam Xposed [XC_LoadPackage.LoadPackageParam]
*/
@DoNotUseMethod
@Keep
fun onXposedLoaded(lpparam: XC_LoadPackage.LoadPackageParam) = packageParamCallback?.invoke(PackageParam(lpparam))
/**

View File

@@ -29,7 +29,6 @@
package com.highcapable.yukihookapi.annotation.xposed
import androidx.annotation.Keep
import com.highcapable.yukihookapi.YukiHookAPI
import com.highcapable.yukihookapi.hook.xposed.proxy.YukiHookXposedInitProxy
@@ -50,8 +49,6 @@ import com.highcapable.yukihookapi.hook.xposed.proxy.YukiHookXposedInitProxy
*
* - 若你不喜欢这样创建类 - 没问题 - 请在 [YukiHookAPI.Configs.modulePackageName] 填写模块包名即可 - 但不按照规则定义包名你将会收到编译警告
*
* 例子YukiHookAPI.encase(moduleName = "com.example.module", ...)
*
* - 最后这一点很重要:请不要随意修改项目 ../src/main/assets/xposed_init 中的内容 - 否则可能会导致模块装载发生错误
*
* 你必须将被注释的类继承于 [YukiHookXposedInitProxy] 接口实现 [YukiHookXposedInitProxy.onHook] 方法 - 否则编译会报错
@@ -61,5 +58,4 @@ import com.highcapable.yukihookapi.hook.xposed.proxy.YukiHookXposedInitProxy
* 详情请参考 [YukiHookAPI Wiki](https://github.com/fankes/YukiHookAPI/wiki)
*/
@Target(AnnotationTarget.CLASS)
@Keep
annotation class InjectYukiHookWithXposed

View File

@@ -29,7 +29,6 @@
package com.highcapable.yukihookapi.hook.xposed.proxy
import androidx.annotation.Keep
import com.highcapable.yukihookapi.YukiHookAPI
import com.highcapable.yukihookapi.annotation.xposed.InjectYukiHookWithXposed
import com.highcapable.yukihookapi.hook.factory.encase
@@ -95,7 +94,6 @@ import com.highcapable.yukihookapi.hook.factory.encase
*
* 详情请参考 [YukiHookAPI Wiki](https://github.com/fankes/YukiHookAPI/wiki)
*/
@Keep
interface YukiHookXposedInitProxy {
/**
@@ -105,6 +103,5 @@ interface YukiHookXposedInitProxy {
*
* 调用 [YukiHookAPI.encase] 或直接调用 [encase] 开始 Hook
*/
@Keep
fun onHook()
}