Last active
July 21, 2023 11:05
-
-
Save llamaonsecurity/fc6860fc62ecd5e5c1a6fa348622cfbf 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"); | |
//breaks app, because readByteArray function clears input stream | |
var body = par2.readByteArray() //Comment this line if you want app to process request | |
console.log(base64.encodeToString(body, 0)); //Comment this line if you want app to process request | |
this.$init(par1, par2); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This doesn't seem to work for me.
I am getting: