I use in the work, see an article to summarize, convenient later use
Charles main functions
- Intercepts HTTP and HTTPS network packets.
- Supports resending network requests, facilitating back-end debugging.
- Network request parameters can be modified.
- Support network request interception, and dynamic modification.
- Support analog slow network.
Download and install
Open the browser to visit the official website of Charles, download the Charles installation package of the corresponding system, and then install it.
Charles main interface
The main view of Charles is shown below:The navigation bar provides the following common tools:
- : Clears all captured requests
- : The red dot indicates that a request is being captured. The gray state indicates that no request is being captured.
- : Grey indicates that network speed throttling is disabled. Green indicates that network speed throttling is enabled.
- : Gray indicates that the breakpoint is not enabled. Red indicates that the breakpoint is enabled.
- : Edit modify request, click to modify the content of the request.
- : To send the request repeatedly. After clicking, the selected request will be sent again.
- : verifies the response to the selected request.
- : Common functions, including common functions in the Tools menu.
- : Common Settings, including common Settings in the Proxy menu.
Main View
Charles provides two main views for viewing packets, called Structure and Sequence.
- Structure: This view classifies network requests by domain names accessed.
- Sequence: This view sorts network requests by access time.
You can switch back and forth between the two views depending on your needs. Charles provides a simple Filter function that allows you to enter a keyword to quickly Filter out web requests with a specified keyword in the URL.
Charles Menu Introduction
Charles’ main menu includes: File, Edit, View, Proxy, Tools, Window, and Help. The most commonly used main menus are Proxy and Tools respectively.
Charles Tutorial
Use Charles to capture packets on the PC
Charles automatically configures the proxy Settings for the browser and tool, so opening the tool will automatically capture packets. Just make sure there are a few things:
- Make sure Charles is in Start Recording state.
- Check the Proxy | Windows Proxy and the Proxy | Mozilla FireFox Proxy.
Use Charles to capture packets on the mobile end
The principle of mobile phone packet capture is similar to that of PC. The mobile phone entrusts the network to Charles for proxy to communicate with the server. The specific steps are as follows:
-
Keep your phone and computer on the same LAN, not necessarily on the same IP segment, but on the same router.
-
PC configuration:
Turn off the firewall on your computer (this is important).
Open Charles agent function: through the main singles open Proxy | Proxy Settings window, fill in the Proxy port (default port is 8888, don’t need to modify), check the Enable transparent HTTP proxying.
If you don’t need to grab the request on the computer, you can uncheck the Proxy | Windows Proxy and the Proxy | Mozilla FireFox Proxy.
- Mobile terminal configuration:
- By Charles main menu Help | Local IP Address, or from the command line tools enter ipconfig check the machine’s IP Address. (Or tap the wifi icon to turn on network preferences, which are shown in the image below.)
- Set proxy: Turn on the WIFI proxy Settings on the phone, enter the PC IP and Charles proxy port. (Here each phone is different, Huawei long hold point modification, display advanced.)
-
After setting up, we open any application that requires network request on the phone, and we can see Charles pop up the confirmation menu for requesting connection on the phone (only for the first time). Click Allow to complete the setting.
-
After completing the above steps, you can capture packets.
HTTPS packet capture using Charles
You need to configure HTTPS packet capture based on HTTP packet capture. The following steps need to be completed:
- The HTTP packet capture configuration is complete.
- PC installation, Charles Certificate: by Charles main menu Help | SSL Proxying | Install Charles Root Certificate to Install the Certificate.
-
Set the SSL Proxy: the main singles open Proxy | SSL Proxy Settings window, select the Enable SSL proxying.
-
Install the Charles certificate on the mobile terminal: By Charles main menu Help | SSL Proxying | Install Charles Root Certificate on a Mobile Device or Remote Browser installed Certificate.
-
After setting up, we open any application that requires network request on the phone, and we can see Charles pop up the confirmation menu for requesting connection on the phone (only for the first time). Click Allow to complete the setting.
-
After completing the preceding steps, you can capture packets using HTTPS.
conclusion
Reference article: Charles Features introduction and Use tutorial. My version is from 2021.