-
-
Frida hook 琐碎问题 --如何打印构造函数返回值?
-
-
Frida hook 琐碎问题 --如何打印构造函数返回值?
在追踪Java中AES加密的密钥生成过程,想要查看javax.crypto.spec.SecretKeySpec这个类的构造函数返回值,
但是在hook的时候不知道要怎么调用 构造函数 打印返回值
代码如下:
var SecretKey=Java.use("javax.crypto.spec.SecretKeySpec");
SecretKey.$init.overload('[B', 'java.lang.String').implementation = function(key, alg){
console.log("hook start:");
//打印参数
if (arguments.length) console.log();
for (var j = 0; j < arguments.length; j++) {
console.log("arg[" + j + "]: " + arguments[j]);
}
//打印byte[] 数组的方法:
var ByteString = Java.use("okio.ByteString");
console.log("bytestring"); console.log("arg[0]:",ByteString.of(arguments[0]).hex());
//打印返回值
var retval = this.SecretKey(key, alg);
//这个地方出问题了
console.log("retval: " + ByteString.of(retval).hex());
return val;
}
报错信息为:
TypeError: undefined not callable (property 'SecretKey' of [object Object])
[培训]科锐逆向工程师培训第53期2025年7月8日开班!