2022-09-27

How to intercept traffic from iPhone

How to intercept traffic from iPhone on Mac using mitmproxy

Get IP address from Mac

System Preferences -> Network -> Wi-Fi -> Advanced... -> TCP/IP -> IPv4 Address: [x.x.x.x]

or run following command

ifconfig en0 | grep netmask | awk '{print $2}'

Install mitmproxy

brew install mitmproxy

Run mitmproxy

mitmproxy

Set iPhone to use mitmproxy

Settings -> Wi-Fi -> (i) -> Http PROXY

Configure Proxy: Off -> Manual Server: [IPv4 Address from above] Port: 8080

Install certificate

Visit http://mitm.it and install certificate

Once installed, you should be able to see Signed by mitmproxy Verified from Settings -> General -> VPN & Device Management -> CONFIGURATION PROFILES -> mitmproxy

If you see the below message on http://mitm.it, make sure iPhone is configured to use mitmproxy and mitmproxy is running.

If you can see this, traffic is not passing through mitmproxy

Enable mitmproxy

Settings -> General -> About -> Certificate Trust Settings

Run mitm

mitmweb
Web server listening at http://127.0.0.1:8081/ Proxy server listening at *:8080