SliverBullet5563 / unidbg_test

Apache License 2.0
9 stars 1 forks source link

缺少 jkq jkl 等依赖 #1

Closed zhkl0228 closed 3 years ago

SliverBullet5563 commented 3 years ago

你好作者大佬!! 翻译so的jar包依赖jkq,jkl等,在unidbg-android/src/main/resources/lib/trans_framework.jar,pom里添加。感谢大佬回复!!

------------------ 原始邮件 ------------------ 发件人: "SliverBullet5563/unidbg_test" @.>; 发送时间: 2021年4月15日(星期四) 中午11:47 @.>; @.***>; 主题: [SliverBullet5563/unidbg_test] 缺少jkq jql等依赖 (#1)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

zhkl0228 commented 3 years ago

`GLESTrace onInitialize: [13:37:31 711] INFO [com.github.unidbg.linux.AndroidElfLoader] (AndroidElfLoader:433) - libtranslate.so load dependency libGLESv2.so failed [13:37:31 796] INFO [com.github.unidbg.linux.AndroidElfLoader] (AndroidElfLoader:433) - libtranslate.so load dependency libEGL.so failed [main]I/OpenCV: cpufeatures library is not avaialble for CPU detection [main]I/OpenCV: - NEON instructions is enabled via build flags [main]I/OpenCV: - FP16 instructions is enabled via build flags [13:37:32 162] INFO [com.github.unidbg.linux.ARM32SyscallHandler] (ARM32SyscallHandler:1904) - openat dirfd=-100, pathname=/proc/self/auxv, oflags=0x20000, mode=0 Find native function Java_com_google_android_libraries_wordlens_WordLensSystem_CheckCPUHasNeonNative()Z => RX@0x40467991[libtranslate.so]0x467991 [13:37:32 207] INFO [com.github.unidbg.linux.ARM32SyscallHandler] (ARM32SyscallHandler:1904) - openat dirfd=-100, pathname=/proc/self/auxv, oflags=0x20000, mode=0 CheckCPUHasNeonNative: true Find native function Java_com_google_android_libraries_wordlens_NativeLangMan_unloadDictionaryNative()I => RX@0x4046776f[libtranslate.so]0x46776f unloadDictionaryNative: 0 Find native function Java_com_google_android_libraries_wordlens_NativeLangMan_loadDictionaryNative([B)I => RX@0x404675e5[libtranslate.so]0x4675e5 JNIEnv->GetArrayLength([B@12843fce => 67) was called from RX@0x40467607[libtranslate.so]0x467607 [13:37:32 987] INFO [com.github.unidbg.linux.ARM32SyscallHandler] (ARM32SyscallHandler:1051) - stat64 pathname=/data/user/files/dict.en_zh_25/translate_zhen, LR=RX@0x40b7b333[libtranslate.so]0xb7b333 [13:37:32 987] INFO [com.github.unidbg.linux.ARM32SyscallHandler] (ARM32SyscallHandler:1051) - stat64 pathname=/data/user/files/dict.en_zh_25/translit_zh, LR=RX@0x40b7b333[libtranslate.so]0xb7b333 loadDictionaryNative: 0 doTrans 0a0ce4bda0e59083e4ba86e590971000180120012800 Find native function Java_com_google_android_libraries_wordlens_NativeLangMan_doTranslateNative([B)[B => RX@0x40467877[libtranslate.so]0x467877 JNIEnv->GetArrayLength([B@69d9c55 => 22) was called from RX@0x404678bf[libtranslate.so]0x4678bf JNIEnv->NewByteArray(27) was called from RX@0x4046793f[libtranslate.so]0x46793f

doTranslateNative: 0a0f4861766520796f7520656174656e3f120020012a0208013200 计算用时: 26ms doTranslateNative 你吃了吗 => Have you eaten? doTrans 0a1be4bda0e4bb8ae5a4a9e58ebbe593aae9878ce69785e8a18cefbc9f1000180120012800 Find native function Java_com_google_android_libraries_wordlens_NativeLangMan_doTranslateNative([B)[B => RX@0x40467877[libtranslate.so]0x467877 JNIEnv->GetArrayLength([B@2344fc66 => 37) was called from RX@0x404678bf[libtranslate.so]0x4678bf JNIEnv->NewByteArray(38) was called from RX@0x4046793f[libtranslate.so]0x46793f

doTranslateNative: 0a1a596f7520746f64617920776865726520746f2074726176656c3f120020012a0208023200 计算用时: 282ms doTranslateNative 你今天去哪里旅行? => You today where to travel? run 今天天气不错 doTrans 0a12e4bb8ae5a4a9e5a4a9e6b094e4b88de994991000180120012800 Find native function Java_com_google_android_libraries_wordlens_NativeLangMan_doTranslateNative([B)[B => RX@0x40467877[libtranslate.so]0x467877 JNIEnv->GetArrayLength([B@573f2bb1 => 28) was called from RX@0x404678bf[libtranslate.so]0x4678bf JNIEnv->NewByteArray(30) was called from RX@0x4046793f[libtranslate.so]0x46793f

doTranslateNative: 0a125468652077656174686572277320676f6f64120020012a0208013200 计算用时: 32ms doTranslateNative 今天天气不错 => The weather's good run 你今天心情怎样? doTrans 0a18e4bda0e4bb8ae5a4a9e5bf83e68385e6808ee6a0b7efbc9f1000180120012800 Find native function Java_com_google_android_libraries_wordlens_NativeLangMan_doTranslateNative([B)[B => RX@0x40467877[libtranslate.so]0x467877 JNIEnv->GetArrayLength([B@548b7f67 => 34) was called from RX@0x404678bf[libtranslate.so]0x4678bf JNIEnv->NewByteArray(31) was called from RX@0x4046793f[libtranslate.so]0x46793f

doTranslateNative: 0a13596f7520746f646179206d6f6f6420686f773f120020012a0208023200 计算用时: 188ms doTranslateNative 你今天心情怎样? => You today mood how? run 测试好像没问题 doTrans 0a15e6b58be8af95e5a5bde5838fe6b2a1e997aee9a2981000180120012800 Find native function Java_com_google_android_libraries_wordlens_NativeLangMan_doTranslateNative([B)[B => RX@0x40467877[libtranslate.so]0x467877 JNIEnv->GetArrayLength([B@50c87b21 => 31) was called from RX@0x404678bf[libtranslate.so]0x4678bf JNIEnv->NewByteArray(32) was called from RX@0x4046793f[libtranslate.so]0x46793f

doTranslateNative: 0a1454657374206c696b65206e6f2070726f626c656d120020012a0208023200 计算用时: 104ms doTranslateNative 测试好像没问题 => Test like no problem`

zhkl0228 commented 3 years ago

好像没有多线程问题呢?

SliverBullet5563 commented 3 years ago

我靠!大佬你没改什么东西,直接跑就能跑通了吗,你用什么系统跑的啊?我在Windows下跑,会出现问题,我试试在Ubuntu下!

------------------ 原始邮件 ------------------ 发件人: "SliverBullet5563/unidbg_test" @.>; 发送时间: 2021年4月15日(星期四) 中午1:38 @.>; @.**@.>; 主题: Re: [SliverBullet5563/unidbg_test] 缺少 jkq jkl 等依赖 (#1)

好像没有多线程问题呢?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

zhkl0228 commented 3 years ago

改了东西,不过改的都不是多线程相关的

SliverBullet5563 commented 3 years ago

改了东西,不过改的都不是多线程相关的

我靠!大佬,你怎么改的啊,是我有什么地方没注意到吗,你也太快就分析出来了!哈哈哈!强

zhkl0228 commented 3 years ago

我把这个 Translate 当做 unidbg 的例子提交到主仓库没问题吧

SliverBullet5563 commented 3 years ago

没问题啊!感谢大佬能帮助解决问题!谢谢~

------------------ 原始邮件 ------------------ 发件人: "SliverBullet5563/unidbg_test" @.>; 发送时间: 2021年4月15日(星期四) 下午2:36 @.>; @.**@.>; 主题: Re: [SliverBullet5563/unidbg_test] 缺少 jkq jkl 等依赖 (#1)

我把这个 Translate 当做 unidbg 的例子提交到主仓库没问题吧

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

zhkl0228 commented 3 years ago

已提交到 https://github.com/zhkl0228/unidbg/blob/master/unidbg-android/src/test/java/com/google/translate/NativeLangMan.java

SliverBullet5563 commented 3 years ago

好的!再次感谢大佬的帮助!!

------------------ 原始邮件 ------------------ 发件人: "SliverBullet5563/unidbg_test" @.>; 发送时间: 2021年4月15日(星期四) 下午2:49 @.>; @.**@.>; 主题: Re: [SliverBullet5563/unidbg_test] 缺少 jkq jkl 等依赖 (#1)

已提交到 https://github.com/zhkl0228/unidbg/blob/master/unidbg-android/src/test/java/com/google/translate/NativeLangMan.java

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

SliverBullet5563 commented 3 years ago

大佬你好!我仔细分析比对了你的代码后,发现我调不起来的原因,竟是我多加载了模型,所以想请教您几个问题:

1,您是如何定位到,只加载项目里的3个bin文件就可以调用成功的。(我在public FileResult resolve()回调里打印出open所需的文件看到,so是需要打开所有模型文件的,所以我把逆向出的所有模型都给so加载,但万万没想到这里出了问题)。

  1. 在模拟出来的文件系统(就是resources/android/sdk23(19)目录下),直接放入so所需要加载的文件(也就是让unidbg自己去加载了),和在resolve() 回调里通过return FileResult.success(new FileIO()),有什么本质的区别吗(或者会有什么影响吗),因为我偷懒了,打印出so所需要的文件后,就直接放在模拟的文件系统目录下,就不在管他了。

  2. 最后,您是怎么看出jkl,jkq这些函数是protobuf的啊!我在逆向时,看到这些函数的方法栈比较深,不容易还原,所以从源代码里拆分出jar包,来进行调用。所以在看到您没有源代码的情况下,直接把这些函数还原成了protobuf,我真的太吃惊了!

希望作者大佬如果有时间可以帮我解答一下,如果我的问题太多了,,麻烦大佬帮我解答一下第一个问题,因为我确实困惑了很久,还搞错了方向,以为是多线程的问题。谢谢!耽误您些许时间,期待大佬回复哈哈!

------------------ 原始邮件 ------------------ 发件人: "SliverBullet5563/unidbg_test" @.>; 发送时间: 2021年4月15日(星期四) 下午2:49 @.>; @.**@.>; 主题: Re: [SliverBullet5563/unidbg_test] 缺少 jkq jkl 等依赖 (#1)

已提交到 https://github.com/zhkl0228/unidbg/blob/master/unidbg-android/src/test/java/com/google/translate/NativeLangMan.java

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

zhkl0228 commented 3 years ago

一:我优化完代码没想到就解决了; 二:一样的 三:google的产品配protobuf经验问题,再看生成的数据0xa开头比较像

zhkl0228 commented 3 years ago

拿到bytes数组用没有任何字段的pb能解析就说明是protobuf

SliverBullet5563 commented 3 years ago

强,最后一条思路太值得借鉴了,因为是谷歌开始有怀疑是protobuf编码,但是看里边代码越看越不像,反而却没有直接用pb解一下原数据!结果导致复杂了。

不过大佬,您优化代码的时候,是一开始没有把所有的模型都加载,然后在运行过程中少哪个文件,就加载哪个文件吗?因为我觉得太神奇了,这个so所需要加载的模型,竟然只需要加载部分就可以成功,全部加载反而运行不起来了!

------------------ 原始邮件 ------------------ 发件人: "SliverBullet5563/unidbg_test" @.>; 发送时间: 2021年4月15日(星期四) 晚上6:44 @.>; @.**@.>; 主题: Re: [SliverBullet5563/unidbg_test] 缺少 jkq jkl 等依赖 (#1)

拿到bytes数组用没有任何字段的pb能解析就说明是protobuf

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.