【问题标题】:TypeError: cannot read property 'overload' of undefined(frida)TypeError:无法读取未定义(frida)的属性“重载”
【发布时间】:2020-08-29 13:43:04
【问题描述】:

我正在尝试在 gha 类中挂钩 m6517 方法:

package o;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
    
public class gha {
    
        private static byte[] f4427 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".getBytes();
    
        static {
            Package packageR = gha.class.getPackage();
            if (packageR != null) {
                packageR.getName();
            }
        }
    
        /* renamed from: ı  reason: contains not printable characters */
        public static String m6517(byte[] bArr) {
            int i;
            int length = bArr.length;
            byte[] bArr2 = new byte[(((length + 2) / 3) << 2)];
            int i2 = 0;
            while (i2 < length) {
                int i3 = i2;
                int i4 = 0;
                while (true) {
                    i = i2 + 3;
                    if (i3 >= i) {
                        break;
                    }
                    i4 <<= 8;
                    if (i3 < length) {
                        i4 |= bArr[i3] & 255;
                    }
                    i3++;
                }
                int i5 = (i2 / 3) << 2;
                byte[] bArr3 = f4427;
                bArr2[i5] = bArr3[(i4 >> 18) & 63];
                bArr2[i5 + 1] = bArr3[(i4 >> 12) & 63];
                byte b = 61;
                bArr2[i5 + 2] = i2 + 1 < length ? bArr3[(i4 >> 6) & 63] : 61;
                int i6 = i5 + 3;
                if (i2 + 2 < length) {
                    b = f4427[i4 & 63];
                }
                bArr2[i6] = b;
                i2 = i;
            }
            return new String(bArr2);
        }
    }

stackoverflow 通知我应该添加更多细节))

然后它打印我:

MyHook:

Java.perform(function () {
  var hash = Java.use("o.gha");
  hash.m6517.overload().implementation = function(str){
    console.log('original: ' + str);
    console.log('hashed: ' + hash.m6517(str));
    return hash.m6517(str);
  }
});

我应该怎么做才能解决这个问题? stackoverflow 通知我应该添加更多细节))

【问题讨论】:

    标签: java android hook frida


    【解决方案1】:

    嗯,它有点像 base64,但这不是你想要的......

    你需要传递方法的签名

    m6517接收字节数组[表示smali中的数组,B是字节

      hash.m6517.overload('[B').implementation = function(str){
      ...
    

    顺便说一句,如果你想调用它(它是静态的,所以不需要实例)来传递字节数组使用

    m6517( Java.array('byte', [ 41, 41, 42, 43 ]) );
    

    更新:

    我现在看到它由于不可打印字符而被重命名

    要么尝试跟踪整个类,要么使用以下脚本输出更新

    Java.use('gha').class.getDeclaredMethods().forEach(function (method) {
      var methodName = method.toString();
      console.log("method name = " + methodName);
      try {
        // .. hook here
      } catch (e) { 
        console.error(methodName, e);
      }
    });
    

    【讨论】:

    • 它对我不起作用:(我想重载它以获得参数和结果
    猜你喜欢
    • 1970-01-01
    • 2021-03-18
    • 1970-01-01
    • 2020-11-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-09-07
    相关资源
    最近更新 更多