0

I have a watch, whose app downloads a zip file from here, processes it, and sets the new watch face. What I want to do, is intercept the response from the server, and modify the zip file, and send it to the app. I am able it intercept, using HTTP toolkit, but when I download the zip, modify it, and then "inject" it, it doesn't accept. Even if I just download it, convert it to plain text, and then inject it without modifying anything, it still returns an error. The zip converted to plaintext is different from the raw data. How to resolve this, so that I can modify the zip, and have the app still accept it ?

P.S: I'm converting it to plain text by just changing the extension from .zip to .txt

Tim Perry
  • 11,766
  • 1
  • 57
  • 85
psycoxer
  • 151
  • 13
  • What does "doesn't accept" mean? Can you share the errors you see? – Tim Perry Feb 26 '22 at 16:38
  • Plain text is likely to fail (because converting a zip to text and copy/pasting it isn't byte-wise identical to the original file), but injecting in other ways should work. One possibility is that there's a content-encoding being used here (i.e. the response data is compressed) which you're not doing the same way the real server does somehow. Is there a "content-encoding" header set? How are you injecting the new zip into the response? – Tim Perry Feb 26 '22 at 16:40
  • @TimPerry By doesn't accept, I mean the watch just crashes and restarts, I was however able to get around this problem, by spinning up a local python server, which serves the zip file, and simply changed the zip url to point to the local server (the zip url was retrieved from the real server in a previous request). This works, but is very janky. There is a request header called accept encoding which is set to gzip, and content type is set to application/json, and the response content type is set to application/zip. But the local server method works without any special headers. – psycoxer Feb 28 '22 at 04:27
  • I'm trying to inject the data by just changing the response, by replacing the "response", by just pasting the zip file in plain text. – psycoxer Feb 28 '22 at 04:29
  • I think converting a zip file to plain text will be lossy, and that's why this doesn't work. With HTTP Toolkit Pro you can read directly responses from a file automatically, but not with the free version. Your local Python server solution sounds like a sensible workaround though! – Tim Perry Feb 28 '22 at 18:14

0 Answers0