首页
社区
课程
招聘
求帮忙看下hook sqlcipher没有打印log的问题

public class HookEntry implements IXposedHookLoadPackage {
public static String TAG = "Demo";
public static ClassLoader dexClassLoader = null;
public static ClassLoader classLoader = null;

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
@Override
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam loadPackageParam) throws Throwable {
    if (loadPackageParam.packageName.equals(HookUtils.XPOSED_HOOK_PACKAGE)) {
        classLoader = loadPackageParam.classLoader;
        XposedBridge.log(TAG + " has Hooked!");
        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;
                }
                XposedBridge.log(TAG + " has Hooked!");
                final Class<?> sqliteDatabase = XposedHelpers.findClass("net.sqlcipher.database.SQLiteDatabase", dexClassLoader);
                final Method insertWithOnConflictMethod = XposedHelpers.findMethodExact(sqliteDatabase, "insertWithOnConflict", String.class, String.class, ContentValues.class, int.class);
 
                XC_MethodHook methodHook = new XC_MethodHook() {
                    @Override
                    protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
                        XposedBridge.log(TAG + " insertWithOnConflictMethod");
                        String table = (String) param.args[0];
                        ContentValues contentValues = (ContentValues) param.args[2];
                        if (table != null && table.toLowerCase().startsWith("insert into")) {
                            LogUtil.PrintInsert(table, contentValues, "sqlcipher insert");
                        }
                    }
                };
                // Hook insertWithOnConflict 方法
                XposedBridge.hookMethod(insertWithOnConflictMethod, methodHook);
            }
        });
    }
}

}

 

表现为,运行后可以看到两次has hooked的log被打印,但是XposedBridge.log(TAG + " insertWithOnConflictMethod");这条没有打印,我用手机发了消息这个装了模块的手机,收到了消息,但是貌似并没有执行insertWithOnConflict,sqlite的hook成功了,但是都是无关紧要的插入,聊天记录不在sqlite里,搞不懂,新人提问

收藏
0条回答
hook sqlcipher 安卓逆向
  参与学习     人
  提问次数     100 个
我的问答 领取收益
0
我的提问
0
我的回答
0
学习收益