这个配置还是很方便的,模拟器也可以实现抓包Fidder 与 Charles 可以实现,但是感觉配置太麻烦了些。还要收费啊哈。。。
注意
1. 安装好后要运行:mitmproxy -p 8080 (-b 10.0.0.2 加本地地址)否则插件安装到手机会不成功。
Use mitmproxy for iOS app network testing
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
pip 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.
sudo mv /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/OpenSSL /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_OpenSSL
-
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.