首頁(yè)
社區(qū)
課程
招聘
求幫忙看下hook sqlcipher沒有打印log的問(wèn)題

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);
            }
        });
    }
}

}

 

表現(xiàn)為,運(yùn)行后可以看到兩次has hooked的log被打印,但是XposedBridge.log(TAG + " insertWithOnConflictMethod");這條沒有打印,我用手機(jī)發(fā)了消息這個(gè)裝了模塊的手機(jī),收到了消息,但是貌似并沒有執(zhí)行insertWithOnConflict,sqlite的hook成功了,但是都是無(wú)關(guān)緊要的插入,聊天記錄不在sqlite里,搞不懂,新人提問(wèn)

收藏
0條回答
hook sqlcipher 安卓逆向
  參與學(xué)習(xí)     人
  提問(wèn)次數(shù)     100 個(gè)
我的問(wèn)答 領(lǐng)取收益
0
我的提問(wèn)
0
我的回答
0
學(xué)習(xí)收益