1. Java.perform(function () {
    2. console.log("start hooking...");
    3. function showstack() {
    4. var log = Java.use("android.util.Log");
    5. var Throwable = Java.use("java.lang.Throwable");
    6. console.log(log.getStackTraceString(Throwable.$new()))
    7. }
    8. var EditTest = Java.use("android.widget.EditText");
    9. EditTest.getText.overload().implementation = function () {
    10. var result=this.getText();
    11. var result1 =Java.cast(result,Java.use("java.lang.CharSequence"));
    12. console.log(result1);
    13. return result;
    14. }
    15. })

    image.png
    光标定在哪儿,就hook那儿的编辑框的内容
    对此我们就可以打印堆栈了

    另外,本次hook使用到了Frida的强转:
    var result1 =Java.cast(result,Java.use(“java.lang.CharSequence”));
    将result转换为CharSequence类型