首页
社区
课程
招聘
[求助]新手hook sqlcipher遇到的问题
2023-4-18 15:19 6807

[求助]新手hook sqlcipher遇到的问题

2023-4-18 15:19
6807

新手,刚接触xposed开发,最近想做一个某个app的消息监听,开始还不知道消息这种数据一般用sqlcipher存,然后hook的sqlite,成功了但是并没有看到插入想要的数据,然后查了下,转向hook sqlcipher。具体函数如下
public long insertWithOnConflict(String str, String str2, ContentValues contentValues, int i)
我写的hook代码
XposedHelpers.findAndHookMethod(Application.class, "attach", Context.class, new XC_MethodHook() {
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
Context context = (Context) param.args[0];
dexClassLoader = context.getClassLoader();
if (dexClassLoader == null) {
XposedBridge.log("cannot get classloader return ");
return ;
}
XposedHelpers.findAndHookMethod("net.sqlcipher.database.SQLiteDatabase",dexClassLoader , "insertWithOnConflict", java.lang.String.class, java.lang.String.class, android.content.ContentValues.class, int.class, new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
ContentValues contentValues=(ContentValues)param.args[2];
String tableName=(String) param.args[0];
LogUtil.PrintInsert(tableName,contentValues,"sqlcipher insertWithOnConflict");
}
});
Class<?> cls = XposedHelpers.findClass("android.database.sqlite.SQLiteDatabase",dexClassLoader);
XposedHelpers.findAndHookMethod(cls, "insertWithOnConflict", String.class, String.class, ContentValues.class, int.class, new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
ContentValues contentValues=(ContentValues)param.args[2];
String tableName=(String) param.args[0];
LogUtil.PrintInsert(tableName,contentValues,"sqlite");
}
});
}
});

 

然后sqlite的插入是能打印出来的,sqlcipher的插入并没有打印,lsp的模块日志没有报错找不到方法,看起来像未执行?但是应该不太可能,自己发送了很多消息,按理来说是应该会插入的。。百思不得其解,来求助一下。


[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课

收藏
点赞1
打赏
分享
最新回复 (7)
雪    币: 228
能力值: ( LV1,RANK:0 )
在线值:
发帖
回帖
粉丝
nullpointer1 2023-4-18 15:27
2
0
第一次hook就这么难吗
雪    币: 228
能力值: ( LV1,RANK:0 )
在线值:
发帖
回帖
粉丝
nullpointer1 2023-4-18 15:45
3
0

难道不会执行吗?按理来说不会,看起来就是如此,很迷

最后于 2023-4-18 17:16 被nullpointer1编辑 ,原因:
雪    币: 342
活跃值: (759)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
学着学逆向 2023-4-19 16:01
4
0
1:net.sqlcipher.database.SQLiteDatabase是不是混淆了?
2:根本没执行
雪    币: 228
能力值: ( LV1,RANK:0 )
在线值:
发帖
回帖
粉丝
nullpointer1 2023-4-19 19:28
5
0
逆向小学生 1:net.sqlcipher.database.SQLiteDatabase是不是混淆了? 2:根本没执行
没有混淆,jadx打开能看到源码,复制为xposed片段进行hook的。从表现看是没执行,但是理论上,有新消息发过来本地是需要存储的,但是也没打印,sqlcipher的其他方法也试着hook过,但是都是没有打印(看起来没执行过)
雪    币: 228
能力值: ( LV1,RANK:0 )
在线值:
发帖
回帖
粉丝
nullpointer1 2023-5-2 21:34
6
0
逆向小学生 1:net.sqlcipher.database.SQLiteDatabase是不是混淆了? 2:根本没执行
发现这段代码针对某个漂流瓶app是好使的,但是对我想要hook的app不好使
雪    币: 228
能力值: ( LV1,RANK:0 )
在线值:
发帖
回帖
粉丝
nullpointer1 2024-1-12 16:25
7
0
学着学逆向 1:net.sqlcipher.database.SQLiteDatabase是不是混淆了? 2:根本没执行
很久没来了,感谢回复,根本没执行,这个app的聊天记录存储很特别,看了很久没看出来是怎么存的,不过有地方能hook到新的消息
雪    币: 228
能力值: ( LV1,RANK:0 )
在线值:
发帖
回帖
粉丝
nullpointer1 2024-1-16 14:49
8
0
已解决,忘了说了,hook地方错了,压根没用sqlcipher存
游客
登录 | 注册 方可回帖
返回