TypeError: 无法读取未定义的属性 'overload' (frida)

huangapple go评论94阅读模式
英文:

TypeError: cannot read property 'overload' of undefined(frida)

问题

我正在尝试在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();
        }
    }

    /* 从不可打印字符中包含的原因 */
    public static String m6517(byte[] bArr) {
        // 方法实现
    }
}

然后它会打印出:

TypeError: 无法读取未定义的属性 'overload' (frida)

我的挂钩:

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提醒我应该添加更多细节。

英文:

I'm trying to hook m6517 method in the gha class:

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 notify me that I should add some more details))

And then it is printing me that:

TypeError: 无法读取未定义的属性 'overload' (frida)

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

What should I do to resolve this problem?
stackoverflow notify me that I should add some more details))

答案1

得分: 1

以下是翻译好的部分:

"Well it's kinda look like base64 but that's not what ur asking for.."
这似乎有点像Base64,但这不是你要的内容。

You need to pass method's signature
你需要传递方法的签名

m6517 receives byte array [ means array in smali, and B is byte
m6517 接收字节数组 [ 表示在smali中的数组,B 表示字节

btw, if you want to invoke it (it's static so no need for an instance) to pass byte array use
顺便说一下,如果你想调用它(它是静态的,所以不需要实例)来传递字节数组,可以使用以下代码:

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

Update:
更新:

I see now it's renamed due to non printable characters
我现在看到它由于不可打印字符而被重命名

Either try to trace entire class or updated with the following script output
要么尝试跟踪整个类,要么使用以下脚本输出进行更新:

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);
  }
});
英文:

Well it's kinda look like base64 but that's not what ur asking for..

You need to pass method's signature

m6517 receives byte array [ means array in smali, and B is byte

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

btw, if you want to invoke it (it's static so no need for an instance) to pass byte array use

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

Update:

I see now it's renamed due to non printable characters

Either try to trace entire class or updated with the following script output

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

huangapple
  • 本文由 发表于 2020年8月29日 21:43:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/63647622.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定