Forked from llamaonsecurity/frida-hybrid-peek-android-okhttp.js
Last active
July 20, 2023 14:14
-
-
Save materi/f5b95f798b9012e135e3462d52d33d4c to your computer and use it in GitHub Desktop.
Frida script - Peek http req/res
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Java.perform(function() { | |
var res2 = Java.use('com.android.okhttp.Response$Builder'); | |
res2.build.implementation = function() { | |
var response = this.build(); | |
console.log(response.headers()) | |
//console.log(response.message()) | |
var rBody = response.body(); | |
//console.log(rBody.source()) | |
console.log("## REQ ### "); | |
console.log(response.request()); | |
console.log(response.request().headers()); | |
console.log("## -REQ- ### "); | |
return response; | |
}; | |
var base64 = Java.use('android.util.Base64'); | |
var RealResponseBody = Java.use('com.android.okhttp.internal.http.RealResponseBody'); | |
RealResponseBody.$init.overload('com.android.okhttp.Headers', 'com.android.okhttp.okio.BufferedSource').implementation = function(par1, par2) { | |
console.log("ResponseBody"); | |
var body = par2.readByteArray(); | |
console.log(base64.encodeToString(body, 0)); | |
// Write back the body into buffer to allow app to read it | |
var buffer = par2.buffer(); | |
buffer.clear(); | |
buffer.write(body); | |
this.$init(par1, par2); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment