Charles Auxiliary Debug Interface (RPM)

Source: Internet
Author: User
Tags dns spoofing

Original address Charles Auxiliary debugging interface

There's an article about the grab Kit fiddler and Charles, and here's how I use Charles to assist with debugging interfaces. Charles downloads the portal.

This article wrote a head, no time has been put not written, today just Saturday, also early work (bitter force of the Saturday overtime party), put this finish, in fact, this two days a bit cold dizzy, try not to write wrong.

There are often scenarios like this:

Scenario One: To see how other apps design the request, how to design the return data format, a function point request is implemented in several ways. Recently I was using a Shuwang software to listen to Ghost Stories (^0^), they limit non-VIP can only 100 offline, I try to use Charles intercept to change the return data, I become Super VIP, and then, no then ....

Scenario Two: A request to initiate a direct return to a variety of seemingly wonderful errors, check half-day code seems to be no problem, directly on the big Mouth called backstage Brother service Hung, backstage a look, good ah ...

Scenario Three: The development of new functions, the interface is also probably defined first, but the background brother busy chatting with her sister (^), the interface has not been written well ah ..., although you can write dead demo data in the code, but the background interface is written, and then to change it again? Is there a better way to have wood? Write the request first, can return the data normally, parse the result binding to the interface, finally the interface is written directly on the docking, Charles can help us to do so.

Scene Four: In addition to WiFi we also want to test 2g,3g,4g and other complex network conditions, mobile phone online tariffs are not cheap ah, you can let Charles limit the speed of simulation network environment.

Just list these scenes and enter the subject of this article.

I. Setting up an agent grab bag

Open the Charles Software and select Proxy->proxy settings to the following interface:

Take the iphone as an example, open: Set-up Wireless LAN, select a network to enter, scroll down to see there is an ' HTTP proxy ' module, select Manual mode, as well as fill in the configuration.

Server address to fill the computer's LAN IP, open system settings-network, you can see the native IP
Fill out, casually open an app, in Charles Software should pop up a prompt box, whether to agree to the Internet through the agent, Dot is good. Here is the agent I set up, open the app on the phone, see in the Charles Software.

Two. Simulate slow speed requests

After the app has been developed, we want to test the multi-environment, especially in the case of slow speed, before I wrote an article about the slow speed test, now with Charles can achieve this goal. Select Proxy->throtting Setting, open as set after

If you want to limit speed for an address, you can add the URL to speed limit in the hosts.

Three. Intercept the request to go to the specified address

For example, the API request is http://api.test.com/user?user_id=1, but the background is not written well, we will temporarily go to a local address Http://10.1.1.111/user_info.json, This is a JSON file to edit what is particularly convenient, how to change the convenience, but this has to be in a local server environment, recommend Nginx or Apache.

Select Tools->map Local to open the design interface, set up as follows:

Four. Intercept requests to return local file contents directly

If you do not bother to take the server environment, you can use this way, this can directly map a request return content to a local file, such as the http://api.test.com/user?user_id=1 corresponding request to map the return content to local file User_ Info.json,

Select Tools->map Local to open the design interface, set up as follows:

Five. Intercept Request modification Request information

The above way is directly replaced the whole, which if only want to intercept and make certain changes how to deal with it?

Select Tools->rewrite, set such as:

Six. Set the blacklist of requests

Do not want some requests to initiate, directly return 404, Can be blacklisted

Select Tools->black List, set such as:

Seven. DNS Spoofing

DNS spoofing, said the simple point is to resolve the domain name to a fake IP,
You do not have to use locahost,127.0.0.1, put a b 127.0.0.1 corresponding to the baidu.com to debug ~
Select Tools->dns Spoofing, set such as:

Eight. What the cache request returns

This I used to do cache data, so that the app can run without the server,
Select Tools->mirror, set such as:

These are the things I used to do in the development process, basic can be very good to solve and the background of the problem, I did not put each place is very fine, basically are only mentioned points, I believe you know this point to operate is easy to get started, but I would like to say that these are just tools, it is best to understand the fundamentals of the Web, Understand the HTTP protocol.

Also introduced a simulation request tool, chrome under the plug-in postman, very convenient to simulate Post,get,put,delete and other requests, analog text, upload file request, attach a:

With the aid of these tools, I believe you will never complain the debugging of the interface ...

Finally finished, and dizzy and sleepy, go to sleep ~

Charles Auxiliary Debug Interface (RPM)

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.