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 str = Java.use("java.lang.String");
    9. str.getBytes.overload().implementation = function () {
    10. // showStack();
    11. var result = this.getBytes();
    12. var newStr = str.$new(result);
    13. console.log("str.getBytes result: ", newStr);
    14. return result;
    15. }
    16. str.getBytes.overload('java.lang.String').implementation = function (a) {
    17. // showStack();
    18. var result = this.getBytes(a);
    19. var newStr = str.$new(result, a);
    20. console.log("str.getBytes result: ", newStr);
    21. return result;
    22. }
    23. })

    重载函数没有hook完整,后续补充;