preface

  • Whether forward development or reverse development, packet capture is a necessary tool. This article describes the use of packet capture tool Charles.

The installation

  • You can download a free trial version or pay for it.

  • Once the download is complete, the installation process is not detailed.

interface

  • The interface is as follows, the left is the network request, the right is the specific information, which provides breakpoint, weak network and other functions

Grab the weather forecast interface

  • We go to the websiteWeather.com/zh-CN/weath…To check the weather in Beijing
  • Check the packets captured by Charles

For example, when we develop small programs or independent apps, some weather apis need to be paid, we can find the relevant return data by capturing packets, and then parse and use the data.

HTTPS garbled characters

  • Sometimes we see packets that are garbled or unkonwn, because HTTPS requires security authentication

  • Security authentication: Help->SSL Proxying->Install Charles Root Certificate

  • Then go to the keychain and click Trust

  • The HTTPS request still cannot be parsed. You need to set SSL Proxying Settings, which can be configured individually for a particular URL, but are best configured generically for convenience, as shown below

The HTTPS request can then be parsed normally

The breakpoint modifies the data of site B

  • To Enable Breakpoints, click Proxy->Enable Breakpoints or directly select the Breakpoints icon
  • Right-click on BreakPoints
  • Refresh B station, tell a titleSour Candy' was not sampled by Miss Guo but Gaga herself!!Instead ofReverse column at https://xiaozhuanlan.com/cydia

  • Skip the breakpoint, and when you’re done, you can see that the change did succeed.

  • Changes to the request parameters

    • Right click Repeat to request again
    • Right click on Compose to modify the parameter, and then click Execute to Execute our modified request

Weak network test

  • Go to proxy ->Throttle Settings to set the weak net
  • We can test it by simulating a weak network

Catch mobile phone package

  • Click Help->SSL Proxyig ->Install Charless Root Certificate on a Mobile Device or Romete Browser

  • Open the WiFi Settings of the mobile phone, configure the proxy as manual, and change the IP address and port 192.168.1.6:8888 prompted by Charles

  • Open your mobile browser and type in chls.pro/ SSL

  • So now we’re going to have a popover on the Mac and we’re going to say yes or no

  • The phone asked us whether to download the profile file, and we chose to allow it

  • Go to Mobile’s General -> About Machine -> Certificate Trust Settings and trust change certificates

  • I operated the phone and found that Charles had grabbed the phone’s network requests

Mapping local Resources

  • Open the blog site: ityongzhent.github. IO /, as shown below

  • Charles captured the packet, found the URL, and click Save Response, Save to the local

  • Then save to the local fileHome page.aboutSuch as addeagle

  • Click Tools -> Map Local, enter the URL to be mapped in Host, and select the local file

  • Refresh the browser and you can see that the data is changed, as well as the package body, as shown below

Reference: www.cocoachina.com/articles/89…