Intercept network traffic with mitmproxy in iOS Simulator

Ever had a problem debugging API calls?

Here is a great tool to help you with that (and probably a hundred of other things).

mitmproxy https://mitmproxy.org/

You can peek under the hood of your app network traffic and find all those pesky bugs! Here is how to configure it for your iOS Simulator:

Firstly let's install (this tutorial requires pip and python packages):

$ pip install mitmproxy

To make it work you need to inject mitmproxy's CA certificate to our iOS simulators. To do that use ADVTrustStore tool:

$ git clone https://github.com/ADVTOOLS/ADVTrustStore.git
$ cd ADVTrustStore
$ ./iosCertTrustManager.py -a ~/.mitmproxy/mitmproxy-ca-cert.pem

Executing these commands should trigger a bunch of Y/n dialogues. You will be prompted to install CA certificate on every iOS Simulator on your OSx. Choose 'Y' everywhere. Congrats! You have just added the certificate to all of your simulators.

The last thing to do is to setup a proxy to let mitmproxy catch all the traffic. To do that go to your network preferences:

Select HTTP and/or HTTPS on the left, insert your IP address in the place of localhost, and set the port to 8080. Accept all the changes.

You should be good to go! Just run the mitmproxy in your terminal and enjoy the awesomeness!

mitmproxy