Http/https Grab Kit Charles Analysis

Source: Internet
Author: User
Tags server port

Charles is a clutch artifact, it is Java development of cross-platform software, not only can be used on Mac, Linux and Windows can be used, of course, the need to install the JDK to run, he is charged, need to be cracked.

Hack operation: Replace the Charles.jar in the downloaded file with the Charles.jar in the switch content.

HTTP Grab Bag

HTTP grab packet is relatively simple, basically as long as the opening of Charles, and then a random network request, you can see in Charles crawled information, as follows:

Depending on the packet capture, you can see how the request is requested, the request address, cookie information, and so on, as well as the results of the interface request:

Charles Client Grab bag

1. Get the IP address of all Charles PCs, can be viewed via cmd, input ipconfig

2. Set up the phone agent, set wifi-select "Show Advanced Options"-"proxy" is selected manually, "Server hostname" is the IP of Charles's PC, "Server port" is Charles default port 8888

3. You can also modify the port to find Charles Proxy-proxy Settings, you can see the port default for HTTP Proxy: 8888

4. After the proxy setting is successful, the Charles page pops up and asks if Charles is allowed to act as a network request agent for the phone, as follows:

5. Ios/android device Open the app you want to grab the package for network operation

Charles provides two views of the package, named "Structure" and "Sequence", respectively.

    1. The Structure View classifies network requests by the domain name that is accessed.

    2. Sequence View sorts network requests by time of access

Filtering Network Requests

Typically, we need to filter the network requests and only monitor requests sent to the specified directory server. For this need, the following methods:

Method One: Fill in the filter bar in the middle of the main interface with keywords that need to be filtered out. For example, the address of our server is: http://wwww.besttest.cn , then only need to fill in the Filter bar besttest can be

Method Two: Right-click on the network request you want to filter, select "Focus", then tick the focussed in the filter column as shown:

This can be done on a temporary basis, quickly filtering out some network requests that do not pass the keyword.

Analog Slow network

In testing, we often need to simulate a slow network or a high-latency network to test whether the application behaves properly under the mobile network. Charles has provided a good support for this demand.

On the Charles menu, select "Proxy", "throttle Setting", in the dialog box that pops up, we can tick "Enable throttling" and set the type of throttle Preset. As shown in the following:

If we only want to simulate the slow network of the specified site, you can tick the "only for selected hosts" item and then add the specified hosts to the lower half of the dialog box.

Modify Network Request Content

Sometimes in order to debug the server interface, we need to repeatedly try different parameters of the network request. Charles makes it easy to provide modification and re-sending of network requests. Simply right-click on a previous network request and select "Edit" to create an editable network request. As shown below:

We can modify any information about the request, including the URL address, port, parameters, etc., and then click "Execute" to send the modified network request (as shown). Charles supports us in modifying and sending this request several times, which is very convenient for us and the server-side debug interface, as shown in:

Modify Server return content

Sometimes we want the server to return some of the specified content, so we could debug some special cases. For example, if the list page is empty, the data is abnormal, and some time-consuming network requests are timed out of the situation. Without Charles, it would be cumbersome to construct the appropriate data for server mates. This time, the use of Charles-related features to meet our needs.

    1. Based on the specific requirements, Charles provides MAP functionality, Rewrite functionality, and breakpoints functionality, all of which can be used to modify the server's return content. The functional differences between the three are:

      1. The MAP feature is suitable for long-term redirection of some requests to another network address or local file.

      2. The Rewrite feature is suitable for some regular substitution of network requests.

      3. breakpoints function is suitable for making some temporary changes.

Breakpoints function is similar to the breakpoint we set in Xcode, when the specified network request occurs, Charles intercepts the request, and at this point we can temporarily modify the return of the network request in Charles.

Is that we temporarily modify the access to the user information API, the page information has been changed, after the modification is completed, click "Execute" to allow the network request to continue.

It is important to note that the timing of the entire network request is not paused when the network request is intercepted and modified using the Breakpoints feature, so a prolonged pause can cause the client's request to time out.

Http/https Grab Kit Charles Analysis

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.