本文为看雪论坛优秀文章
看雪论坛作者ID:taobluesky
一
准备环境
二
初探
[FRD AL00::com.**.*****]-> Process terminated
[FRD AL00::com.**.*****]->
三
正式开始
// okhttp4
try {
var CertificatePinner = Java.use('okhttp3.CertificatePinner');
CertificatePinner.check.overload('java.lang.String', 'java.util.List').implementation = function(str) {
writeFile('! Intercepted okhttp4 in [check()]: ' + str);
return;
};
try {//.overload('java.lang.String', 'kotlin.jvm.functions.Function0')
CertificatePinner.check$okhttp.implementation = function(str, _) {
writeFile('! Intercepted okhttp4 in [check$okhttp]: ' + str);
return;
};
} catch (ex) {
writeFile("is this Okhttp3 ?!");
}
writeFile('* Setup okhttp4 pinning')
} catch (err) {
writeFile('* Unable to hook into okhttp4 pinner')
writeFile(err);
}
// 密码加密:输出RSA的pubkey
var this3 = Java.use("com.**.*****.encrypt.this3");
this3.unname.implementation = function(str, str2){
writeFile('unname is called');
writeFile("pubkey:" + str2);
var ret = this.unname(str, str2);
writeFile('unname ret value is ' + ret);
return ret;
};
try {
String password = "qed";
String publicKey = "MIGfMA0GCSqGSIb3D********qGWVMv5z6FwIDAQAB";
byte[] decoded = Base64.decode(publicKey, Base64.DEFAULT);
RSAPublicKey pubKey = (RSAPublicKey) KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(decoded));
Cipher instance = Cipher.getInstance("RSA/ECB/PKCS1Padding");
instance.init(ENCRYPT_MODE, pubKey);
String pwdenc = Base64.encodeToString(instance.doFinal(password.getBytes(StandardCharsets.UTF_8)), Base64.DEFAULT);
Log.e(TAG, pwdenc);
} catch (Exception e) {
e.printStackTrace();
}
var SignUtil = Java.use("com.**.****.encrypt.SignUtil");
SignUtil.get.implementation = function(str, str2, str3, str4){
writeFile('get is called');
writeFile("str:" + str);
writeFile("str2:" + str2);
writeFile("str3:" + str3);
writeFile("str4:" + str4);
var ret = this.get(str, str2, str3, str4);
writeFile('get ret value is ' + ret);
return ret;
};
var libnative_addr = Module.findBaseAddress("libnative-lib.so")
writeFile("libnative_addr is: " + libnative_addr)
// 内部一个std::string转cstring方法
var str_to_c = new NativeFunction(libnative_addr.add(0x45A85), "pointer", ["pointer"]);
// 输出签名字符串
try{
var addr_45266 = libnative_addr.add(0x45267);
writeFile("addr_45266: " + addr_45266);
Interceptor.attach(addr_45266, {
onEnter: function (args) {
writeFile("ohwawawa");
var ret = str_to_c(this.context.r2);
writeFile("addr_45266 OnEnter sign string:" + Memory.readCString(ret));
},
onLeave: function (retval) {
//console.log("retval is :", retval)
}
});
} catch(err) {
writeFile("[!!!!!!!!!!!!] " + err);
}
看雪ID:taobluesky
https://bbs.pediy.com/user-home-65525.htm
# 往期推荐
球分享
球点赞
球在看
点击“阅读原文”,了解更多!