[TlsInterception] How to parse JSON (chunked, brotli compressed) and modify it ? #955
-
Hello, i'm trying a man-in-the-middle attack, and i can't find a way to change the JSON response. here is my code
I can't read the body as JSON and can't find a way to replace or search for a text inside.. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 10 replies
-
As Once you have all chunks assembled, you should be able to parse that data as json (if it is a valid json). You can ensure it's json by checking |
Beta Was this translation helpful? Give feedback.
As
handle_upstream_chunk
suggests, incoming data is achunk
. You must assemble all the chunks before you can make sense of them together. Incoming chunks can be assembled and parsed usingChunkParser
class. See https://github.com/abhinavsingh/proxy.py/blob/develop/proxy/http/parser/chunk.py#L27-L35Once you have all chunks assembled, you should be able to parse that data as json (if it is a valid json). You can ensure it's json by checking
Content-Type
for responses