-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathAESTest.kt
60 lines (52 loc) · 2.03 KB
/
AESTest.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package suites
import TestBase
import TestUtil
import jmp0.app.AndroidEnvironment
import jmp0.app.DbgContext
import jmp0.app.IAndroidInvokeFile
import jmp0.app.interceptor.intf.IInterceptor
import jmp0.app.interceptor.mtd.CallBridge
import org.junit.jupiter.api.Test
class AESTest:TestBase(),IAndroidInvokeFile {
override fun test() {
val ae = AndroidEnvironment(TestUtil.testApkFile, object : IInterceptor {
override fun nativeCalled(
uuid: String,
className: String,
funcName: String,
signature: String,
param: Array<Any?>
): IInterceptor.ImplStatus {
return IInterceptor.ImplStatus(false,null)
}
override fun methodCalled(
uuid: String,
className: String,
instance: Any?,
funcName: String,
signature: String,
param: Array<Any?>
): Any? {
if (funcName == "decrypt"){
val result = CallBridge.methodCallReal(uuid, className, instance, funcName, signature, param)
return result
}
return null
}
override fun ioResolver(path: String): String? {
return null
}
})
ae.registerMethodHook("jmp0.test.testapp.TestAES.decrypt(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;")
val clazz = ae.loadClass("jmp0.test.testapp.TestAES")
val ins = clazz.getDeclaredConstructor().newInstance()
val ret = clazz.getDeclaredMethod("testAll").invoke(ins)
TestUtil.logger.info(ret)
// ae.runInvokeFile(this)
ae.destroy()
}
override fun run(androidEnvironment: AndroidEnvironment) {
// val ret = jmp0.test.testapp.TestAES().testAll()
// TestUtil.logger.info(ret)
}
}