mitmproxy for iOS app usage

前言

It’s a powerful man-in-the-middle proxy that allows you to intercept, modify, replay, and save HTTP/S traffic.

Introduction

mitmproxy is an interactive man-in-the-middle proxy for HTTP and HTTPS with a console interface.
Documentation, tutorials and distribution packages can be found on the mitmproxy website:mitmproxy.org

It is very useful for networking debugging and testing because you can intercept HTTP & HTTPS requests and responses and modify them on the fly. I will list the steps to use this tool.

Tutorials

This tutorials only for mac user, other platform user please goto mitmproxy.org.

  1. Install mitmproxy on a Mac
    use this command to install mitmproxy
    brew install mitmproxy
    Run this command and waiting it finish.
    mitmproxyInstall
  2. Set proxy on a Mac
    after mitmproxy is installed, you can just run mitmproxy to start the proxy server. If you want to use this proxy server on a iOS simulator or your Mac, you need update your proxy on your Mac. The proxy server is your Mac IP address.
    mitmproxySetting
    Next open this mitm.it website to install a certificate, then you can see all network traffic on a mitmproxy console.
  3. Set proxy on an iPhone
    First go to iPhone WIFI setting, and then set your proxy server.(The proxy server is your mac IP address which run the mitmproxy, current my Mac IP address is :10.8.144.254)
    mitmproxySetting_ios
    After the proxy server is set, open this mitm.it website with Safari. Install a profile by clicking the Apple icon when you can see the screen below.
    mitmproxyInstall0
    mitmproxyInstall1
    After you have done the steps above, If you are on iOS 10.3 or later, open the Settings.app and navigate to General > About > Certificate Trust Settings, and find the mitmproxy certificate, and switch it on to enable full trust for it (More information about this change in iOS 10).
    mitmproxyInstallFullTrust
    When all steps have done, you can see all iPhone network traffic on mitmproxy console.
    mitmproxyConsoleLog
Zerlz wechat
扫码关注一个很懒的程序员!
Winter is coming, give me a penny!