mitmproxy is an interactive console program that lets developers monitor network traffic flow. It is very useful for iOS networking debugging and testing because you can inspect requests and responses of all network traffic on a real device or a simulator. I will list the steps to use this tool.
Install mitmproxy on a Mac
use this command to install mitmproxy
After I run this command, and I run into “no attribute ‘TLSv1_2_METHOD’” issue. I followed one instruction of this issue and solved this problem. The approach is as the below.
Set proxy on a Mac
After mitmproxy is installed, you can run
mitmproxy
to start the proxy sever. If you want to use this proxy server on a iOS simulator, you need to update your network setting on your mac. The proxy server is your mac IP address.Next visit http://mitm.it to install a certificate, then you can see all network traffic including iOS simulators on a mitmproxy console.
Set proxy on an iPhone
First go to iPhone WIFI setting, and then set your proxy server
After the proxy server is set, and then open Safari and visit http://mitm.it. Install a profile by clicking the Apple icon when you can see the screen below.
After you have done the steps above, you can see all iPhone network traffic on a mitmproxy console.
Free Proxy
Configuring Mac Os X Proxy For Use With Mitmproxy Key
Mac OS X Go to your System Preferences. Open the Network preferences. Choose the appropriate Network Port (you may need to reconfigure more than one if you have more than one) and click Configure. Go to the Proxies tab. Look in the list of proxy servers, you will see that Web Proxy and Secure Web Proxy are active. To have your Mac detect whether a proxy is necessary and automatically configure the proxy settings, enable the “Auto Proxy Discover” checkbox. Your Mac will use the Web Proxy Auto Discover protocol, or WPAD, to automatically detect whether a proxy is necessary. This setting may be used on business or school networks, for example. How it works. Mitmproxy is an open source proxy application that allows intercepting HTTP and HTTPS connections between any HTTP(S) client (such as a mobile or desktop browser) and a web server using a typical man-in-the-middle attack (MITM). Similar to other proxies (such as Squid), it accepts connections from clients and forwards them to the destination server.