Frida,钩子 OKHttp 库不适用于示例
Frida, hook OKHttp Library does not work with examples
我正在尝试使用 Frida 脚本挂钩 OKHttp 库的函数:
setTimeout(function(){
Java.perform(function (){
console.log("-- Hook OKHttp library --");
try {
var Builder = Java.use('okhttp3.CertificatePinner$Builder');
var Pin = Java.use('okhttp3.CertificatePinner$Pin');
var OkHttpClient = Java.use('okhttp3.OkHttpClient$Builder');
console.log("OkHTTP classes found");
Builder.add.overload.implementation = function(a, b) {
console.log("TEST ADD");
}
Pin.matches.overload.implementation = function (a) {
console.log("TEST matches")
return true;
}
OkHttpClient.certificatePinner.overload.implementation = function (a) {
console.log("TEST certificatePinner");
}
console.log("OkHTTP functions found");
} catch (err) {
// If we dont have a ClassNotFoundException exception, raise the
// problem encountered.
console.log("OkHTTP 3.x classes/functions not Found");
}
});
},0);
我正在 Android 应用程序中执行以下代码:
CertificatePinner certificatePinner = new CertificatePinner.Builder()
.add(certificateDNWildcard, certificateHash)
.build();
//Create http client with pinned certificate
OkHttpClient okHttpClient = new OkHttpClient.Builder()
.certificatePinner(certificatePinner)
.build();
如您所见,我正在调用我试图挂钩的函数 .add(certificateDNWildcard, certificateHash)
。但是,当我执行此功能时,终端中没有打印任何内容。此外,我的终端的输出是:
-- Hook OKHttp library --
OkHTTP classes found
OkHTTP functions found
因此,它确实找到了 类 和函数;然而,钩子本身并不能有效地工作。有人可以帮我吗?
我正在使用:
* Frida 12.8.11
* Android 10
* ARM64
您应该:
// works if add method has a single implementation
Builder.add.implementation = function(a, b) {
console.log("TEST ADD");
}
或
// always works
Builder.add.overload('java.lang.String', 'java.lang.String').implementation = function(a, b) {
console.log("TEST ADD");
}
我正在尝试使用 Frida 脚本挂钩 OKHttp 库的函数:
setTimeout(function(){
Java.perform(function (){
console.log("-- Hook OKHttp library --");
try {
var Builder = Java.use('okhttp3.CertificatePinner$Builder');
var Pin = Java.use('okhttp3.CertificatePinner$Pin');
var OkHttpClient = Java.use('okhttp3.OkHttpClient$Builder');
console.log("OkHTTP classes found");
Builder.add.overload.implementation = function(a, b) {
console.log("TEST ADD");
}
Pin.matches.overload.implementation = function (a) {
console.log("TEST matches")
return true;
}
OkHttpClient.certificatePinner.overload.implementation = function (a) {
console.log("TEST certificatePinner");
}
console.log("OkHTTP functions found");
} catch (err) {
// If we dont have a ClassNotFoundException exception, raise the
// problem encountered.
console.log("OkHTTP 3.x classes/functions not Found");
}
});
},0);
我正在 Android 应用程序中执行以下代码:
CertificatePinner certificatePinner = new CertificatePinner.Builder()
.add(certificateDNWildcard, certificateHash)
.build();
//Create http client with pinned certificate
OkHttpClient okHttpClient = new OkHttpClient.Builder()
.certificatePinner(certificatePinner)
.build();
如您所见,我正在调用我试图挂钩的函数 .add(certificateDNWildcard, certificateHash)
。但是,当我执行此功能时,终端中没有打印任何内容。此外,我的终端的输出是:
-- Hook OKHttp library --
OkHTTP classes found
OkHTTP functions found
因此,它确实找到了 类 和函数;然而,钩子本身并不能有效地工作。有人可以帮我吗?
我正在使用:
* Frida 12.8.11
* Android 10
* ARM64
您应该:
// works if add method has a single implementation
Builder.add.implementation = function(a, b) {
console.log("TEST ADD");
}
或
// always works
Builder.add.overload('java.lang.String', 'java.lang.String').implementation = function(a, b) {
console.log("TEST ADD");
}