Skip to content

Commit

Permalink
01:21 add log return
Browse files Browse the repository at this point in the history
  • Loading branch information
HdShare committed Mar 27, 2024
1 parent c76a650 commit 34e4b46
Show file tree
Hide file tree
Showing 11 changed files with 508 additions and 550 deletions.
2 changes: 2 additions & 0 deletions app/src/main/java/me/hd/hookgg/data/SetPagePrefsData.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ object SetPagePrefsData {
val PACKAGE_NAME = PrefsData("package_name", "")
val VERSION_NAME = PrefsData("version_name", "")
val FUNCTION_LIST = PrefsData("function_list", setOf<String>())
val LOG_RETURN = PrefsData("log_return", false)
val FILTER_PARAM = PrefsData("filter_Param", false)
}
8 changes: 8 additions & 0 deletions app/src/main/java/me/hd/hookgg/hook/base/BaseGGHooker.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
package me.hd.hookgg.hook.base

import com.highcapable.yukihookapi.hook.entity.YukiBaseHooker
import com.highcapable.yukihookapi.hook.factory.dataChannel
import me.hd.hookgg.BuildConfig
import me.hd.hookgg.data.GG
import me.hd.hookgg.data.SetPagePrefsData

abstract class BaseGGHooker : YukiBaseHooker() {
protected fun sendLog(func: String, result: Any?) {
val logReturn = prefs.get(SetPagePrefsData.LOG_RETURN)
val log = if (!logReturn) "$func\n" else "$func\n--[[$result]]\n"
appContext?.dataChannel(BuildConfig.APPLICATION_ID)?.put("log", log)
}

override fun onHook() {
val setFuncList = prefs.get(SetPagePrefsData.FUNCTION_LIST)
if (GG.toast in setFuncList) toast()
Expand Down
128 changes: 48 additions & 80 deletions app/src/main/java/me/hd/hookgg/hook/hooker/agg333/AGG333Hooker.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package me.hd.hookgg.hook.hooker.agg333

import com.highcapable.yukihookapi.hook.factory.dataChannel
import com.highcapable.yukihookapi.hook.factory.method
import me.hd.hookgg.BuildConfig
import me.hd.hookgg.hook.base.BaseGGHooker
import me.hd.hookgg.hook.hooker.agg333.AGG333VarArgs.arg
import me.hd.hookgg.hook.hooker.agg333.AGG333VarArgs.checkint
Expand All @@ -22,14 +20,12 @@ object AGG333Hooker : BaseGGHooker() {
name = "invoke2"
paramCount = 1
}.ignored().hook {
before {
after {
val varArgs = args(0).any()
val text = varArgs.checkjstring(1)
val fast = varArgs.optboolean(2, false)
appContext?.dataChannel(BuildConfig.APPLICATION_ID)?.put(
"log",
"gg.toast($text, $fast)"
)
val func = "gg.toast($text, $fast)"
sendLog(func, result)
}
}.ignoredAllFailure()
}
Expand All @@ -41,16 +37,14 @@ object AGG333Hooker : BaseGGHooker() {
name = "invoke2"
paramCount = 1
}.ignored().hook {
before {
after {
val varArgs = args(0).any()
val text = varArgs.checkjstring(1)
val positive = varArgs.optjstring(2, "ok")
val negative = varArgs.optjstring(3, "nil")
val neutral = varArgs.optjstring(4, "nil")
appContext?.dataChannel(BuildConfig.APPLICATION_ID)?.put(
"log",
"gg.alert($text, $positive, $negative, $neutral)"
)
val func = "gg.alert($text, $positive, $negative, $neutral)"
sendLog(func, result)
}
}.ignoredAllFailure()
}
Expand All @@ -62,15 +56,13 @@ object AGG333Hooker : BaseGGHooker() {
name = "invoke2"
paramCount = 1
}.ignored().hook {
before {
after {
val varArgs = args(0).any()
val items = varArgs.checktable(1)
val selected = varArgs.arg(2)
val message = varArgs.optjstring(3, "nil")
appContext?.dataChannel(BuildConfig.APPLICATION_ID)?.put(
"log",
"gg.choice($items, $selected, $message)"
)
val func = "gg.choice($items, $selected, $message)"
sendLog(func, result)
}
}.ignoredAllFailure()
}
Expand All @@ -82,15 +74,13 @@ object AGG333Hooker : BaseGGHooker() {
name = "invoke2"
paramCount = 1
}.ignored().hook {
before {
after {
val varArgs = args(0).any()
val items = varArgs.checktable(1)
val selection = varArgs.opttable(2, null)
val message = varArgs.optjstring(3, "nil")
appContext?.dataChannel(BuildConfig.APPLICATION_ID)?.put(
"log",
"gg.multiChoice($items, $selection, $message)"
)
val func = "gg.multiChoice($items, $selection, $message)"
sendLog(func, result)
}
}.ignoredAllFailure()
}
Expand All @@ -102,15 +92,13 @@ object AGG333Hooker : BaseGGHooker() {
name = "invoke2"
paramCount = 1
}.ignored().hook {
before {
after {
val varArgs = args(0).any()
val items = varArgs.checktable(1)
val defaults = varArgs.opttable(2, null)
val types = varArgs.opttable(3, null)
appContext?.dataChannel(BuildConfig.APPLICATION_ID)?.put(
"log",
"gg.prompt($items, $defaults, $types)"
)
val func = "gg.prompt($items, $defaults, $types)"
sendLog(func, result)
}
}.ignoredAllFailure()
}
Expand All @@ -122,11 +110,9 @@ object AGG333Hooker : BaseGGHooker() {
name = "invokeUi"
paramCount = 1
}.ignored().hook {
before {
appContext?.dataChannel(BuildConfig.APPLICATION_ID)?.put(
"log",
"gg.clearResults()"
)
after {
val func = "gg.clearResults()"
sendLog(func, result)
}
}.ignoredAllFailure()
}
Expand All @@ -138,13 +124,11 @@ object AGG333Hooker : BaseGGHooker() {
name = "invokeUi"
paramCount = 1
}.ignored().hook {
before {
after {
val varArgs = args(0).any()
val ranges = varArgs.checkint(1)
appContext?.dataChannel(BuildConfig.APPLICATION_ID)?.put(
"log",
"gg.setRanges($ranges)"
)
val func = "gg.setRanges($ranges)"
sendLog(func, result)
}
}.ignoredAllFailure()
}
Expand All @@ -156,13 +140,11 @@ object AGG333Hooker : BaseGGHooker() {
name = "invoke2"
paramCount = 1
}.ignored().hook {
before {
after {
val varArgs = args(0).any()
val filter = varArgs.optjstring(1, "")
appContext?.dataChannel(BuildConfig.APPLICATION_ID)?.put(
"log",
"gg.getRangesList($filter)"
)
val func = "gg.getRangesList($filter)"
sendLog(func, result)
}
}.ignoredAllFailure()
}
Expand All @@ -174,18 +156,17 @@ object AGG333Hooker : BaseGGHooker() {
name = "invokeUi"
paramCount = 1
}.ignored().hook {
before {
after {
val varArgs = args(0).any()
val text = varArgs.checkjstring(1)
val type = varArgs.optint(2, 127)
val encrypted = varArgs.optboolean(3, false)
val sign = varArgs.optint(4, 0x20000000)
val memoryFrom = varArgs.optlong(5, 0L)
val memoryTo = varArgs.optlong(6, -1L)
appContext?.dataChannel(BuildConfig.APPLICATION_ID)?.put(
"log",
val func =
"gg.searchNumber($text, $type, $encrypted, $sign, $memoryFrom, $memoryTo)"
)
sendLog(func, result)
}
}.ignoredAllFailure()
}
Expand All @@ -197,11 +178,9 @@ object AGG333Hooker : BaseGGHooker() {
name = "invoke2"
paramCount = 1
}.ignored().hook {
before {
appContext?.dataChannel(BuildConfig.APPLICATION_ID)?.put(
"log",
"gg.getResultsCount()"
)
after {
val func = "gg.getResultsCount()"
sendLog(func, result)
}
}.ignoredAllFailure()
}
Expand All @@ -213,7 +192,7 @@ object AGG333Hooker : BaseGGHooker() {
name = "invokeUi"
paramCount = 1
}.ignored().hook {
before {
after {
val varArgs = args(0).any()
val maxCount = varArgs.checkint(1)
val skip = varArgs.optint(2, 0)
Expand All @@ -224,10 +203,9 @@ object AGG333Hooker : BaseGGHooker() {
val type = varArgs.optint(7, 0)
val fractional = varArgs.optjstring(8, "nil")
val pointer = varArgs.optint(9, 0)
appContext?.dataChannel(BuildConfig.APPLICATION_ID)?.put(
"log",
val func =
"gg.getResults($maxCount, $skip, $addressMin, $addressMax, $valueMin, $valueMax, $type, $fractional, $pointer)"
)
sendLog(func, result)
}
}.ignoredAllFailure()
}
Expand All @@ -239,14 +217,12 @@ object AGG333Hooker : BaseGGHooker() {
name = "invoke2"
paramCount = 1
}.ignored().hook {
before {
after {
val varArgs = args(0).any()
val value = varArgs.checkjstring(1)
val type = varArgs.checkint(2)
appContext?.dataChannel(BuildConfig.APPLICATION_ID)?.put(
"log",
"gg.editAll($value, $type)"
)
val func = "gg.editAll($value, $type)"
sendLog(func, result)
}
}.ignoredAllFailure()
}
Expand All @@ -258,13 +234,11 @@ object AGG333Hooker : BaseGGHooker() {
name = "invoke2"
paramCount = 1
}.ignored().hook {
before {
after {
val varArgs = args(0).any()
val values = varArgs.checktable(1)
appContext?.dataChannel(BuildConfig.APPLICATION_ID)?.put(
"log",
"gg.getValues($values)"
)
val func = "gg.getValues($values)"
sendLog(func, result)
}
}.ignoredAllFailure()
}
Expand All @@ -276,13 +250,11 @@ object AGG333Hooker : BaseGGHooker() {
name = "invoke2"
paramCount = 1
}.ignored().hook {
before {
after {
val varArgs = args(0).any()
val values = varArgs.checktable(1)
appContext?.dataChannel(BuildConfig.APPLICATION_ID)?.put(
"log",
"gg.setValues($values)"
)
val func = "gg.setValues($values)"
sendLog(func, result)
}
}.ignoredAllFailure()
}
Expand All @@ -294,13 +266,11 @@ object AGG333Hooker : BaseGGHooker() {
name = "invoke2"
paramCount = 1
}.ignored().hook {
before {
after {
val varArgs = args(0).any()
val items = varArgs.checktable(1)
appContext?.dataChannel(BuildConfig.APPLICATION_ID)?.put(
"log",
"gg.addListItems($items)"
)
val func = "gg.addListItems($items)"
sendLog(func, result)
}
}.ignoredAllFailure()
}
Expand All @@ -312,15 +282,13 @@ object AGG333Hooker : BaseGGHooker() {
name = "invoke2"
paramCount = 1
}.ignored().hook {
before {
after {
val varArgs = args(0).any()
val url = varArgs.checkjstring(1)
val headers = varArgs.opttable(2, null)
val data = varArgs.optstring(3, null)
appContext?.dataChannel(BuildConfig.APPLICATION_ID)?.put(
"log",
"gg.makeRequest($url, $headers, $data)"
)
val func = "gg.makeRequest($url, $headers, $data)"
sendLog(func, result)
}
}.ignoredAllFailure()
}
Expand Down
Loading

0 comments on commit 34e4b46

Please sign in to comment.