TypeError: cannot read property 'overload' of undefined(frida)
TypeError: cannot read property 'overload' of undefined(frida)
我正在尝试在 gha 中挂钩 m6517 方法 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);
}
}
Whosebug 通知我应该添加更多详细信息))
然后打印给我:
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);
}
});
我应该怎么做才能解决这个问题?
Whosebug 通知我应该添加更多详细信息))
嗯,它有点像 base64,但这不是你想要的..
您需要传递方法的签名
m6517
接收byte数组[
在smali中表示数组,B
是byte
hash.m6517.overload('[B').implementation = function(str){
...
顺便说一句,如果你想调用它(它是静态的,所以不需要实例)来传递字节数组使用
m6517( Java.array('byte', [ 41, 41, 42, 43 ]) );
更新:
由于不可打印的字符,我现在看到它已重命名
尝试跟踪整个 class 或使用以下脚本输出进行更新
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);
}
});
我正在尝试在 gha 中挂钩 m6517 方法 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);
}
}
Whosebug 通知我应该添加更多详细信息))
然后打印给我:
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);
}
});
我应该怎么做才能解决这个问题? Whosebug 通知我应该添加更多详细信息))
嗯,它有点像 base64,但这不是你想要的..
您需要传递方法的签名
m6517
接收byte数组[
在smali中表示数组,B
是byte
hash.m6517.overload('[B').implementation = function(str){
...
顺便说一句,如果你想调用它(它是静态的,所以不需要实例)来传递字节数组使用
m6517( Java.array('byte', [ 41, 41, 42, 43 ]) );
更新:
由于不可打印的字符,我现在看到它已重命名
尝试跟踪整个 class 或使用以下脚本输出进行更新
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);
}
});