sensepost / objection

📱 objection - runtime mobile exploration
GNU General Public License v3.0
7.22k stars 829 forks source link

Reading byte array when hooking #521

Open botti007 opened 2 years ago

botti007 commented 2 years ago

during an assessment i was hooking function that was their argument is byte array and their return value are byte array. How could we read this data. (i think you can read only interger or string) it was show as [Object Object]. I really need this feature to be implemented especiaaly when you are debugging an encryption function, they usuaaly get as parameter a byte array. Could anyone here help.

CDuPlooy commented 2 years ago

I thought I had some code lying around that does this but I can't seem to find it. This is definitely possible but imo, printing out byte arrays ends up just overloading you with information. Perhaps this can be avoided by trimming them to 5 bytes and appending ... or something similar.

For the time being it might be better to just use the hook generation functionality to get the hooks you want and then edit them by hand - or alternatively just write them the plain old way. When I get a chance to work on the hooks, I'll keep this in mind :)

KinofRikin commented 2 years ago

Same problem.

leonjza commented 2 years ago

Hook generation is the way as there is no generic way to know the type of the arguments / return values. We could look at an optional parameter to try and turn whatever the values is to a string, but at the risk of crashing the target process ofc.