Charles Rewrite (detailed! Must understand series)

Charles Rewrite rewrite (detailed! Must understand at first glance!)

table of Contents

Lead: CharlesRoad - Charles rewrite
Author: become excellent white
hobbies: American some ice!

Note: If you encounter something you don’t understand halfway, you can directly comment and leave a message, and you will immediately answer questions!

What is Charles?

A macOsvery easy to use, powerful and excellent GUIpacket capture tool for the system.
windowsUsers recommend it fiddler.
Attachment: Charles official website address

What is Charles Rewrite?

官网的原义:The Rewrite tool enables you to create rules that modify requests and responses as they pass through Charles. Rules such as adding or changing a header or search and replace some text in the response body.

Let me briefly summarize, it is a tool that can be used to modify the request ( request) and return ( response)modify

Not much to say, actual combat is the main

1. Open charles, click on the menu bar to ToolsselectRewrite

Insert picture description here

2. The following interface appears, select Enable Rewrite, click Add, and one will appear Unitled Set(names can be customized in 3 places)

Insert picture description here

3. Click Locationbelow Add, the secondary interface appears
  • Choose what you need Protocol( http/https)
  • Put in the interface address that needs to be accessed api(after filling in, the Pathsum Querywill be automatically generated)
  • PortAnd Querychanged to * (can also be customized)
  • PathDo not move

Click OK
Insert picture description here

4. Click Add below to fill in the rewrite rules
  • Type: Type of rewriting, you can choose url/body, etc.
    Insert picture description here
  • Where: Where to modify the Request or Response
  • Match
    • Value: Find the value consistent with value in the matched content (supports regular matching)
  • Replace
    • Value: Substitute the value in Match's Value
      • Replace first: Replace only the first matched value
      • Replace all: Replace to all matched values

Click OK, the secondary interface disappears, then click OK
Insert picture description here

5. You're done, return to the web page to refresh and open the Console to check the interface information, you can see the effect!
Summary: If you have any questions or suggestions, you can leave a comment directly! I will reply one by one! !

Guess you like

Origin blog.csdn.net/weixin_44425934/article/details/108058189