debug_wechat_send11.js 1.62 KB
/**
 * Frida v11 — ultra lightweight: just hook u01.r1.a and WCDB
 */

function log(tag, msg) {
    console.log("[" + tag + "] " + msg);
}

Java.perform(function () {
    log("MAIN", "Ultra lightweight trace");

    try {
        var r1 = Java.use("u01.r1");
        r1.a.overload("java.lang.String").implementation = function(toUser) {
            log("R1", "u01.r1.a(\"" + toUser + "\") CALLED");
            var result = this.a(toUser);
            log("R1", "  returned " + (result ? result.getClass().getName() : "null"));
            return result;
        };
        log("MAIN", "u01.r1.a hooked");
    } catch (e) {
        log("MAIN", "r1 hook skip: " + e);
    }

    try {
        var SQLiteDatabase = Java.use("com.tencent.wcdb.database.SQLiteDatabase");
        SQLiteDatabase.insert.overload('java.lang.String', 'java.lang.String', 'android.content.ContentValues').implementation = function(table, nullCol, values) {
            if (table && table.toLowerCase().indexOf("message") !== -1) {
                var isSend = values ? values.getAsInteger("isSend") : null;
                var talker = values ? values.getAsString("talker") : null;
                var content = values ? values.getAsString("content") : null;
                if (isSend && isSend == 1) {
                    log("WCDB", "INSERT SEND talker=" + talker + " content=" + (content ? content.substring(0, 30) : "null"));
                }
            }
            return this.insert(table, nullCol, values);
        };
        log("MAIN", "WCDB hooked");
    } catch (e) {
        log("MAIN", "WCDB skip: " + e);
    }

    log("MAIN", "Ready. Send a message.");
});