version

  • MacOS Sierra 10.12.6
  • Charles V4.2
  • The iPhone 11.0.3

Get the local IP address

One of three ways.

  • System Preferences -> Network -> Wi-Fi
  • Charles -> Help -> Local IP Address
  • Terminal commandifconfig | grep -A 5 en0

Charles’s connection to his cell phone

The Mac is on the same Wi-Fi network as the iPhone.

Phone Settings

  1. Mobile – Settings – WIRELESS LAN – Connect to Wi-Fi
  2. Click “Configure Proxy”
  3. Configure proxy – Manual proxy
  4. Configure proxy-server and fill in “Local IP address”
  5. Configure proxy-port and fill in “8888”, this is Charles’ default port, if you change Charles’ port, fill in the actual port
  6. save

Charles will pop up a box to let you choose whether to Allow connections or not. If you want to capture packets, you need to select Allow.

At this point the phone’s HTTP access can be seen in Charles.

Caught the HTTPS

Unknown: SSL Proxying not enabled for this host: Enable in Proxy Settings, SSL locations”

To capture THE CONTENT of HTTPS, Charles and the mobile phone have been successfully connected, and Charles is enabled to perform the following Settings.

Mac Installation Certificate

Charles – Help – SSL Proxying – Install Charles Root Certificate

Mobile Phone Installation Certificate

Charles – Help – SSL Proxying – Install Charles Root Certificate on a Mobile Device

The installation address is displayed in the dialog box. The installation address is CHls. pro/ SSL. After the mobile phone accesses this address, the certificate is installed.

Once the certificate is installed, enable Charles… in “Settings – General – About Native – Certificate Trust Settings – Enable Full Trust for Root certificates”.

Charles set Proxy

Configuration items in Charles-proxy-ssl Proxying Settings…

Select Enable SSL Proxying, click Add, and fill in Host (the address you want to grab) and Port (443). You can use wildcard for Host. For simplicity and convenience, I will fill in “to” for Host. After OK, if the Location added by Add is not automatically checked, please check it manually and then OK again to complete.

Pay attention to

If the phone does not turn off the agent, the phone will fail to access the network when Charles is turned off