由于疫情捂在家里,写了一个纯App端的Hook框架(暂且这么称呼,没有太多黑科技,大佬轻拍)。
AppInspect的特点是PC端无需安装任何软件,通过浏览器访问手机,对选中的目标App内部模块进行浏览和hook。
主要还是想探索一下Rust+Flutter 写一些底层一点的应用,具体应用场景和需求还不是特别明确,想听听专业人士的意见。
下载地址:
bdaK9s2c8@1M7s2y4Q4x3@1q4Q4x3V1k6Q4x3V1k6Y4K9i4c8Z5N6h3u0Q4x3X3g2U0L8$3#2Q4x3V1k6%4N6h3S2^5i4K6u0r3b7i4m8H3d9h3&6K6M7r3g2U0N6l9`.`.
包括两个部分:
Riru模块(app-inspect-v0.0.1.zip)用于hook进App内部,启动server与App通信。
App客户端(AppInspect-0.0.1.apk )用于提供hook配置界面,配置完成可退出。
1 手机端:

2 浏览器访问:
可通过App名称,pkg名称,地址等进行App搜索,点右边的甲虫按钮进行调试。

3 点调试后,会进入对应App的内部module列表(加载的so,dex等),这里可根据模块名称,地址进行搜索

也支持输入地址,显示该地址属于的模块。

点击模块右侧的下载按钮,可以从内存dump出模块内容,下载到电脑。

4 点击选中的模块后,进入symbol列表。同样支持实时搜索。对于c++的函数名会自动demangle。

5 点击要hook的函数后,进入一个简陋配置界面,

主要是配置参数序号和类型
类型只实现了c的char* 和jni的jstring,其他类型待增加,主要验证可行性,
如:open函数的原型是:
int open(const char *pathname, int flags)
对应参数0的类型是chars
参数1的类型是value
点击右上角保存按钮,后重启目标App,即可生效。
理论上这里可做更多的事,比如利用Android源码或java侧的jni函数signature自动获取函数参数列表类型。
目前hook后到操作是以json格式打印到logcat,后面考虑更合适的操作。比如webhook或写sqlite数据库。
加载成功后的logcat日志
Riru-AppInspect-SRV: libre_server::cache::pb_message_cache: PbMessageCache find 2 hooks
Riru-AppInspect-SRV: add_hook_to_list: HookFunctionInfo { pkg_name: "com.tencent.mm", module_name: Some("libc.so"), function_name: "open", args: [(0, chars), (1, value)] }
Riru-AppInspect-SRV: add_hook_to_list: HookFunctionInfo { pkg_name: "com.tencent.mm", module_name: Some("libwcdb.so"), function_name: "sqlite3_open_v2", args: [(0, chars)] }
//com.tencent.mm启动时找到两个hook:
//libc.so的open
//libwcdb.so的sqlite3_open_v2
Riru-AppInspect-SRV: libre_server::hook: HookInfo: do_hook fail, fail to find ptr for: HookFunctionInfo { pkg_name: "com.tencent.mm", module_name: Some("libwcdb.so"), function_name: "sqlite3_open_v2", args: [(0, chars)] }
//sqlite3_open_v2 hook失败(此时libwcdb.so还没加载)
Riru-AppInspect-SRV: hook_jvm_native_load: load /data/app/~~doK-kt6wrU2os9ZOgHddTA==/com.tencent.mm-gxYlcjouxWARtuBs7QGSPA==/lib/arm64/libwcdb.so
Riru-AppInspect-SRV: do_hook: NativePointer(0x7b672d02dc) HookFunctionInfo { pkg_name: "com.tencent.mm", module_name: Some("libwcdb.so"), function_name: "sqlite3_open_v2", args: [(0, chars)] }
//libwcdb.so加载后,sqlite3_open_v2 hook成功
//hook输出打印
Riru-AppInspect-SRV: libre_server::hook::hook_function_info: {
Riru-AppInspect-SRV: "pkg_name": "com.tencent.mm",
Riru-AppInspect-SRV: "module_name": "libc.so",
Riru-AppInspect-SRV: "function_name": "open",
Riru-AppInspect-SRV: "args": [
Riru-AppInspect-SRV: {
Riru-AppInspect-SRV: "name": "arg0",
Riru-AppInspect-SRV: "value": "/data/user/0/com.tencent.mm/shared_prefs/service_launch_way.xml"
Riru-AppInspect-SRV: },
Riru-AppInspect-SRV: {
Riru-AppInspect-SRV: "name": "arg1",
Riru-AppInspect-SRV: "value": "0"
Riru-AppInspect-SRV: }
Riru-AppInspect-SRV: ]
Riru-AppInspect-SRV: }
Riru-AppInspect-SRV: libre_server::hook::hook_function_info: {
Riru-AppInspect-SRV: "pkg_name": "com.tencent.mm",
Riru-AppInspect-SRV: "module_name": "libwcdb.so",
Riru-AppInspect-SRV: "function_name": "sqlite3_open_v2",
Riru-AppInspect-SRV: "args": [
Riru-AppInspect-SRV: {
Riru-AppInspect-SRV: "name": "arg0",
Riru-AppInspect-SRV: "value": "/data/user/0/com.tencent.mm/MicroMsg/c5944ec3938fc59659b516b6f26d17c0/TextStatus.db"
Riru-AppInspect-SRV: }
Riru-AppInspect-SRV: ]
Riru-AppInspect-SRV: }
Riru-AppInspect-SRV: libre_server::cache::pb_message_cache: PbMessageCache find 2 hooks
Riru-AppInspect-SRV: add_hook_to_list: HookFunctionInfo { pkg_name: "com.tencent.mm", module_name: Some("libc.so"), function_name: "open", args: [(0, chars), (1, value)] }
Riru-AppInspect-SRV: add_hook_to_list: HookFunctionInfo { pkg_name: "com.tencent.mm", module_name: Some("libwcdb.so"), function_name: "sqlite3_open_v2", args: [(0, chars)] }
//com.tencent.mm启动时找到两个hook:
//libc.so的open
//libwcdb.so的sqlite3_open_v2
Riru-AppInspect-SRV: libre_server::hook: HookInfo: do_hook fail, fail to find ptr for: HookFunctionInfo { pkg_name: "com.tencent.mm", module_name: Some("libwcdb.so"), function_name: "sqlite3_open_v2", args: [(0, chars)] }
[培训]科锐软件逆向54期预科班、正式班开始火爆招生报名啦!!!
最后于 2021-8-20 17:47
被whx编辑
,原因: