Mobile https capture ---Charles

Original source:  Lu Nima's Dream Hospital

As a modern front-end, in addition to mastering html, css, js and a series of messy frameworks, you must also know how to capture and change packages.
Of course, we often use the developer tools that come with browsers such as chrome or firefox to solve regular websites or self-developed ones.
But there are often some special cases, such as non-SPA-type websites, when the interface request error occurs, it automatically jumps back to the login page, which is very painful, we can't know the reason for the error, etc. Of course, there are many others There are strange situations where our browser developer tools can't satisfy us (eg: crawling web pages that can only be opened in WeChat).
At this time, additional packet capture tools are needed:

  • win user: fiddler
  • mac user: Charles

There are many related usages of fiddler in Baidu, so we won't say more.

Today we talk about iphone Charles capture.

The conventional mobile phone has a lot of Baidu search through the Charles packet capture method. It is nothing more than that the mobile phone modifies the proxy to the computer IP+charles port in the LAN (default 8888);

Then you can select "allow" in the Charles pop-up window, and you can
open a web page on your mobile phone and see that the web page domain name appears in the left window of Charles ,
which can satisfy the packet capture of most websites.

However! Some websites use https and ssl encryption, which is very troublesome for us to catch. Follow the conventional method to catch it. There is a small lock icon in front of the domain name in the left window of Charles.

then what should we do?

  • 我们点击Help ---- ssl Proxying ---- Install Charles Root Certificate on a Mobile Device or Remote Browser
  • Copy the chls.pro/ssl address in the pop-up window and open this address in the mobile device, and the trust certificate will be automatically installed on the mobile phone
  • We choose Proxy ---- Proxy Setting
  • Check Enable transparent HTTP proxying under the Proxies tab and then OK
  • Then select Proxy ---- SSL Proxying Setting
  • Select the SSL Proxying tab, check Enable SSL Proxying, click Add to fill in the URL (the URL supports wildcard writing, generally we just write *) and the port number (usually the port number for ssl is 443) and then OK

Do you think this is the end? The last and most crucial step is yet to come

It did end like this before, but with the continuous update of the iphone system, since the iphone went on ver 10.3 (I'm not sure if it started from ver 10.3, it may be earlier, but it must have ended before ver 10) ) In fact, although we have installed the trust certificate, the trust certificate installed by default is actually turned off, so at this time you can still grab the https website opened by the mobile phone through Charles.

We go to settings on the iphone in turn - general - about this machine - certificate trust settings, you can see all the certificates you installed yourself, we find Charles Proxy CA (xxxxx... Click on the right slider to turn it on

OK set up!

Let's go back and try to open a https website with a mobile phone

It's time to witness the miracle!

We see that in the address bar on the left side of Charles, the small lock in front of the https website is gone, we click on one of the contents, and all the information can be seen at a glance! We crawled everything without a hitch!

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326822151&siteId=291194637
Recommended